[PATCH v2 0/4] Introduce user namespace capabilities

2024-06-09 Thread Jonathan Calmels
This patch series introduces a new user namespace capability set, as well as some plumbing around it (i.e. sysctl, secbit, lsm support). First patch goes over the motivations for this as well as prior art. In summary, while user namespaces are a great success today in that they avoid running a lo

[PATCH v2 1/4] capabilities: Add user namespace capabilities

2024-06-09 Thread Jonathan Calmels
Attackers often rely on user namespaces to get elevated (yet confined) privileges in order to target specific subsystems (e.g. [1]). Distributions have been pretty adamant that they need a way to configure these, most of them carry out-of-tree patches to do so, or plainly refuse to enable them. As

[PATCH v2 2/4] capabilities: Add securebit to restrict userns caps

2024-06-09 Thread Jonathan Calmels
This patch adds a new capability security bit designed to constrain a task’s userns capability set to its bounding set. The reason for this is twofold: - This serves as a quick and easy way to lock down a set of capabilities for a task, thus ensuring that any namespace it creates will never be

[PATCH v2 3/4] capabilities: Add sysctl to mask off userns caps

2024-06-09 Thread Jonathan Calmels
This patch adds a new system-wide userns capability mask designed to mask off capabilities in user namespaces. This mask is controlled through a sysctl and can be set early in the boot process or on the kernel command line to exclude known capabilities from ever being gained in namespaces. Once se

[PATCH v2 4/4] bpf,lsm: Allow editing capabilities in BPF-LSM hooks

2024-06-09 Thread Jonathan Calmels
This patch allows modifying the various capabilities of the struct cred in BPF-LSM hooks. More specifically, the userns_create hook called prior to creating a new user namespace. With the introduction of userns capabilities, this effectively provides a simple way for LSMs to control the capabiliti

[PATCH v2] sefltests: net: Add on/off checks for network interface non fixed features

2024-06-09 Thread Abhinav Jain
This patch addresses the TODO (add non fixed feature on/off check). I have tested it manually on my system and made changes as suggested in v1 Signed-off-by: Abhinav Jain --- PATCH v1: https://lore.kernel.org/all/20240606212714.27472-1-jain.abhinav...@gmail.com/ Changes since v1: - Removed the

Re: [PATCH] selftests: net: Add on/off checks for network interface non fixed features

2024-06-09 Thread Abhinav Jain
On Fri, 7 Jun 2024 19:01:27 +0100, Simon Horman wrote: > Hi Abhinav, > > I suspect this will now only report a failure if tail fails, > but ignore ethtool failures. Hi Simon, I agree, I missed this part earlier. After taking other suggestion into account, we don't need this tail and I have remov

Re: [PATCH bpf-next v3 01/11] bpf, lsm: Annotate lsm hook return value range

2024-06-09 Thread Casey Schaufler
On 6/8/2024 6:54 AM, Alexei Starovoitov wrote: > On Sat, Jun 8, 2024 at 1:04 AM Xu Kuohai wrote: >> On 6/7/2024 5:53 AM, Paul Moore wrote: >>> On Thu, Apr 11, 2024 at 8:24 AM Xu Kuohai wrote: From: Xu Kuohai Add macro LSM_RET_INT to annotate lsm hook return integer type and the >>

Re: [PATCH bpf-next v3 01/11] bpf, lsm: Annotate lsm hook return value range

2024-06-09 Thread Paul Moore
On Sun, Jun 9, 2024 at 1:39 PM Casey Schaufler wrote: > On 6/8/2024 6:54 AM, Alexei Starovoitov wrote: > > On Sat, Jun 8, 2024 at 1:04 AM Xu Kuohai wrote: > >> On 6/7/2024 5:53 AM, Paul Moore wrote: > >>> On Thu, Apr 11, 2024 at 8:24 AM Xu Kuohai > >>> wrote: > From: Xu Kuohai > > >>

Re: [PATCH 1/5] kunit: string-stream: export non-static functions

2024-06-09 Thread Ivan Orlov
On 6/8/24 10:20, David Gow wrote: On Tue, 4 Jun 2024 at 20:32, Ivan Orlov wrote: Export non-static functions from the string-stream.c file into the KUnit namespace in order to be able to access them from the KUnit core tests (when they are loaded as modules). Signed-off-by: Ivan Orlov ---

Re: [PATCH 4/5] kunit: assert: export non-static functions

2024-06-09 Thread Ivan Orlov
On 6/8/24 10:20, David Gow wrote: I think this could be merged with patch 5, as it's not useful on its own. Also, a few of the symbol names might be a little too generic to be exported: maybe we should give them a 'kunit_assert' prefix? Cheers, -- David Hi David, Thank you for the review and

Re: [PATCH v2 4/4] bpf,lsm: Allow editing capabilities in BPF-LSM hooks

2024-06-09 Thread Paul Moore
On Sun, Jun 9, 2024 at 6:40 AM Jonathan Calmels wrote: > > This patch allows modifying the various capabilities of the struct cred > in BPF-LSM hooks. More specifically, the userns_create hook called > prior to creating a new user namespace. > > With the introduction of userns capabilities, this e

Re: [PATCH net-next v10 02/14] net: page_pool: create hooks for custom page providers

2024-06-09 Thread David Wei
On 2024-06-07 17:27, David Ahern wrote: > I also do not understand why the ifq cache and overloading xdp functions > have stuck around; I always thought both were added by Jonathan to > simplify kernel ports during early POC days. Setting up an Rx queue for ZC w/ a different pp will be done proper

Re: [PATCH net-next v10 02/14] net: page_pool: create hooks for custom page providers

2024-06-09 Thread David Wei
On 2024-06-07 17:52, Jason Gunthorpe wrote: > IMHO it seems to compose poorly if you can only use the io_uring > lifecycle model with io_uring registered memory, and not with DMABUF > memory registered through Mina's mechanism. By this, do you mean io_uring must be exclusively used to use this fea

Re: [PATCH net-next v10 02/14] net: page_pool: create hooks for custom page providers

2024-06-09 Thread Pavel Begunkov
On 6/10/24 01:37, David Wei wrote: On 2024-06-07 17:52, Jason Gunthorpe wrote: IMHO it seems to compose poorly if you can only use the io_uring lifecycle model with io_uring registered memory, and not with DMABUF memory registered through Mina's mechanism. By this, do you mean io_uring must be

Re: [PATCH net-next v10 02/14] net: page_pool: create hooks for custom page providers

2024-06-09 Thread Pavel Begunkov
On 6/7/24 17:59, Mina Almasry wrote: On Fri, Jun 7, 2024 at 8:47 AM Pavel Begunkov wrote: On 6/7/24 16:42, Pavel Begunkov wrote: On 6/7/24 15:27, David Ahern wrote: On 6/7/24 7:42 AM, Pavel Begunkov wrote: I haven't seen any arguments against from the (net) maintainers so far. Nor I see any

Re: [PATCH v2 1/4] capabilities: Add user namespace capabilities

2024-06-09 Thread Serge E. Hallyn
On Sun, Jun 09, 2024 at 03:43:34AM -0700, Jonathan Calmels wrote: (Adding amorgan as he doesn't seem to be on cc list) > Attackers often rely on user namespaces to get elevated (yet confined) > privileges in order to target specific subsystems (e.g. [1]). Distributions I'd modify this to say "in

Re: [PATCH v2 2/4] capabilities: Add securebit to restrict userns caps

2024-06-09 Thread Serge E. Hallyn
On Sun, Jun 09, 2024 at 03:43:35AM -0700, Jonathan Calmels wrote: > This patch adds a new capability security bit designed to constrain a > task’s userns capability set to its bounding set. The reason for this is > twofold: > > - This serves as a quick and easy way to lock down a set of capabiliti

[PATCH 00/13] riscv: Add support for xtheadvector

2024-06-09 Thread Charlie Jenkins
.com/skiffos/SkiffOS/tree/master/configs/allwinner/nezha [2] https://github.com/smaeul/u-boot/commit/2e89b706f5c956a70c989cd31665f1429e9a0b48 [3] https://lore.kernel.org/all/20240503-dev-charlie-support_thead_vector_6_9-v6-0-cb7624e65...@rivosinc.com/ [4] https://lore.kernel.org/linux-riscv/20240609-

[PATCH 01/13] dt-bindings: riscv: Add xtheadvector ISA extension description

2024-06-09 Thread Charlie Jenkins
The xtheadvector ISA extension is described on the T-Head extension spec Github page [1] at commit 95358cb2cca9. Link: https://github.com/T-head-Semi/thead-extension-spec/blob/95358cb2cca9489361c61d335e03d3134b14133f/xtheadvector.adoc [1] Signed-off-by: Charlie Jenkins Reviewed-by: Conor Doole

[PATCH 02/13] dt-bindings: thead: add a vlen register length property

2024-06-09 Thread Charlie Jenkins
Add a property analogous to the vlenb CSR so that software can detect the vector length of each CPU prior to it being brought online. Currently software has to assume that the vector length read from the boot CPU applies to all possible CPUs. On T-Head CPUs implementing pre-ratification vector, rea

[PATCH 03/13] riscv: dts: allwinner: Add xtheadvector to the D1/D1s devicetree

2024-06-09 Thread Charlie Jenkins
The D1/D1s SoCs support xtheadvector so it can be included in the devicetree. Also include vlenb for the cpu. Signed-off-by: Charlie Jenkins --- arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/riscv/boot/dts/allwinner/sun20

[PATCH 04/13] riscv: Add thead and xtheadvector as a vendor extension

2024-06-09 Thread Charlie Jenkins
Add support to the kernel for THead vendor extensions with the target of the new extension xtheadvector. Signed-off-by: Charlie Jenkins --- arch/riscv/Kconfig.vendor| 13 + arch/riscv/include/asm/vendor_extensions/thead.h | 16 arch/riscv/kern

[PATCH 05/13] riscv: vector: Use vlenb from DT for thead

2024-06-09 Thread Charlie Jenkins
If thead,vlenb is provided in the device tree, prefer that over reading the vlenb csr. Signed-off-by: Charlie Jenkins --- arch/riscv/include/asm/cpufeature.h | 2 ++ arch/riscv/kernel/cpufeature.c | 48 + arch/riscv/kernel/vector.c | 12

[PATCH 06/13] RISC-V: define the elements of the VCSR vector CSR

2024-06-09 Thread Charlie Jenkins
From: Heiko Stuebner The VCSR CSR contains two elements VXRM[2:1] and VXSAT[0]. Define constants for those to access the elements in a readable way. Acked-by: Guo Ren Reviewed-by: Conor Dooley Signed-off-by: Heiko Stuebner Signed-off-by: Charlie Jenkins --- arch/riscv/include/asm/csr.h | 5

[PATCH 07/13] riscv: csr: Add CSR encodings for VCSR_VXRM/VCSR_VXSAT

2024-06-09 Thread Charlie Jenkins
The VXRM vector csr for xtheadvector has an encoding of 0xa and VXSAT has an encoding of 0x9. Co-developed-by: Heiko Stuebner Signed-off-by: Charlie Jenkins --- arch/riscv/include/asm/csr.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/riscv/include/asm/csr.h b/arch/riscv/include/a

[PATCH 09/13] riscv: vector: Support xtheadvector save/restore

2024-06-09 Thread Charlie Jenkins
Use alternatives to add support for xtheadvector vector save/restore routines. Signed-off-by: Charlie Jenkins --- arch/riscv/Kconfig.vendor | 13 ++ arch/riscv/include/asm/csr.h | 6 + arch/riscv/include/asm/switch_to.h | 2 +- arch/riscv/include/asm/vector.h

[PATCH 10/13] riscv: hwprobe: Add thead vendor extension probing

2024-06-09 Thread Charlie Jenkins
Add a new hwprobe key "RISCV_HWPROBE_KEY_VENDOR_EXT_THEAD_0" which allows userspace to probe for the new RISCV_ISA_VENDOR_EXT_XTHEADVECTOR vendor extension. This new key will allow userspace code to probe for which thead vendor extensions are supported. This API is modeled to be consistent with RI

[PATCH 11/13] riscv: hwprobe: Document thead vendor extensions and xtheadvector extension

2024-06-09 Thread Charlie Jenkins
Document support for thead vendor extensions using the key RISCV_HWPROBE_KEY_VENDOR_EXT_THEAD_0 and xtheadvector extension using the key RISCV_HWPROBE_VENDOR_EXT_XTHEADVECTOR. Signed-off-by: Charlie Jenkins Reviewed-by: Evan Green --- Documentation/arch/riscv/hwprobe.rst | 10 ++ 1 file

[PATCH 12/13] selftests: riscv: Fix vector tests

2024-06-09 Thread Charlie Jenkins
Overhaul the riscv vector tests to use kselftest_harness to help the test cases correctly report the results and decouple the individual test cases from each other. With this refactoring, only run the test cases is vector is reported and properly report the test case as skipped otherwise. The v_ini

[PATCH 13/13] selftests: riscv: Support xtheadvector in vector tests

2024-06-09 Thread Charlie Jenkins
Extend existing vector tests to be compatible with the xtheadvector instructions. Signed-off-by: Charlie Jenkins --- .../selftests/riscv/vector/v_exec_initval_nolibc.c | 23 -- tools/testing/selftests/riscv/vector/v_helpers.c | 17 +++- tools/testing/selftests/riscv/vector/v_helpers.h |

Re: [PATCH 0/4] selftest: x86: conform tests to TAP format output

2024-06-09 Thread Muhammad Usama Anjum
Adding Borislav, Dave and x86 mailing list: Please review the series. On 6/8/24 1:52 AM, Shuah Khan wrote: > On 5/27/24 23:04, Muhammad Usama Anjum wrote: >> Kind reminder >> >> On 4/14/24 6:18 PM, Muhammad Usama Anjum wrote: >>> In this series, 4 tests are being conformed to TAP. >>> >>>

[PATCH] MAINTAINERS: Add selftests/x86 entry

2024-06-09 Thread Muhammad Usama Anjum
There are no maintainers specified for tools/testing/selftests/x86. Shuah has mentioned [1] that the patches should go through x86 tree or in special cases directly to Shuah's tree after getting ack-ed from x86 maintainers. Different people have been confused when sending patches as correct maintai

[PATCH v2 0/4] kselftests: vdso: conform tests to TAP output

2024-06-09 Thread Muhammad Usama Anjum
Conform individual tests to TAP output. One patch conform one test. With this series, all vDSO tests become TAP conformant. First patch conform the test by using kselftest_harness.h. Other patches are conforming using default kselftest.h helpers. All tests have been tested multiple times before a

[PATCH v2 1/4] kselftests: vdso: vdso_test_clock_getres: conform test to TAP output

2024-06-09 Thread Muhammad Usama Anjum
Conform the layout, informational and status messages to TAP. No functional change is intended other than the layout of output messages. Use kselftest_harness.h to conform to TAP as the number of tests depend on the available options at build time. The kselftest_harness makes the test easy to conve

[PATCH v2 2/4] kselftests: vdso: vdso_test_correctness: conform test to TAP output

2024-06-09 Thread Muhammad Usama Anjum
Conform the layout, informational and status messages to TAP. No functional change is intended other than the layout of output messages. Signed-off-by: Muhammad Usama Anjum --- .../selftests/vDSO/vdso_test_correctness.c| 146 +- 1 file changed, 74 insertions(+), 72 deletions(

[PATCH v2 3/4] kselftests: vdso: vdso_test_getcpu: conform test to TAP output

2024-06-09 Thread Muhammad Usama Anjum
Conform the layout, informational and status messages to TAP. No functional change is intended other than the layout of output messages. Signed-off-by: Muhammad Usama Anjum --- tools/testing/selftests/vDSO/vdso_test_getcpu.c | 16 +++- 1 file changed, 7 insertions(+), 9 deletions(-)

[PATCH v2 4/4] kselftests: vdso: vdso_test_gettimeofday: conform test to TAP output

2024-06-09 Thread Muhammad Usama Anjum
Conform the layout, informational and status messages to TAP. No functional change is intended other than the layout of output messages. Signed-off-by: Muhammad Usama Anjum --- .../selftests/vDSO/vdso_test_gettimeofday.c | 23 ++- 1 file changed, 12 insertions(+), 11 deletions(

Re: [PATCH 02/13] dt-bindings: thead: add a vlen register length property

2024-06-09 Thread Rob Herring (Arm)
, 'dependencies', 'dependentRequired', 'dependentSchemas', 'patternProperties', 'properties', 'not', 'if', 'then', 'else', 'unevaluatedProperties', 'deprecated', 'maintainers', '