From patchwork Tue Nov 22 14:52:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Vernet X-Patchwork-Id: 24424 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2253136wrr; Tue, 22 Nov 2022 06:57:29 -0800 (PST) X-Google-Smtp-Source: AA0mqf63jYkiTH64qTqlGG5uyvbc8zNhl+5V/J2iRpAOqCa1n6u+L4Mh9l4PJVZ4w4uGRCEyMciI X-Received: by 2002:a63:d547:0:b0:476:ca45:15b6 with SMTP id v7-20020a63d547000000b00476ca4515b6mr3758324pgi.470.1669129049313; Tue, 22 Nov 2022 06:57:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669129049; cv=none; d=google.com; s=arc-20160816; b=NV+8Acyrz6rQpDmzxEhDwvg4Lxitjroa5oeKyNBFq20Ha++nT7OaDOq2yuMIJhlF2J TzDmgxlN8RDDMZ+5Ly4gGyhjGA/eKujuOSaeAiWU4Gr6MlM8dcX2OkavDJIDIEwn1hQX t0AvF//Awbdbe3zOI7BjoDAZMFwXSBCZa0spFACYlrjIICoUbA7YWiS0ryaOXoUTb1FR imKr5O28kPdWHHDBh5I/ivB5EPHqC11i8Ylmgbf8hzdg+MIbJZRleqGvstt0Ql9z0Z2F 4GK+8+qYMvUjTSWO2LzzwCWCkdnG4pEnnnDeb1S/JGjao7A+4bIivnyjJJvhYJk0Eqbc 7qpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=p4O1j+FTYhgropL6ZEAaxt9d0t6JxFTTNDaB9rWhEes=; b=EDd8VpT97ZH08S06ZXVvQlU7aTEdNIOWABAxhYFoHQMaH7EhseE2vZUpkCYODKbZYV oAL9JGntmJusILHdc/F0YG221xAo7CCNWVHOQsqRIV9BSiahrEA/kX6tH0rnnc6RbqVM 79XI4uEfepgvsLI9Z5Z10VYPUHud6Pf74COqjlc5tikdaG30DoNOIjXWWE9ZjhnwFzLR KyR7cRcFJLYsBsFBBAVIeGgl7vYKZWZkrZru5eDKT1FWk95JO2T8Be5pWM8voCEIknv0 2LMpDdSgv9a0uk7v6N7FEV3RJp0DazrVg/WKVDCxPgtPaOJejBlN+TkZbTXd3WSsSPxg q1Zg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pi3-20020a17090b1e4300b00209a3e49f63si19661573pjb.94.2022.11.22.06.57.15; Tue, 22 Nov 2022 06:57:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233916AbiKVOyw (ORCPT + 99 others); Tue, 22 Nov 2022 09:54:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233884AbiKVOxr (ORCPT ); Tue, 22 Nov 2022 09:53:47 -0500 Received: from mail-qt1-f182.google.com (mail-qt1-f182.google.com [209.85.160.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19BA031EF6; Tue, 22 Nov 2022 06:53:07 -0800 (PST) Received: by mail-qt1-f182.google.com with SMTP id h24so9378615qta.9; Tue, 22 Nov 2022 06:53:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=p4O1j+FTYhgropL6ZEAaxt9d0t6JxFTTNDaB9rWhEes=; b=4OFBzA4VkhDC40zAN5+S+D7ap08rkyRSIpXHlH6KXp/4wGgJpyz4jGKq18/OBf+5PL Q712pAtyKm9ErZfv+BOAtz21nQRA11CVxhQ7UjMpmDR1XL53KHy4HBzhPXf5D3V8+Q67 53UVFb3RD46F7j6/jMZE+G4PtrJSbve+S6PPpGzmLgccuUb1N3oipSGAohGS5xAW51MG +h0ksfxSs/9Jf19rkDaDwh+ofLmqbOSNrKq3yV5UpcOSda9QgcaMGK2sEiCtXCVziczt +JdBGd1SlB2zqLIOiE8RVIrfLaslyB7HI0Kek80ZYUVq7WyIBlSB+0Vcu/4T2djQ10b/ PdDQ== X-Gm-Message-State: ANoB5plEs2aqSOOc0MGpdNWYVdzTtlfkI22QjArlY1qnLHJTxVvua6mQ 0sxw+7TeFIaLiG2ZHmLa1oOPOiRtH2jsZWbN X-Received: by 2002:ac8:72c2:0:b0:3a5:2a33:d250 with SMTP id o2-20020ac872c2000000b003a52a33d250mr22307352qtp.568.1669128785740; Tue, 22 Nov 2022 06:53:05 -0800 (PST) Received: from localhost ([2620:10d:c091:480::1:3170]) by smtp.gmail.com with ESMTPSA id k7-20020ac80747000000b003a4d5fed8c3sm8212633qth.85.2022.11.22.06.53.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 06:53:05 -0800 (PST) From: David Vernet To: bpf@vger.kernel.org Cc: ast@kernel.org, andrii@kernel.org, daniel@iogearbox.net, martin.lau@linux.dev, yhs@fb.com, song@kernel.org, sdf@google.com, john.fastabend@gmail.com, kpsingh@kernel.org, jolsa@kernel.org, haoluo@google.com, tj@kernel.org, kernel-team@fb.com, linux-kernel@vger.kernel.org Subject: [PATCH bpf-next 1/2] bpf: Add bpf_task_from_pid() kfunc Date: Tue, 22 Nov 2022 08:52:59 -0600 Message-Id: <20221122145300.251210-2-void@manifault.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221122145300.251210-1-void@manifault.com> References: <20221122145300.251210-1-void@manifault.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750208662117132108?= X-GMAIL-MSGID: =?utf-8?q?1750208662117132108?= Callers can currently store tasks as kptrs using bpf_task_acquire(), bpf_task_kptr_get(), and bpf_task_release(). These are useful if a caller already has a struct task_struct *, but there may be some callers who only have a pid, and want to look up the associated struct task_struct * from that to e.g. find task->comm. This patch therefore adds a new bpf_task_from_pid() kfunc which allows BPF programs to get a struct task_struct * kptr from a pid. Signed-off-by: David Vernet --- kernel/bpf/helpers.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c index 9e8a5557ea8d..d5a849d44a35 100644 --- a/kernel/bpf/helpers.c +++ b/kernel/bpf/helpers.c @@ -1879,6 +1879,25 @@ void bpf_task_release(struct task_struct *p) put_task_struct_rcu_user(p); } +/** + * bpf_task_from_pid - Find a struct task_struct from its pid by looking it up + * in the root pid namespace idr. If a task is returned, it must either be + * stored in a map, or released with bpf_task_release(). + * @pid: The pid of the task being looked up. + */ +struct task_struct *bpf_task_from_pid(s32 pid) +{ + struct task_struct *p; + + rcu_read_lock(); + p = find_task_by_pid_ns(pid, &init_pid_ns); + if (p) + bpf_task_acquire(p); + rcu_read_unlock(); + + return p; +} + void *bpf_cast_to_kern_ctx(void *obj) { return obj; @@ -1904,6 +1923,7 @@ BTF_ID_FLAGS(func, bpf_list_pop_back, KF_ACQUIRE | KF_RET_NULL) BTF_ID_FLAGS(func, bpf_task_acquire, KF_ACQUIRE | KF_TRUSTED_ARGS) BTF_ID_FLAGS(func, bpf_task_kptr_get, KF_ACQUIRE | KF_KPTR_GET | KF_RET_NULL) BTF_ID_FLAGS(func, bpf_task_release, KF_RELEASE) +BTF_ID_FLAGS(func, bpf_task_from_pid, KF_ACQUIRE | KF_RET_NULL) BTF_SET8_END(generic_btf_ids) static const struct btf_kfunc_id_set generic_kfunc_set = { From patchwork Tue Nov 22 14:53:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Vernet X-Patchwork-Id: 24425 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2253520wrr; Tue, 22 Nov 2022 06:58:15 -0800 (PST) X-Google-Smtp-Source: AA0mqf4kzk1zZ4Yc/f5lXmxFIMVGvGbBSq7Y3LQa0B7ACsNOufLjTLt0VsQjZW4Hls8BT+Mz6V0P X-Received: by 2002:a17:90a:5787:b0:218:8398:5846 with SMTP id g7-20020a17090a578700b0021883985846mr22497995pji.241.1669129095245; Tue, 22 Nov 2022 06:58:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669129095; cv=none; d=google.com; s=arc-20160816; b=rXjM8dxNfpNaTWhlGEECJXdKWIYiyyoY3tHKd0PQQtz+8sA/8ENz7ORzfFO0rl05Fr asZ5wTfIhGnxqqwRfC7VW9BrP4ViH0pQIIcJHRbjOQuvzk3GQ6bWhbvd0p+GL543Ej5J 6ViHofCAWXkBhYcUZ4eHw4kSm3d5csHH4wXZW+Elto/FJ6QqWGsRnsGhsfdk04VfcCgd fMT4EAr4l3ylHjMJtvoDyrmkLvbebmCQg4Ib8bNKtYB707lNE0crQT+Zn6t/yCxZPaq7 56LLjbFW0JvNNMCzdPEtdN7FdRZ8RzUpvo1iKGEEv1gZIBr0tLfBCkLzV9XtVI170rZP 2fqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Gb/yuqONdDj2N+Rq15f0dZqgCjwngdlnAQHxxom73jM=; b=0Gqa1caJIlWMUiSGTex643StB8MoRPW+ppSNimZaJfIgQSRR9pDOwZ3KMjAyM5Wrvz lvnMixYvhVIdsUazaejNZzsmux//4SUzRHvNWOGc/mLdXsKAb9n9K+5xtZ/p66p1uggr nPhmyYVwhGD7sJ2DMnXnSc2+g0kgBhIjzSLL+7x+fhdyY6U17KFBVWeTGoV3RvDC8lPR hd6wwuiC8u0yus/8UoGyV2LWA9swwZOpO1ld4Olboqoksez9UqehN10Dm/mkz5/11llG VT+TabN/gck1/r6xcMXBYG0CNzyxPV49rJYtbpJKP0w0RrPJvOt0fQHPb6xgCXD+otx6 7Tig== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z198-20020a6333cf000000b0046b0e168af0si13594883pgz.597.2022.11.22.06.58.01; Tue, 22 Nov 2022 06:58:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233721AbiKVOy7 (ORCPT + 99 others); Tue, 22 Nov 2022 09:54:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233894AbiKVOxr (ORCPT ); Tue, 22 Nov 2022 09:53:47 -0500 Received: from mail-qv1-f54.google.com (mail-qv1-f54.google.com [209.85.219.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9753131EFD; Tue, 22 Nov 2022 06:53:08 -0800 (PST) Received: by mail-qv1-f54.google.com with SMTP id df6so8004112qvb.0; Tue, 22 Nov 2022 06:53:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Gb/yuqONdDj2N+Rq15f0dZqgCjwngdlnAQHxxom73jM=; b=3Iujq7N3C1dcnDlzjI9OwzCP+Ck14p7wOYogFeWEtK1Sj7lWsXdAiJ7ppfKyJCHn+B OBbgJ0dHaM5vVFTJwCyDrQf/J8DxeoF0nvu8LQhXT/ohp1aiKuFot0glDr/cnldZDKSD m9uyZxhFvVg1XELQx8WryY7s4JE82cob91WXDBpOq0+brzAYflRQ4ui/BW+dxbltfEsY iWwRJHscug+vbUJb7lXb1kwkivrkkP0CiiJDfaXH9M88q4jjKELeWIa0kyqNc2k5I1vn ba6ZKREc8NJ89am4NSRk8zvYDLliy5FQGWeMC9n3cdlS7p2aMhlYeJDlg/4cHZ4CF4c2 gxNQ== X-Gm-Message-State: ANoB5pnWygXLpgnLa+JPGGQItHtbas46LhT/DusO3YIQ+o3RrZ6n3cX7 Weo1eH6zuy80aDJZuM6/I1DYMueppZQDKfJV X-Received: by 2002:a0c:ef01:0:b0:4bb:d6bc:be1c with SMTP id t1-20020a0cef01000000b004bbd6bcbe1cmr4047071qvr.82.1669128787277; Tue, 22 Nov 2022 06:53:07 -0800 (PST) Received: from localhost ([2620:10d:c091:480::1:3170]) by smtp.gmail.com with ESMTPSA id r13-20020a05620a298d00b006eee3a09ff3sm10337092qkp.69.2022.11.22.06.53.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 06:53:06 -0800 (PST) From: David Vernet To: bpf@vger.kernel.org Cc: ast@kernel.org, andrii@kernel.org, daniel@iogearbox.net, martin.lau@linux.dev, yhs@fb.com, song@kernel.org, sdf@google.com, john.fastabend@gmail.com, kpsingh@kernel.org, jolsa@kernel.org, haoluo@google.com, tj@kernel.org, kernel-team@fb.com, linux-kernel@vger.kernel.org Subject: [PATCH bpf-next 2/2] selftests/bpf: Add selftests for bpf_task_from_pid() Date: Tue, 22 Nov 2022 08:53:00 -0600 Message-Id: <20221122145300.251210-3-void@manifault.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221122145300.251210-1-void@manifault.com> References: <20221122145300.251210-1-void@manifault.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750208710521638129?= X-GMAIL-MSGID: =?utf-8?q?1750208710521638129?= Add some selftest testcases that validate the expected behavior of the bpf_task_from_pid() kfunc that was added in the prior patch. Signed-off-by: David Vernet --- .../selftests/bpf/prog_tests/task_kfunc.c | 4 + .../selftests/bpf/progs/task_kfunc_common.h | 1 + .../selftests/bpf/progs/task_kfunc_failure.c | 13 ++++ .../selftests/bpf/progs/task_kfunc_success.c | 73 +++++++++++++++++++ 4 files changed, 91 insertions(+) diff --git a/tools/testing/selftests/bpf/prog_tests/task_kfunc.c b/tools/testing/selftests/bpf/prog_tests/task_kfunc.c index 4994fe6092cc..ffd8ef4303c8 100644 --- a/tools/testing/selftests/bpf/prog_tests/task_kfunc.c +++ b/tools/testing/selftests/bpf/prog_tests/task_kfunc.c @@ -78,6 +78,9 @@ static const char * const success_tests[] = { "test_task_xchg_release", "test_task_get_release", "test_task_current_acquire_release", + "test_task_from_pid_arg", + "test_task_from_pid_current", + "test_task_from_pid_invalid", }; static struct { @@ -99,6 +102,7 @@ static struct { {"task_kfunc_release_fp", "arg#0 pointer type STRUCT task_struct must point"}, {"task_kfunc_release_null", "arg#0 is ptr_or_null_ expected ptr_ or socket"}, {"task_kfunc_release_unacquired", "release kernel function bpf_task_release expects"}, + {"task_kfunc_from_pid_no_null_check", "arg#0 is ptr_or_null_ expected ptr_ or socket"}, }; static void verify_fail(const char *prog_name, const char *expected_err_msg) diff --git a/tools/testing/selftests/bpf/progs/task_kfunc_common.h b/tools/testing/selftests/bpf/progs/task_kfunc_common.h index 160d6dde00be..c0ffd171743e 100644 --- a/tools/testing/selftests/bpf/progs/task_kfunc_common.h +++ b/tools/testing/selftests/bpf/progs/task_kfunc_common.h @@ -23,6 +23,7 @@ struct hash_map { struct task_struct *bpf_task_acquire(struct task_struct *p) __ksym; struct task_struct *bpf_task_kptr_get(struct task_struct **pp) __ksym; void bpf_task_release(struct task_struct *p) __ksym; +struct task_struct *bpf_task_from_pid(s32 pid) __ksym; static inline struct __tasks_kfunc_map_value *tasks_kfunc_map_value_lookup(struct task_struct *p) { diff --git a/tools/testing/selftests/bpf/progs/task_kfunc_failure.c b/tools/testing/selftests/bpf/progs/task_kfunc_failure.c index 93e934ddfcb6..e310473190d5 100644 --- a/tools/testing/selftests/bpf/progs/task_kfunc_failure.c +++ b/tools/testing/selftests/bpf/progs/task_kfunc_failure.c @@ -258,3 +258,16 @@ int BPF_PROG(task_kfunc_release_unacquired, struct task_struct *task, u64 clone_ return 0; } + +SEC("tp_btf/task_newtask") +int BPF_PROG(task_kfunc_from_pid_no_null_check, struct task_struct *task, u64 clone_flags) +{ + struct task_struct *acquired; + + acquired = bpf_task_from_pid(task->pid); + + /* Releasing bpf_task_from_pid() lookup without a NULL check. */ + bpf_task_release(acquired); + + return 0; +} diff --git a/tools/testing/selftests/bpf/progs/task_kfunc_success.c b/tools/testing/selftests/bpf/progs/task_kfunc_success.c index be4534b5ba2e..60c7ead41cfc 100644 --- a/tools/testing/selftests/bpf/progs/task_kfunc_success.c +++ b/tools/testing/selftests/bpf/progs/task_kfunc_success.c @@ -147,3 +147,76 @@ int BPF_PROG(test_task_current_acquire_release, struct task_struct *task, u64 cl return 0; } + +static void lookup_compare_pid(const struct task_struct *p) +{ + struct task_struct *acquired; + + acquired = bpf_task_from_pid(p->pid); + if (!acquired) { + err = 1; + return; + } + + if (acquired->pid != p->pid) + err = 2; + bpf_task_release(acquired); +} + +SEC("tp_btf/task_newtask") +int BPF_PROG(test_task_from_pid_arg, struct task_struct *task, u64 clone_flags) +{ + struct task_struct *acquired; + + if (!is_test_kfunc_task()) + return 0; + + lookup_compare_pid(task); + return 0; +} + +SEC("tp_btf/task_newtask") +int BPF_PROG(test_task_from_pid_current, struct task_struct *task, u64 clone_flags) +{ + struct task_struct *current, *acquired; + + if (!is_test_kfunc_task()) + return 0; + + lookup_compare_pid(bpf_get_current_task_btf()); + return 0; +} + +static int is_pid_lookup_valid(s32 pid) +{ + struct task_struct *acquired; + + acquired = bpf_task_from_pid(pid); + if (acquired) { + bpf_task_release(acquired); + return 1; + } + + return 0; +} + +SEC("tp_btf/task_newtask") +int BPF_PROG(test_task_from_pid_invalid, struct task_struct *task, u64 clone_flags) +{ + struct task_struct *acquired; + + if (!is_test_kfunc_task()) + return 0; + + if (is_pid_lookup_valid(-1)) { + err = 1; + return 0; + } + + if (is_pid_lookup_valid(0xcafef00d)) { + err = 2; + return 0; + } + + return 0; +}