Re: [PATCH] selftests: bpf: add malloc failures checks in bpf_iter

2023-10-23 Thread Yonghong Song
On 10/23/23 7:59 PM, Yuran Pereira wrote: Since some malloc calls in bpf_iter may at times fail, this patch adds the appropriate fail checks, and ensures that any previously allocated resource is appropriately destroyed before returning the function. Signed-off-by: Yuran Pereira ---

Re: [PATCH-cgroup 1/4] workqueue: Add workqueue_unbound_exclude_cpumask() to exclude CPUs from wq_unbound_cpumask

2023-10-23 Thread Tejun Heo
Hello, On Wed, Oct 18, 2023 at 03:18:52PM -0400, Waiman Long wrote: > I have a second thought after taking a further look at that. First of all, > cpuset_allowed_mask isn't relevant here and the mask can certainly contain > offline CPUs. So cpu_possible_mask is the proper fallback. > > With the

Re: [PATCH-cgroup 3/4] cgroup/cpuset: Keep track of CPUs in isolated partitions

2023-10-23 Thread Tejun Heo
Hello, Waiman. On Wed, Oct 18, 2023 at 02:24:00PM -0400, Waiman Long wrote: > If you mean saving the exclusion cpumask no matter who the caller is, we can > add another exclusion cpumask to save it and expose it to sysfs. This should > be done in the first workqueue patch, not as part of this

[PATCH] selftests: bpf: add malloc failures checks in bpf_iter

2023-10-23 Thread Yuran Pereira
Since some malloc calls in bpf_iter may at times fail, this patch adds the appropriate fail checks, and ensures that any previously allocated resource is appropriately destroyed before returning the function. Signed-off-by: Yuran Pereira --- tools/testing/selftests/bpf/prog_tests/bpf_iter.c |

Re: [PATCH] selftests: add a sanity check for zswap

2023-10-23 Thread Rik van Riel
On Fri, 2023-10-20 at 15:20 -0700, Nhat Pham wrote: > > This test add a sanity check that ensure zswap storing works as > intended. > > Signed-off-by: Nhat Pham > Acked-by: Rik van Riel -- All Rights Reversed.

RE: [PATCH v6 8/8] iommu/vt-d: Disallow read-only mappings to nest parent domain

2023-10-23 Thread Liu, Yi L
> From: Baolu Lu > Sent: Monday, October 23, 2023 8:18 PM > > On 2023/10/23 19:15, Liu, Yi L wrote: > >> I would also prefer to introduce is_nested_parent_domain to the user > >> domain allocation patch (patch 7/8). This field should be checked when > >> allocating a nested user domain. > > A

[PATCH] selftests/net: give more time to udpgro nat tests

2023-10-23 Thread Lucas Karpinski
In some conditions, background processes in udpgro don't have enough time to set up the sockets. When foreground processes start, this results in the bad GRO lookup test freezing or reporting that it received 0 gro segments. To fix this, increase the time given to background processes to complete

Re: [PATCH v3 2/3] userfaultfd: UFFDIO_MOVE uABI

2023-10-23 Thread Suren Baghdasaryan
On Mon, Oct 23, 2023 at 11:37 AM Peter Xu wrote: > > On Mon, Oct 23, 2023 at 10:43:49AM -0700, Suren Baghdasaryan wrote: > > > Maybe we should follow what it does with mremap()? Then your current code > > > is fine. Maybe that's the better start. > > > > I think that was the original intention,

Re: [PATCH v3 2/3] userfaultfd: UFFDIO_MOVE uABI

2023-10-23 Thread Suren Baghdasaryan
On Mon, Oct 23, 2023 at 8:53 AM David Hildenbrand wrote: > > On 23.10.23 14:29, David Hildenbrand wrote: > >> + > >> +/* Only allow remapping if both are mlocked or both aren't */ > >> +if ((src_vma->vm_flags & VM_LOCKED) != (dst_vma->vm_flags & > >> VM_LOCKED)) > >> +return

Re: [PATCH v3 2/3] userfaultfd: UFFDIO_MOVE uABI

2023-10-23 Thread Suren Baghdasaryan
On Mon, Oct 23, 2023 at 5:29 AM David Hildenbrand wrote: > > Focusing on validate_remap_areas(): > > > + > > +static int validate_remap_areas(struct vm_area_struct *src_vma, > > + struct vm_area_struct *dst_vma) > > +{ > > + /* Only allow remapping if both have the

Re: [PATCH v4 08/17] iommufd: Always setup MSI and anforce cc on kernel-managed domains

2023-10-23 Thread Nicolin Chen
On Mon, Oct 23, 2023 at 10:59:35AM -0300, Jason Gunthorpe wrote: > On Sun, Oct 22, 2023 at 05:18:03PM -0700, Nicolin Chen wrote: > > > > > And where should we add this comment? Kdoc of > > > > the alloc uAPI? > > > > > > Maybe right in front of the only enforce_cc op callback? > > > > OK. How

Re: [PATCH v4 08/17] iommufd: Always setup MSI and anforce cc on kernel-managed domains

2023-10-23 Thread Nicolin Chen
On Mon, Oct 23, 2023 at 02:53:20AM +, Tian, Kevin wrote: > > From: Nicolin Chen > > Sent: Monday, October 23, 2023 8:18 AM > > > > On Sat, Oct 21, 2023 at 01:38:04PM -0300, Jason Gunthorpe wrote: > > > On Fri, Oct 20, 2023 at 11:59:13AM -0700, Nicolin Chen wrote: > > > > On Fri, Oct 20, 2023

Re: [PATCH v3 2/3] userfaultfd: UFFDIO_MOVE uABI

2023-10-23 Thread Peter Xu
On Mon, Oct 23, 2023 at 10:43:49AM -0700, Suren Baghdasaryan wrote: > > Maybe we should follow what it does with mremap()? Then your current code > > is fine. Maybe that's the better start. > > I think that was the original intention, basically treating remapping > as a write operation. Maybe I

Re: [PATCH RFC RFT 2/5] fork: Add shadow stack support to clone3()

2023-10-23 Thread Mark Brown
On Mon, Oct 23, 2023 at 04:32:22PM +, Edgecombe, Rick P wrote: > On Mon, 2023-10-23 at 14:20 +0100, Mark Brown wrote: > +Some security folks I *think* I captured everyone for future versions but I might've missed some, it's a long Cc list. > > Add parameters to clone3() specifying the

Re: [RFC PATCH v1 0/8] Introduce mseal() syscall

2023-10-23 Thread Jeff Xu
On Thu, Oct 19, 2023 at 4:06 PM Linus Torvalds wrote: > > On Thu, 19 Oct 2023 at 15:47, Pedro Falcato wrote: > > > > > > For mprotect()/mmap(), is Linux implementation limited by POSIX ? > > > > No. POSIX works merely as a baseline that UNIX systems aim towards. > > You can (and very frequently

Re: [PATCH v3 2/3] userfaultfd: UFFDIO_MOVE uABI

2023-10-23 Thread Suren Baghdasaryan
On Sun, Oct 22, 2023 at 10:02 AM Peter Xu wrote: > > On Thu, Oct 19, 2023 at 02:24:06PM -0700, Suren Baghdasaryan wrote: > > On Thu, Oct 12, 2023 at 3:00 PM Peter Xu wrote: > > > > > > On Sun, Oct 08, 2023 at 11:42:27PM -0700, Suren Baghdasaryan wrote: > > > > From: Andrea Arcangeli > > > > > >

Re: [RFC PATCH v1 0/8] Introduce mseal() syscall

2023-10-23 Thread Jeff Xu
On Thu, Oct 19, 2023 at 3:47 PM Pedro Falcato wrote: > > On Thu, Oct 19, 2023 at 6:30 PM Jeff Xu wrote: > > > > Hi Pedro > > > > Some followup on mmap() + mprotect(): > > > > On Wed, Oct 18, 2023 at 11:20 AM Jeff Xu wrote: > > > > > > On Tue, Oct 17, 2023 at 3:35 PM Pedro Falcato > > > wrote:

Re: [PATCH v3 2/3] userfaultfd: UFFDIO_MOVE uABI

2023-10-23 Thread Suren Baghdasaryan
On Mon, Oct 23, 2023 at 9:36 AM David Hildenbrand wrote: > > On 23.10.23 14:03, David Hildenbrand wrote: > > On 22.10.23 17:46, Peter Xu wrote: > >> On Fri, Oct 20, 2023 at 07:16:19PM +0200, David Hildenbrand wrote: > >>> These are rather the vibes I'm getting from Peter. "Why rename it, could >

Re: [PATCH v3 2/3] userfaultfd: UFFDIO_MOVE uABI

2023-10-23 Thread David Hildenbrand
On 23.10.23 14:03, David Hildenbrand wrote: On 22.10.23 17:46, Peter Xu wrote: On Fri, Oct 20, 2023 at 07:16:19PM +0200, David Hildenbrand wrote: These are rather the vibes I'm getting from Peter. "Why rename it, could confuse people because the original patches are old", "Why exclude it if it

Re: [PATCH RFC RFT 2/5] fork: Add shadow stack support to clone3()

2023-10-23 Thread Edgecombe, Rick P
+Some security folks On Mon, 2023-10-23 at 14:20 +0100, Mark Brown wrote: > Unlike with the normal stack there is no API for configuring the the > shadow > stack for a new thread, instead the kernel will dynamically allocate > a new > shadow stack with the same size as the normal stack. This

Re: [PATCH v3 2/3] userfaultfd: UFFDIO_MOVE uABI

2023-10-23 Thread David Hildenbrand
On 23.10.23 14:29, David Hildenbrand wrote: + + /* Only allow remapping if both are mlocked or both aren't */ + if ((src_vma->vm_flags & VM_LOCKED) != (dst_vma->vm_flags & VM_LOCKED)) + return -EINVAL; + + if (!(src_vma->vm_flags & VM_WRITE) || !(dst_vma->vm_flags

Re: [PATCH 0/2] um: kunit: Add Clang support for CONFIG_GCOV

2023-10-23 Thread Arthur Grillo
On 20/10/23 06:21, Michał Winiarski wrote: > Clang uses a different set of CLI args for coverage, and the output > needs to be processed by a different set of tools. > Update the Makefile and add an example of usage in kunit docs. Great change! It's great not to rely on older versions of GCC

Re: [PATCH] selftests:net change ifconfig with ip command

2023-10-23 Thread David Ahern
On 10/23/23 1:12 AM, Jiri Pirko wrote: >> ip addr add ... > > Why not "address" then? :) no objection from me. > What's wrong with "a"? 1-letter commands can be ambiguous. Test scripts should be clear and obvious.

Re: [PATCH v2] selftests:net change ifconfig with ip command

2023-10-23 Thread David Ahern
On 10/23/23 6:34 AM, Swarup Laxman Kotiaklapudi wrote: > Change ifconfig with ip command, > on a system where ifconfig is > not used this script will not > work correcly. > > Test result with this patchset: > > sudo make TARGETS="net" kselftest > > TAP version 13 > 1..1 > timeout set to

Re: [PATCH v4 08/17] iommufd: Always setup MSI and anforce cc on kernel-managed domains

2023-10-23 Thread Jason Gunthorpe
On Sun, Oct 22, 2023 at 05:18:03PM -0700, Nicolin Chen wrote: > > > And where should we add this comment? Kdoc of > > > the alloc uAPI? > > > > Maybe right in front of the only enforce_cc op callback? > > OK. How about this? Might be a bit verbose though: > /* >*

[PATCH RFC RFT 5/5] kselftest/clone3: Test shadow stack support

2023-10-23 Thread Mark Brown
Add basic test coverage for specifying the shadow stack for a newly created thread via clone3(), including coverage of the newly extended argument structure. We detect support for shadow stacks on the running system by attempting to allocate a shadow stack page during initialisation using

[PATCH RFC RFT 3/5] selftests/clone3: Factor more of main loop into test_clone3()

2023-10-23 Thread Mark Brown
In order to make it easier to add more configuration for the tests and more support for runtime detection of when tests can be run pass the structure describing the tests into test_clone3() rather than picking the arguments out of it and have that function do all the per-test work. No functional

[PATCH RFC RFT 4/5] selftests/clone3: Allow tests to flag if -E2BIG is a valid error code

2023-10-23 Thread Mark Brown
The clone_args structure is extensible, with the syscall passing in the length of the structure. Inside the kernel we use copy_struct_from_user() to read the struct but this has the unfortunate side effect of silently accepting some overrun in the structure size providing the extra data is all

[PATCH RFC RFT 1/5] mm: Introduce ARCH_HAS_USER_SHADOW_STACK

2023-10-23 Thread Mark Brown
Since multiple architectures have support for shadow stacks and we need to select support for this feature in several places in the generic code provide a generic config option that the architectures can select. Suggested-by: David Hildenbrand Signed-off-by: Mark Brown --- arch/x86/Kconfig |

[PATCH RFC RFT 2/5] fork: Add shadow stack support to clone3()

2023-10-23 Thread Mark Brown
Unlike with the normal stack there is no API for configuring the the shadow stack for a new thread, instead the kernel will dynamically allocate a new shadow stack with the same size as the normal stack. This appears to be due to the shadow stack series having been in development since before the

[PATCH RFC RFT 0/5] fork: Support shadow stacks in clone3()

2023-10-23 Thread Mark Brown
The kernel has recently added support for shadow stacks, currently x86 only using their CET feature but both arm64 and RISC-V have equivalent features (GCS and Zisslpcfi respectively), I am actively working on GCS[1]. With shadow stacks the hardware maintains an additional stack containing only

[PATCH v2] selftests:net change ifconfig with ip command

2023-10-23 Thread Swarup Laxman Kotiaklapudi
Change ifconfig with ip command, on a system where ifconfig is not used this script will not work correcly. Test result with this patchset: sudo make TARGETS="net" kselftest TAP version 13 1..1 timeout set to 1500 selftests: net: route_localnet.sh run arp_announce test

Re: [PATCH v3 2/3] userfaultfd: UFFDIO_MOVE uABI

2023-10-23 Thread David Hildenbrand
Focusing on validate_remap_areas(): + +static int validate_remap_areas(struct vm_area_struct *src_vma, + struct vm_area_struct *dst_vma) +{ + /* Only allow remapping if both have the same access and protection */ + if ((src_vma->vm_flags &

Re: [PATCH v6 8/8] iommu/vt-d: Disallow read-only mappings to nest parent domain

2023-10-23 Thread Baolu Lu
On 2023/10/23 19:15, Liu, Yi L wrote: I would also prefer to introduce is_nested_parent_domain to the user domain allocation patch (patch 7/8). This field should be checked when allocating a nested user domain. A ctually, no need. This should be a common check, so iommufd core already has the

Re: [PATCH v3 2/3] userfaultfd: UFFDIO_MOVE uABI

2023-10-23 Thread David Hildenbrand
On 22.10.23 17:46, Peter Xu wrote: On Fri, Oct 20, 2023 at 07:16:19PM +0200, David Hildenbrand wrote: These are rather the vibes I'm getting from Peter. "Why rename it, could confuse people because the original patches are old", "Why exclude it if it has been included in the original patches".

RE: [PATCH v6 8/8] iommu/vt-d: Disallow read-only mappings to nest parent domain

2023-10-23 Thread Liu, Yi L
> From: Baolu Lu > Sent: Saturday, October 21, 2023 11:24 AM > > On 10/20/23 5:32 PM, Yi Liu wrote: > > From: Lu Baolu > > > > When remapping hardware is configured by system software in scalable mode > > as Nested (PGTT=011b) and with PWSNP field Set in the PASID-table-entry, > > it may Set

RE: [PATCH v6 7/8] iommu/vt-d: Add nested domain allocation

2023-10-23 Thread Liu, Yi L
> From: Baolu Lu > Sent: Saturday, October 21, 2023 11:08 AM > > On 10/20/23 5:32 PM, Yi Liu wrote: > > From: Lu Baolu > > > > This adds the support for IOMMU_HWPT_DATA_VTD_S1 type. > > > > Signed-off-by: Lu Baolu > > Signed-off-by: Yi Liu > > --- > > drivers/iommu/intel/iommu.c | 39

RE: [PATCH v6 3/8] iommu/vt-d: Add helper for nested domain allocation

2023-10-23 Thread Liu, Yi L
> From: Baolu Lu > Sent: Friday, October 20, 2023 7:49 PM > > On 2023/10/20 17:32, Yi Liu wrote: > > From: Lu Baolu > > > > This adds helper for accepting user parameters and allocate a nested > > domain. > > > > Reviewed-by: Kevin Tian > > Signed-off-by: Jacob Pan > > Signed-off-by: Lu Baolu

Re: [PATCH] Incorrect backtracking for load/store or atomic ops

2023-10-23 Thread Tao Lyu
>  > On Fri, Oct 20, 2023 at 9:06 AM Tao Lyu wrote: >> >> Hi, >> >> I found the backtracking logic of the eBPF verifier is flawed >> when meeting 1) normal load and store instruction or >> 2) atomic memory instructions. >> >> # Normal load and store >> >> Here, I show one case about the normal

Re: [PATCH] selftests:net change ifconfig with ip command

2023-10-23 Thread Jiri Pirko
Sun, Oct 22, 2023 at 07:50:52PM CEST, dsah...@kernel.org wrote: >On 10/22/23 5:31 AM, Swarup Laxman Kotiaklapudi wrote: >> diff --git a/tools/testing/selftests/net/route_localnet.sh >> b/tools/testing/selftests/net/route_localnet.sh >> index 116bfeab72fa..3ab9beb4462c 100755 >> ---