Message ID | 20230125143816.721952-1-void@manifault.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp308997wrn; Wed, 25 Jan 2023 06:41:27 -0800 (PST) X-Google-Smtp-Source: AMrXdXsaY+jOdcuLrQB7BEjKzVmae5Nr6TM7mtQ5V0Aml3o+tTgc6hnAXBM8EMdPlTQGQjrQdwp+ X-Received: by 2002:a17:907:8c89:b0:871:74c:b1f1 with SMTP id td9-20020a1709078c8900b00871074cb1f1mr40787469ejc.12.1674657686807; Wed, 25 Jan 2023 06:41:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674657686; cv=none; d=google.com; s=arc-20160816; b=i9Z+/bcDFss5bEvzmjcKtJ9vQfMEPyPw5po9BVggj6xUWxPfqqDAVYE40CLwyAYlWK g/E14hYk1XFIy2A+dmINMUFJkTHQzonzwni0cILl4tHTZu/2pLfW4YlIY5XF3TSxEIOX YJ2JIsUHTd0pg9H3JTG+Lzawkf+91RZh+BlKAdYTBIaP3FWfQLfptOznbgIWWNLQsFim 10eaZAkORQhUVl3jVqImzEdpm29JxUludkrjNsQPQEt9H+hMwrSj4DhSmUX9zaVfr5ge N8NBdVc8YwzYAfuv0iDJrux18KJUvczkMfrj0/1WwbB9LXfOeAZxkABF5/gom4qRFA5V 9zQw== 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=aTz9rWTHtKZ1MdagbfZKTdu+fe8rzlCpxSijJtcJzkk=; b=Keqbwh+5r+OHSRi4Cd88hcZ0hbOy/iqM2FwkMkRNhYFXfZtTysq845WMMKJVOGSrF6 VCI85lOMOOWVKCc2tleGLxeJ8fahsCraj4xwuSlhipCC3tZyD+AfVvsZCaf6FR4TOWil Rf2z9iXCuvBfr4MZzmxKzGgYTHqYRZDVMFPtAHtf/SS/KQleM5DZUsD+5OF03/CulEGk v4Ux0tKz7Ti8FXEnuqVaN5iof2Y2UhzPv7r//V2DGr1NsOO4yCewdpIfC47Sw0E7HjXy A29beiCt176SuX5hpg0Y/dJTehfoSVTDkGgJ2rUJFiqXAfNlgYwta2/SjvOslTl84lxS YStw== 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 l22-20020a170907915600b0086bd1b49150si6365454ejs.4.2023.01.25.06.41.02; Wed, 25 Jan 2023 06:41: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 S235888AbjAYOkX (ORCPT <rfc822;rust.linux@gmail.com> + 99 others); Wed, 25 Jan 2023 09:40:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235852AbjAYOkN (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 25 Jan 2023 09:40:13 -0500 Received: from mail-vk1-f178.google.com (mail-vk1-f178.google.com [209.85.221.178]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DFB8AD26; Wed, 25 Jan 2023 06:39:43 -0800 (PST) Received: by mail-vk1-f178.google.com with SMTP id bs10so808241vkb.3; Wed, 25 Jan 2023 06:39:43 -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=aTz9rWTHtKZ1MdagbfZKTdu+fe8rzlCpxSijJtcJzkk=; b=sOx2rbh4oRY0P4EHsc5JL1CJiYSdmewGbIH4RolKwqTNje3tWC3ZDz29yxj0l9U6hP MHOlhyJOk3d5RW8NUzwqs+jVskxr6S3cKGaarjsC8zKNPgxeyxVs+GYbexdeoKqb3Pcw PBh2BqH3Sa2eU6W8leuiiAnKpS/zCfN92j9evmPKvxZvo8+uDwkus/AoHUFesJ9F+u37 mWlaUBakN0S9Uf/0dQj+O8DNyXTAMiwRUFai7KMmacMvTRkdAR7GdiGfLsPwN3XbFFDT xl8uogURJh/mL2w7Dh9Z6PZ4nvPOZSUIZ9qw8MHC2WO+OUdwi6zWjmMbagDl+v6FvBNi RFCw== X-Gm-Message-State: AO0yUKVpNTca5jDxzNeZNxjZ99hL0c22t+787sV1+6KT6izOwv9A17EA W16ERvZkDNt4UwfJpZ8SKAHOlNWVGM/r0jHv X-Received: by 2002:a05:6122:1690:b0:3e3:44e3:3d97 with SMTP id 16-20020a056122169000b003e344e33d97mr2713395vkl.14.1674657498506; Wed, 25 Jan 2023 06:38:18 -0800 (PST) Received: from localhost ([24.1.27.177]) by smtp.gmail.com with ESMTPSA id e127-20020a376985000000b006f9ddaaf01esm3537783qkc.102.2023.01.25.06.38.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 06:38:18 -0800 (PST) From: David Vernet <void@manifault.com> 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, tj@kernel.org, memxor@gmail.com Subject: [PATCH bpf-next v3 0/7] Enable cpumasks to be used as kptrs Date: Wed, 25 Jan 2023 08:38:09 -0600 Message-Id: <20230125143816.721952-1-void@manifault.com> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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_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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756005858350018643?= X-GMAIL-MSGID: =?utf-8?q?1756005858350018643?= |
Series |
Enable cpumasks to be used as kptrs
|
|
Message
David Vernet
Jan. 25, 2023, 2:38 p.m. UTC
This is part 3 of https://lore.kernel.org/all/20230119235833.2948341-1-void@manifault.com/ Part 2: https://lore.kernel.org/bpf/20230120192523.3650503-1-void@manifault.com/ This series is based off of commit b613d335a743 ("bpf: Allow trusted args to walk struct when checking BTF IDs"). Changelog: ---------- v2 -> v3: - Rebase onto master (commit described above). Only conflict that required resolution was updating the task_kfunc selftest suite error message location. - Put copyright onto one line in kernel/bpf/cpumask.c. - Remove now-unneeded pid-checking logic from progs/nested_trust_success.c. - Fix a couple of small grammatical typos in documentation. v1 -> v2: - Put back 'static' keyword in bpf_find_btf_id() (kernel test robot <lkp@intel.com>) - Surround cpumask kfuncs in __diag() blocks to avoid no-prototype build warnings (kernel test robot <lkp@intel.com>) - Enable ___init suffixes to a type definition to signal that a type is a nocast alias of another type. That is, that when passed to a kfunc that expects one of the two types, the verifier will reject the other even if they're equivalent according to the C standard (Kumar and Alexei) - Reject NULL for all trusted args, not just PTR_TO_MEM (Kumar) - Reject both NULL and PTR_MAYBE_NULL for all trusted args (Kumar and Alexei ) - Improve examples given in cpumask documentation (Alexei) - Use __success macro for nested_trust test (Alexei) - Fix comment typo in struct bpf_cpumask comment header. - Fix another example in the bpf_cpumask doc examples. - Add documentation for ___init suffix change mentioned above. David Vernet (7): bpf: Disallow NULLable pointers for trusted kfuncs bpf: Enable cpumasks to be queried and used as kptrs selftests/bpf: Add nested trust selftests suite selftests/bpf: Add selftest suite for cpumask kfuncs bpf/docs: Document cpumask kfuncs in a new file bpf/docs: Document how nested trusted fields may be defined bpf/docs: Document the nocast aliasing behavior of ___init Documentation/bpf/cpumasks.rst | 393 +++++++++++++++ Documentation/bpf/index.rst | 1 + Documentation/bpf/kfuncs.rst | 76 ++- kernel/bpf/Makefile | 1 + kernel/bpf/cpumask.c | 476 ++++++++++++++++++ kernel/bpf/verifier.c | 6 + tools/testing/selftests/bpf/DENYLIST.s390x | 2 + .../selftests/bpf/prog_tests/cgrp_kfunc.c | 4 +- .../selftests/bpf/prog_tests/cpumask.c | 74 +++ .../selftests/bpf/prog_tests/nested_trust.c | 12 + .../selftests/bpf/progs/cpumask_common.h | 114 +++++ .../selftests/bpf/progs/cpumask_failure.c | 126 +++++ .../selftests/bpf/progs/cpumask_success.c | 426 ++++++++++++++++ .../selftests/bpf/progs/nested_trust_common.h | 12 + .../bpf/progs/nested_trust_failure.c | 33 ++ .../bpf/progs/nested_trust_success.c | 19 + .../selftests/bpf/progs/task_kfunc_failure.c | 4 +- 17 files changed, 1774 insertions(+), 5 deletions(-) create mode 100644 Documentation/bpf/cpumasks.rst create mode 100644 kernel/bpf/cpumask.c create mode 100644 tools/testing/selftests/bpf/prog_tests/cpumask.c create mode 100644 tools/testing/selftests/bpf/prog_tests/nested_trust.c create mode 100644 tools/testing/selftests/bpf/progs/cpumask_common.h create mode 100644 tools/testing/selftests/bpf/progs/cpumask_failure.c create mode 100644 tools/testing/selftests/bpf/progs/cpumask_success.c create mode 100644 tools/testing/selftests/bpf/progs/nested_trust_common.h create mode 100644 tools/testing/selftests/bpf/progs/nested_trust_failure.c create mode 100644 tools/testing/selftests/bpf/progs/nested_trust_success.c
Comments
Hello: This series was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <ast@kernel.org>: On Wed, 25 Jan 2023 08:38:09 -0600 you wrote: > This is part 3 of https://lore.kernel.org/all/20230119235833.2948341-1-void@manifault.com/ > > Part 2: https://lore.kernel.org/bpf/20230120192523.3650503-1-void@manifault.com/ > > This series is based off of commit b613d335a743 ("bpf: Allow trusted > args to walk struct when checking BTF IDs"). > > [...] Here is the summary with links: - [bpf-next,v3,1/7] bpf: Disallow NULLable pointers for trusted kfuncs https://git.kernel.org/bpf/bpf-next/c/caf713c338bd - [bpf-next,v3,2/7] bpf: Enable cpumasks to be queried and used as kptrs https://git.kernel.org/bpf/bpf-next/c/516f4d3397c9 - [bpf-next,v3,3/7] selftests/bpf: Add nested trust selftests suite https://git.kernel.org/bpf/bpf-next/c/a6541f4d2804 - [bpf-next,v3,4/7] selftests/bpf: Add selftest suite for cpumask kfuncs https://git.kernel.org/bpf/bpf-next/c/7b6abcfa15cd - [bpf-next,v3,5/7] bpf/docs: Document cpumask kfuncs in a new file https://git.kernel.org/bpf/bpf-next/c/bdbda395845e - [bpf-next,v3,6/7] bpf/docs: Document how nested trusted fields may be defined https://git.kernel.org/bpf/bpf-next/c/d94cbde2183f - [bpf-next,v3,7/7] bpf/docs: Document the nocast aliasing behavior of ___init https://git.kernel.org/bpf/bpf-next/c/027bdec89364 You are awesome, thank you!