From patchwork Mon Dec 12 23:53:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Vernet X-Patchwork-Id: 32562 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2538598wrr; Mon, 12 Dec 2022 16:04:26 -0800 (PST) X-Google-Smtp-Source: AA0mqf5fz3/QtxUl20E/Fg06majmEZmJp73LGKgpPOYyRfPhOjxVd30FRqMiLauPZxGxdBqIx3rv X-Received: by 2002:a17:90b:46d5:b0:21d:ef10:d6ca with SMTP id jx21-20020a17090b46d500b0021def10d6camr16058863pjb.45.1670889866074; Mon, 12 Dec 2022 16:04:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670889866; cv=none; d=google.com; s=arc-20160816; b=kpoDxA4/frd1E/0D/2tf7f0B4x5XFJn1RO8v5jCZOY8KTI2qQebbYPMDXMlH5n7Sbw /2Iqedrpc6CdlzntiGS3w6weKpcj+yuhwQNMxr0KWrzKtlT4LaG3Zpi1wl/vfGkf0i1L lvVF/F2rXOcfJdmtXYaq7T+yD3zQrL0FiwbygoOToO0N889H7BxVXJNZVbHeOFHRdVjv lXJKn6UcRwIkO/2EDZbz8HpiKW/SxnnJiwwqZJogbRYkf2wrExv2ilXWLCfg6e5e6uuh KZyb9GloKI4gVRR1EvP49xS0t3gwT90TOW+yOA6uT0hHdMdj2vWD/ApaDR920n8bXZvF jBsw== 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 :message-id:date:subject:cc:to:from; bh=noGFwDjUHBLfUSIIxv927Be+1JlbaOUfDbfux21yM8Q=; b=lZZCt1GGyV0GGOTSrzoLECFATnwVKqv4zuJwHRS9pQ1JiCwVY0SmR7S2dbFcWqBgjY QX/8G1p9ypRV3ibqxunYKbMwIU/jtT3vLslYmhvEeTo+n3EIK+zSiN/0urKyaAO4RqCt 9wN3aorjbl3JRsfTtRjwQRFr0zSjtEmkYjrrq+zZzqO5BTRmSsyrqfgr7oB59bPYrBzS QAgcUUkK2avaTJztoEm7EqXeRqmGweiBu8v0H6M12JGgVFjLx1iOI4+vxFebjM0Toquv Pzi4j8MmBk6VCuKE1isXYYK5nKbdjyNs6s7f6pr9c2NrNVthRsupYGjbg6I9g360iG95 CuUA== 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 x93-20020a17090a38e600b00213b01e42adsi10186509pjb.42.2022.12.12.16.04.11; Mon, 12 Dec 2022 16:04:26 -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 S233735AbiLLXyX (ORCPT + 99 others); Mon, 12 Dec 2022 18:54:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233562AbiLLXyU (ORCPT ); Mon, 12 Dec 2022 18:54:20 -0500 Received: from mail-qt1-f177.google.com (mail-qt1-f177.google.com [209.85.160.177]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C135417886; Mon, 12 Dec 2022 15:54:19 -0800 (PST) Received: by mail-qt1-f177.google.com with SMTP id g7so10522254qts.1; Mon, 12 Dec 2022 15:54:19 -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:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=noGFwDjUHBLfUSIIxv927Be+1JlbaOUfDbfux21yM8Q=; b=NboE11xuiihF4dSLCFJwN985SvkF9ZEZo4Bg/o3oDML0+eZe7JlGjKDIhEMrpQuJkm 79v9J+M4D1rXx+2e7bH+8bWddDAJd/h1OHKPugCxo90f4ZKxRnJS32XntOEEcOtJFWeC IDj1feNBIVqS4NPGOGsHKS2jiw4uFmwuVUVwotzW8e0Lxo7qSZq8s0kw4qZlbVZWij+d wgcBpg9WuSQqJHy/7KwrB9yOZUxKhxRNr0qNbTN2ddFJzyU2GqqSg1OcOLCD/odFwNjQ PJh0ImNZ23JZmyg9uXkCY6WBilu9Tf0/a85EctnLKWCgo+vEvOWRUjQj4EXdo/NZ9gZY a6Sw== X-Gm-Message-State: ANoB5pkBj7cx+de5wuTZHUxw/UKTPyVE8GrnOg86V9ELdb8Yf6om9gzx gBJM9k0ZKiTqkLDgky0f9X/CE7dMAfxdwt8r X-Received: by 2002:a05:622a:11c3:b0:3a7:f424:3ef9 with SMTP id n3-20020a05622a11c300b003a7f4243ef9mr32212052qtk.13.1670889258382; Mon, 12 Dec 2022 15:54:18 -0800 (PST) Received: from localhost ([2620:10d:c091:480::1:6a51]) by smtp.gmail.com with ESMTPSA id p13-20020a05620a112d00b006f87d28ea3asm6489672qkk.54.2022.12.12.15.54.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Dec 2022 15:54:18 -0800 (PST) From: David Vernet To: bpf@vger.kernel.org Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev, song@kernel.org, yhs@meta.com, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org, linux-kernel@vger.kernel.org, kernel-team@meta.com, kernel test robot Subject: [PATCH bpf-next] bpf/selftests: Use parent instead of last_wakee in task kfunc test Date: Mon, 12 Dec 2022 17:53:44 -0600 Message-Id: <20221212235344.1563280-1-void@manifault.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.6 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?1752055012201947141?= X-GMAIL-MSGID: =?utf-8?q?1752055012201947141?= Commit fe147956fca4 ("bpf/selftests: Add selftests for new task kfuncs") added a negative selftest called task_kfunc_acquire_trusted_walked which ensures that a BPF program that gets a struct task_struct * pointer from walking a struct is properly rejected by the verifier if it tries to pass that pointer to a task kfunc. In order to do this, it uses task->last_wakee, but unfortunately that's not defined on UP builds. Just use task->parent instead. Reported-by: kernel test robot Fixes: fe147956fca4 ("bpf/selftests: Add selftests for new task kfuncs") Signed-off-by: David Vernet --- tools/testing/selftests/bpf/progs/task_kfunc_failure.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/progs/task_kfunc_failure.c b/tools/testing/selftests/bpf/progs/task_kfunc_failure.c index 87fa1db9d9b5..60508c20041f 100644 --- a/tools/testing/selftests/bpf/progs/task_kfunc_failure.c +++ b/tools/testing/selftests/bpf/progs/task_kfunc_failure.c @@ -73,7 +73,7 @@ int BPF_PROG(task_kfunc_acquire_trusted_walked, struct task_struct *task, u64 cl struct task_struct *acquired; /* Can't invoke bpf_task_acquire() on a trusted pointer obtained from walking a struct. */ - acquired = bpf_task_acquire(task->last_wakee); + acquired = bpf_task_acquire(task->parent); bpf_task_release(acquired); return 0;