Re: [net-next v1 09/16] page_pool: device memory support

2023-12-12 Thread Mina Almasry
On Sun, Dec 10, 2023 at 8:04 PM Mina Almasry wrote: > > On Sun, Dec 10, 2023 at 6:26 PM Mina Almasry wrote: > > > > On Sun, Dec 10, 2023 at 6:04 PM Yunsheng Lin wrote: > > > > > > On 2023/12/9 0:05, Mina Almasry wrote: > > > > On Fri, Dec 8, 2023 at 1:30 AM Yunsheng Lin > > > > wrote: > > >

Re: [net-next v1 08/16] memory-provider: dmabuf devmem memory provider

2023-12-12 Thread Yinjun Zhang
On Thu, 7 Dec 2023 16:52:39 -0800, Mina Almasry wrote: <...> > +static int mp_dmabuf_devmem_init(struct page_pool *pool) > +{ > + struct netdev_dmabuf_binding *binding = pool->mp_priv; > + > + if (!binding) > + return -EINVAL; > + > + if (!(pool->p.flags &

Re: [RFC PATCH v3 01/11] mseal: Add mseal syscall.

2023-12-12 Thread Greg KH
On Tue, Dec 12, 2023 at 11:16:55PM +, jef...@chromium.org wrote: > +config MSEAL > + default n Minor nit, "n" is always the default, no need to call it out here. > + bool "Enable mseal() system call" > + depends on MMU > + help > + Enable the virtual memory sealing. > +

Re: [PATCH v4 6/6] Documentation: Add debugfs docs with run after boot

2023-12-12 Thread David Gow
On Wed, 13 Dec 2023 at 09:02, Rae Moar wrote: > > Expand the documentation on the KUnit debugfs filesystem on the > run_manual.rst page. > > Add section describing how to access results using debugfs. > > Add section describing how to run tests after boot using debugfs. > > Signed-off-by: Rae

Re: [PATCH v4 5/6] kunit: add ability to run tests after boot using debugfs

2023-12-12 Thread David Gow
On Wed, 13 Dec 2023 at 09:02, Rae Moar wrote: > > Add functionality to run built-in tests after boot by writing to a > debugfs file. > > Add a new debugfs file labeled "run" for each test suite to use for > this purpose. > > As an example, write to the file using the following: > > echo "any

Re: [PATCH v4 3/6] kunit: add example suite to test init suites

2023-12-12 Thread David Gow
On Wed, 13 Dec 2023 at 09:02, Rae Moar wrote: > > Add example_init_test_suite to allow for testing the feature of running > test suites marked as init to indicate they use init data and/or > functions. > > This suite should always pass and uses a simple init function. > > This suite can also be

Re: [PATCH v4 4/6] kunit: add is_init test attribute

2023-12-12 Thread David Gow
On Wed, 13 Dec 2023 at 09:02, Rae Moar wrote: > > Add is_init test attribute of type bool. Add to_string, get, and filter > methods to lib/kunit/attributes.c. > > Mark each of the tests in the init section with the is_init=true attribute. > > Add is_init to the attributes documentation. > >

Re: [PATCH v4 2/6] kunit: add KUNIT_INIT_TABLE to init linker section

2023-12-12 Thread David Gow
On Wed, 13 Dec 2023 at 09:02, Rae Moar wrote: > > Add KUNIT_INIT_TABLE to the INIT_DATA linker section. > > Alter the KUnit macros to create init tests: > kunit_test_init_section_suites > > Update lib/kunit/executor.c to run both the suites in KUNIT_TABLE and > KUNIT_INIT_TABLE. > >

Re: [PATCH v4 1/6] kunit: move KUNIT_TABLE out of INIT_DATA

2023-12-12 Thread David Gow
On Wed, 13 Dec 2023 at 09:02, Rae Moar wrote: > > Alter the linker section of KUNIT_TABLE to move it out of INIT_DATA and > into DATA_DATA. > > Data for KUnit tests does not need to be in the init section. > > In order to run tests again after boot the KUnit data cannot be labeled as > init data

[PATCHv2 net-next 13/13] selftests/net: convert fdb_flush.sh to run it in unique namespace

2023-12-12 Thread Hangbin Liu
Here is the test result after conversion. # ./fdb_flush.sh TEST: vx10: Expected 5 FDB entries, got 5 [ OK ] TEST: vx20: Expected 5 FDB entries, got 5 [ OK ] ... TEST: vx10: Expected 5 FDB entries, got 5 [ OK ]

[PATCHv2 net-next 12/13] selftests/net: convert fib_tests.sh to run it in unique namespace

2023-12-12 Thread Hangbin Liu
Here is the test result after conversion. # ./fib_tests.sh Single path route test Start point TEST: IPv4 fibmatch [ OK ] ... Fib6 garbage collection test TEST: ipv6 route garbage collection [ OK

[PATCHv2 net-next 10/13] selftests/net: convert fib-onlink-tests.sh to run it in unique namespace

2023-12-12 Thread Hangbin Liu
Remove PEER_CMD, which is not used in this test Here is the test result after conversion. ]# ./fib-onlink-tests.sh Error: ipv4: FIB table does not exist. Flush terminated Error: ipv6: FIB table does not exist. Flush terminated Configuring

[PATCHv2 net-next 11/13] selftests/net: convert fib_rule_tests.sh to run it in unique namespace

2023-12-12 Thread Hangbin Liu
Here is the test result after conversion. ]# ./fib_rule_tests.sh TEST: rule6 check: oif redirect to table [ OK ] ... TEST: rule4 dsfield tcp connect (dsfield 0x07)[ OK ] Tests passed: 66 Tests failed: 0 Acked-by: David Ahern Signed-off-by:

[PATCHv2 net-next 09/13] selftests/net: convert fib_nexthops.sh to run it in unique namespace

2023-12-12 Thread Hangbin Liu
Here is the test result after conversion. ]# ./fib_nexthops.sh Basic functional tests -- TEST: List with nothing defined [ OK ] TEST: Nexthop get on non-existent id[ OK ] ... TEST: IPv6 resilient

[PATCHv2 net-next 08/13] selftests/net: convert fib_nexthop_nongw.sh to run it in unique namespace

2023-12-12 Thread Hangbin Liu
Here is the test result after conversion. ]# ./fib_nexthop_nongw.sh TEST: nexthop: get route with nexthop without gw[ OK ] TEST: nexthop: ping through nexthop without gw [ OK ] Acked-by: David Ahern Signed-off-by: Hangbin Liu ---

[PATCHv2 net-next 06/13] selftests/net: fix grep checking for fib_nexthop_multiprefix

2023-12-12 Thread Hangbin Liu
When running fib_nexthop_multiprefix test I saw all IPv6 test failed. e.g. ]# ./fib_nexthop_multiprefix.sh TEST: IPv4: host 0 to host 1, mtu 1300 [ OK ] TEST: IPv6: host 0 to host 1, mtu 1300 [FAIL] With -v it shows COMMAND: ip

[PATCHv2 net-next 07/13] selftests/net: convert fib_nexthop_multiprefix to run it in unique namespace

2023-12-12 Thread Hangbin Liu
Here is the test result after conversion. ]# ./fib_nexthop_multiprefix.sh TEST: IPv4: host 0 to host 1, mtu 1300 [ OK ] TEST: IPv6: host 0 to host 1, mtu 1300 [ OK ] TEST: IPv4: host 0 to host 2, mtu 1350

[PATCHv2 net-next 05/13] selftests/net: convert fcnal-test.sh to run it in unique namespace

2023-12-12 Thread Hangbin Liu
Here is the test result after conversion. There are some failures, but it also exists on my system without this patch. So it's not affectec by this patch and I will check the reason later. ]# time ./fcnal-test.sh /usr/bin/which: no nettest in

[PATCHv2 net-next 04/13] selftests/net: convert srv6_end_dt6_l3vpn_test.sh to run it in unique namespace

2023-12-12 Thread Hangbin Liu
As the name \${rt-${rt}} may make reader confuse, convert the variable hs/rt in setup_rt/hs to hid, rid. Here is the test result after conversion. ]# ./srv6_end_dt6_l3vpn_test.sh TEST SECTION: IPv6 routers

[PATCHv2 net-next 03/13] selftests/net: convert srv6_end_dt4_l3vpn_test.sh to run it in unique namespace

2023-12-12 Thread Hangbin Liu
As the name \${rt-${rt}} may make reader confuse, convert the variable hs/rt in setup_rt/hs to hid, rid. Here is the test result after conversion. ]# ./srv6_end_dt4_l3vpn_test.sh TEST SECTION: IPv6 routers

[PATCHv2 net-next 02/13] selftests/net: convert srv6_end_dt46_l3vpn_test.sh to run it in unique namespace

2023-12-12 Thread Hangbin Liu
As the name \${rt-${rt}} may make reader confuse, convert the variable hs/rt in setup_rt/hs to hid, rid. Here is the test result after conversion. ]# ./srv6_end_dt46_l3vpn_test.sh TEST SECTION: IPv6 routers

[PATCHv2 net-next 01/13] selftests/net: add variable NS_LIST for lib.sh

2023-12-12 Thread Hangbin Liu
Add a global variable NS_LIST to store all the namespaces that setup_ns created, so the caller could call cleanup_all_ns() instead of remember all the netns names when using cleanup_ns(). Signed-off-by: Hangbin Liu --- tools/testing/selftests/net/lib.sh | 8 1 file changed, 8

[PATCHv2 net-next 00/13] Convert net selftests to run in unique namespace (Part 3)

2023-12-12 Thread Hangbin Liu
Here is the 3rd part of converting net selftests to run in unique namespace. This part converts all srv6 and fib tests. Note that patch 06 is a fix for testing fib_nexthop_multiprefix. Here is the part 1 link: https://lore.kernel.org/netdev/20231202020110.362433-1-liuhang...@gmail.com And part 2

Re: [PATCH v6 5/5] selftests/mm: add UFFDIO_MOVE ioctl test

2023-12-12 Thread John Hubbard
On 12/12/23 21:52, John Hubbard wrote: On 12/12/23 19:58, Muhammad Usama Anjum wrote: ... Oh, this sounds like it would work nicely. No more "make headers" required (hooray!). Instead, the new approach would be "selftests are allowed to include from tools/include", and then we can just start

Re: [PATCH v6 5/5] selftests/mm: add UFFDIO_MOVE ioctl test

2023-12-12 Thread John Hubbard
On 12/12/23 19:58, Muhammad Usama Anjum wrote: ... Oh, this sounds like it would work nicely. No more "make headers" required (hooray!). Instead, the new approach would be "selftests are allowed to include from tools/include", and then we can just start copying the files that we need to that

Re: [PATCH v6 5/5] selftests/mm: add UFFDIO_MOVE ioctl test

2023-12-12 Thread Muhammad Usama Anjum
On 12/13/23 7:14 AM, John Hubbard wrote: > On 12/12/23 07:12, Mark Brown wrote: >> On Mon, Dec 11, 2023 at 12:29:58PM -0800, John Hubbard wrote: >>> On 12/11/23 12:21, Mark Brown wrote: > ... >>> Or maybe there is an innovative way to do all of this, that we have >>> yet to think of. >> >> We do

Re: [PATCH v7 37/39] kselftest/arm64: Add a GCS stress test

2023-12-12 Thread Thiago Jung Bauermann
I'm going a bit out-of-order to report a build failure in a test: Mark Brown writes: > +// Recurse x20 times > +.macro recurse id I get an assembler error here: gcc -nostdlib gcs-stress-thread.S -o /home/thiago.bauermann/src/linux/tools/testing/selftests/arm64/gcs/gcs-stress-thread

Re: [net-next v1 08/16] memory-provider: dmabuf devmem memory provider

2023-12-12 Thread David Ahern
On 12/12/23 6:09 PM, Mina Almasry wrote: > OK, I imagine this is not that hard to implement - it's really whether > the change is acceptable to reviewers. > > I figure I can start by implementing a no-op abstraction to page*: > > typedef struct page netmem_t > > and replace the page* in the

RE: [PATCH v2 3/6] iommufd: Initializing and releasing IO page fault data

2023-12-12 Thread Tian, Kevin
> From: Baolu Lu > Sent: Wednesday, December 13, 2023 10:05 AM > > > >> 2. This is not intended to work only with idxd and uacce. right? > > It should work everywhere, I suspect Intel Team didn't hit this > > because they are testing IDXD SIOV? > > Yes. > > > Can you guys also test it as a PF >

Re: [PATCH v6 5/5] selftests/mm: add UFFDIO_MOVE ioctl test

2023-12-12 Thread John Hubbard
On 12/12/23 07:12, Mark Brown wrote: On Mon, Dec 11, 2023 at 12:29:58PM -0800, John Hubbard wrote: On 12/11/23 12:21, Mark Brown wrote: ... Or maybe there is an innovative way to do all of this, that we have yet to think of. We do copy files into tools/include at random times which makes

RE: [PATCH 3/3] vfio: Report PASID capability via VFIO_DEVICE_FEATURE ioctl

2023-12-12 Thread Tian, Kevin
> From: Jason Gunthorpe > Sent: Tuesday, December 12, 2023 11:35 PM > > On Mon, Dec 11, 2023 at 11:49:49AM -0700, Alex Williamson wrote: > > On Mon, 11 Dec 2023 14:10:28 -0400 > > Jason Gunthorpe wrote: > > > > > On Mon, Dec 11, 2023 at 11:03:45AM -0700, Alex Williamson wrote: > > > > On Sun,

Re: [PATCH v2 3/6] iommufd: Initializing and releasing IO page fault data

2023-12-12 Thread Baolu Lu
On 12/12/23 10:12 PM, Jason Gunthorpe wrote: On Tue, Dec 12, 2023 at 02:10:08PM +0100, Joel Granados wrote: diff --git a/drivers/iommu/iommufd/device.c b/drivers/iommu/iommufd/device.c index 645ab5d290fe..0a8e03d5e7c5 100644 --- a/drivers/iommu/iommufd/device.c +++

RE: [PATCH 3/3] vfio: Report PASID capability via VFIO_DEVICE_FEATURE ioctl

2023-12-12 Thread Tian, Kevin
> From: Jason Gunthorpe > Sent: Tuesday, December 12, 2023 11:32 PM > > On Tue, Dec 12, 2023 at 02:20:01AM +, Tian, Kevin wrote: > > > From: Liu, Yi L > > > Sent: Monday, December 11, 2023 4:08 PM > > > > > > On 2023/12/7 16:47, Tian, Kevin wrote: > > > >> From: Liu, Yi L > > > >> Sent:

[PATCH v3 1/2] selftests/vDSO: Fix building errors on LoongArch

2023-12-12 Thread Tiezhu Yang
There exist the following errors when build vDSO selftests on LoongArch: # make headers && cd tools/testing/selftests/vDSO && make ... error: 'VDSO_VERSION' undeclared (first use in this function) ... error: 'VDSO_NAMES' undeclared (first use in this function) We can see the following

[PATCH v3 2/2] selftests/vDSO: Fix runtime errors on LoongArch

2023-12-12 Thread Tiezhu Yang
It could not find __vdso_getcpu and __vdso_gettimeofday when test getcpu and gettimeofday on LoongArch. # make headers && cd tools/testing/selftests/vDSO && make # ./vdso_test_getcpu Could not find __vdso_getcpu # ./vdso_test_gettimeofday Could not find __vdso_gettimeofday One simple

[PATCH v3 0/2] selftests/vDSO: Fix errors on LoongArch

2023-12-12 Thread Tiezhu Yang
v3: Rebase on the next branch of linux-kselftest.git, modify the patch title and update the commit message v2: Rebase on 6.5-rc1 and update the commit message Tiezhu Yang (2): selftests/vDSO: Fix building errors on LoongArch selftests/vDSO: Fix runtime errors on LoongArch

Re: [net-next v1 08/16] memory-provider: dmabuf devmem memory provider

2023-12-12 Thread Mina Almasry
On Tue, Dec 12, 2023 at 7:08 AM Jason Gunthorpe wrote: > > On Tue, Dec 12, 2023 at 06:58:17AM -0800, Mina Almasry wrote: > > > Jason, we set the LSB on page_pool_iov pointers before casting it to > > struct page pointers. The resulting pointers are not useable as page > > pointers at all. > > I

[PATCH v4 6/6] Documentation: Add debugfs docs with run after boot

2023-12-12 Thread Rae Moar
Expand the documentation on the KUnit debugfs filesystem on the run_manual.rst page. Add section describing how to access results using debugfs. Add section describing how to run tests after boot using debugfs. Signed-off-by: Rae Moar --- Changes since v3: - Change the introduction of the

[PATCH v4 5/6] kunit: add ability to run tests after boot using debugfs

2023-12-12 Thread Rae Moar
Add functionality to run built-in tests after boot by writing to a debugfs file. Add a new debugfs file labeled "run" for each test suite to use for this purpose. As an example, write to the file using the following: echo "any string" > /sys/kernel/debugfs/kunit//run This will trigger the test

[PATCH v4 4/6] kunit: add is_init test attribute

2023-12-12 Thread Rae Moar
Add is_init test attribute of type bool. Add to_string, get, and filter methods to lib/kunit/attributes.c. Mark each of the tests in the init section with the is_init=true attribute. Add is_init to the attributes documentation. Signed-off-by: Rae Moar --- Changes since v3: - Move the attribute

[PATCH v4 2/6] kunit: add KUNIT_INIT_TABLE to init linker section

2023-12-12 Thread Rae Moar
Add KUNIT_INIT_TABLE to the INIT_DATA linker section. Alter the KUnit macros to create init tests: kunit_test_init_section_suites Update lib/kunit/executor.c to run both the suites in KUNIT_TABLE and KUNIT_INIT_TABLE. Signed-off-by: Rae Moar --- Changes since v3: - Add to comments in test.h

[PATCH v4 3/6] kunit: add example suite to test init suites

2023-12-12 Thread Rae Moar
Add example_init_test_suite to allow for testing the feature of running test suites marked as init to indicate they use init data and/or functions. This suite should always pass and uses a simple init function. This suite can also be used to test the is_init attribute introduced in the next

[PATCH v4 1/6] kunit: move KUNIT_TABLE out of INIT_DATA

2023-12-12 Thread Rae Moar
Alter the linker section of KUNIT_TABLE to move it out of INIT_DATA and into DATA_DATA. Data for KUnit tests does not need to be in the init section. In order to run tests again after boot the KUnit data cannot be labeled as init data as the kernel could write over it. Add a KUNIT_INIT_TABLE in

Re: [PATCH v7 02/39] prctl: arch-agnostic prctl for shadow stack

2023-12-12 Thread Deepak Gupta
On Tue, Dec 12, 2023 at 11:23 AM Mark Brown wrote: > > On Tue, Dec 12, 2023 at 11:17:11AM -0800, Deepak Gupta wrote: > > On Wed, Nov 22, 2023 at 1:43 AM Mark Brown wrote: > > > > +/* > > > + * Set the current shadow stack configuration. Enabling the shadow > > > + * stack will cause a shadow

Re: [PATCH] selftests/ftrace: Add test to exercize function tracer across cpu hotplug

2023-12-12 Thread Google
Hi Naveen, On Tue, 12 Dec 2023 14:26:07 +0530 Naveen N Rao wrote: > Add a test to exercize cpu hotplug with the function tracer active to > ensure that sensitive functions in idle path are excluded from being > traced. This helps catch issues such as the one fixed by commit > 4b3338aaa74d

Re: [RFC PATCH v3 11/11] mseal:add documentation

2023-12-12 Thread Linus Torvalds
On Tue, 12 Dec 2023 at 15:17, wrote: > + > +**types**: bit mask to specify the sealing types, they are: I really want a real-life use-case for more than one bit of "don't modify". IOW, when would you *ever* say "seal this area, but MADV_DONTNEED is ok"? Or when would you *ever* say "seal this

Re: [PATCH v2] tracing/selftests: Add test to test max subbuf size with trace_marker

2023-12-12 Thread Steven Rostedt
On Wed, 13 Dec 2023 09:33:18 +0900 Masami Hiramatsu (Google) wrote: > On Tue, 12 Dec 2023 15:16:32 -0500 > Steven Rostedt wrote: > > > From: "Steven Rostedt (Google)" > > > > Now that the trace_marker can write up to the max size of the sub buffer. > > Add a test to see if it actually can

Re: [PATCH v2] tracing/selftests: Add test to test max subbuf size with trace_marker

2023-12-12 Thread Google
On Tue, 12 Dec 2023 15:16:32 -0500 Steven Rostedt wrote: > From: "Steven Rostedt (Google)" > > Now that the trace_marker can write up to the max size of the sub buffer. > Add a test to see if it actually can happen. > > The README is updated to state that the trace_marker writes can be broken

[PATCH v3] tracing/selftests: Add test to test the trace_marker

2023-12-12 Thread Steven Rostedt
From: "Steven Rostedt (Google)" Add a test that writes longs strings, some over the size of the sub buffer and make sure that the entire content is there. Signed-off-by: Steven Rostedt (Google) --- Changes since v2:

Re: [PATCH net-next 06/13] selftests/net: fix grep checking for fib_nexthop_multiprefix

2023-12-12 Thread Jakub Kicinski
On Mon, 11 Dec 2023 18:09:18 +0800 Hangbin Liu wrote: > --- 2001:db8:101::1 ping statistics --- This --- will make git am cut off the rest of the patch :( Could you indent it by one space and repost? -- pw-bot: cr

[RFC PATCH v3 11/11] mseal:add documentation

2023-12-12 Thread jeffxu
From: Jeff Xu Add documentation for mseal(). Signed-off-by: Jeff Xu --- Documentation/userspace-api/mseal.rst | 189 ++ 1 file changed, 189 insertions(+) create mode 100644 Documentation/userspace-api/mseal.rst diff --git a/Documentation/userspace-api/mseal.rst

[RFC PATCH v3 10/11] selftest mm/mseal memory sealing

2023-12-12 Thread jeffxu
From: Jeff Xu selftest for memory sealing change in mmap() and mseal(). Signed-off-by: Jeff Xu --- tools/testing/selftests/mm/.gitignore |1 + tools/testing/selftests/mm/Makefile |1 + tools/testing/selftests/mm/config |1 + tools/testing/selftests/mm/mseal_test.c |

[RFC PATCH v3 09/11] mseal: add MAP_SEALABLE to mmap()

2023-12-12 Thread jeffxu
From: Jeff Xu The MAP_SEALABLE flag is added to the flags field of mmap(). When present, it marks the map as sealable. A map created without MAP_SEALABLE will not support sealing; In other words, mseal() will fail for such a map. Applications that don't care about sealing will expect their

[RFC PATCH v3 08/11] mseal: add MM_SEAL_DISCARD_RO_ANON

2023-12-12 Thread jeffxu
From: Jeff Xu Certain types of madvise() operations are destructive, such as MADV_DONTNEED, which can effectively alter region contents by discarding pages, especially when memory is anonymous. This blocks such operations for anonymous memory which is not writable to the user. The

[RFC PATCH v3 07/11] mseal: make sealed VMA mergeable.

2023-12-12 Thread jeffxu
From: Jeff Xu Add merge/split handling for mlock/madvice/mprotect/mmap case. Make sealed VMA mergeable with adjacent VMAs. This is so that we don't run out of VMAs, i.e. there is a max number of VMA per process. Signed-off-by: Jeff Xu Suggested-by: Jann Horn --- fs/userfaultfd.c | 8

[RFC PATCH v3 06/11] mseal: add sealing support for mmap

2023-12-12 Thread jeffxu
From: Jeff Xu Allow mmap() to set the sealing type when creating a mapping. This is useful for optimization because it avoids having to make two system calls: one for mmap() and one for mseal(). With this change, mmap() can take an input that specifies the sealing type, so only one system call

[RFC PATCH v3 01/11] mseal: Add mseal syscall.

2023-12-12 Thread jeffxu
From: Jeff Xu The new mseal() is an architecture independent syscall, and with following signature: mseal(void addr, size_t len, unsigned long types, unsigned long flags) addr/len: memory range. Must be continuous/allocated memory, or else mseal() will fail and no VMA is updated. For details

[RFC PATCH v3 04/11] mseal: add MM_SEAL_BASE

2023-12-12 Thread jeffxu
From: Jeff Xu The base package includes the features common to all VMA sealing types. It prevents sealed VMAs from: 1> Unmapping, moving to another location, and shrinking the size, via munmap() and mremap(), can leave an empty space, therefore can be replaced with a VMA with a new set of

[RFC PATCH v3 05/11] mseal: add MM_SEAL_PROT_PKEY

2023-12-12 Thread jeffxu
From: Jeff Xu Seal PROT and PKEY of the address range, in other words, mprotect() and pkey_mprotect() will be denied if the memory is sealed with MM_SEAL_PROT_PKEY. Signed-off-by: Jeff Xu --- mm/mprotect.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/mm/mprotect.c

[RFC PATCH v3 02/11] mseal: Wire up mseal syscall

2023-12-12 Thread jeffxu
From: Jeff Xu Wire up mseal syscall for all architectures. Signed-off-by: Jeff Xu --- arch/alpha/kernel/syscalls/syscall.tbl | 1 + arch/arm/tools/syscall.tbl | 1 + arch/arm64/include/asm/unistd.h | 2 +- arch/arm64/include/asm/unistd32.h | 2 ++

[RFC PATCH v3 03/11] mseal: add can_modify_mm and can_modify_vma

2023-12-12 Thread jeffxu
From: Jeff Xu Two utilities to be used later. can_modify_mm: checks sealing flags for given memory range. can_modify_vma: checks sealing flags for given vma. Signed-off-by: Jeff Xu --- include/linux/mm.h | 18 ++ mm/mseal.c | 38

[RFC PATCH v3 00/11] Introduce mseal()

2023-12-12 Thread jeffxu
From: Jeff Xu This patchset proposes a new mseal() syscall for the Linux kernel. In a nutshell, mseal() protects the VMAs of a given virtual memory range against modifications, such as changes to their permission bits. Modern CPUs support memory permissions, such as the read/write (RW) and

Re: [PATCH bpf-next v5 9/9] bpf: xfrm: Add selftest for bpf_xdp_get_xfrm_state()

2023-12-12 Thread Kumar Kartikeya Dwivedi
On Tue, 12 Dec 2023 at 20:52, Daniel Xu wrote: > > cc Kumar > > On Tue, Dec 12, 2023 at 09:17:02AM -0700, Daniel Xu wrote: > > On Mon, Dec 11, 2023 at 04:25:06PM -0800, Eyal Birger wrote: > > > On Mon, Dec 11, 2023 at 3:49 PM Daniel Xu wrote: > > > > > > > > On Mon, Dec 11, 2023 at 03:13:07PM

Re: [PATCH v7 02/39] prctl: arch-agnostic prctl for shadow stack

2023-12-12 Thread Edgecombe, Rick P
+Mike, who did the CRIU work Re: https://lore.kernel.org/lkml/e1362732ba86990b7707d3f5b785358b77c5f896.ca...@intel.com/ On Tue, 2023-12-12 at 20:26 +, Mark Brown wrote: > The set of locked features is read/write via ptrace in my arm64 > series, > that's architecture specific unfortunately

[RFC PATCH v5 29/29] KVM: selftests: TDX: Add TDX UPM selftests for implicit conversion

2023-12-12 Thread Sagi Shahar
From: Ackerley Tng This tests the use of guest memory without explicit MapGPA calls. Signed-off-by: Ackerley Tng Signed-off-by: Ryan Afranji Signed-off-by: Sagi Shahar --- .../selftests/kvm/x86_64/tdx_upm_test.c | 86 +-- 1 file changed, 77 insertions(+), 9

[RFC PATCH v5 27/29] KVM: selftests: Propagate KVM_EXIT_MEMORY_FAULT to userspace

2023-12-12 Thread Sagi Shahar
Allow userspace to handle KVM_EXIT_MEMORY_FAULT instead of triggering TEST_ASSERT. >From the KVM_EXIT_MEMORY_FAULT documentation: Note! KVM_EXIT_MEMORY_FAULT is unique among all KVM exit reasons in that it accompanies a return code of '-1', not '0'! errno will always be set to EFAULT or

[RFC PATCH v5 24/29] KVM: selftests: Expose _vm_vaddr_alloc

2023-12-12 Thread Sagi Shahar
From: Ackerley Tng vm_vaddr_alloc always allocates memory in memslot 0. This allows users of this function to choose which memslot to allocate virtual memory in. Signed-off-by: Ackerley Tng Signed-off-by: Ryan Afranji Signed-off-by: Sagi Shahar ---

[RFC PATCH v5 28/29] KVM: selftests: TDX: Add TDX UPM selftest

2023-12-12 Thread Sagi Shahar
From: Ackerley Tng This tests the use of guest memory with explicit MapGPA calls. Signed-off-by: Ackerley Tng Signed-off-by: Ryan Afranji Signed-off-by: Sagi Shahar --- tools/testing/selftests/kvm/Makefile | 1 + .../selftests/kvm/x86_64/tdx_upm_test.c | 401

[RFC PATCH v5 25/29] KVM: selftests: TDX: Add support for TDG.MEM.PAGE.ACCEPT

2023-12-12 Thread Sagi Shahar
From: Ackerley Tng Signed-off-by: Ackerley Tng Signed-off-by: Ryan Afranji Signed-off-by: Sagi Shahar --- tools/testing/selftests/kvm/include/x86_64/tdx/tdx.h | 2 ++ tools/testing/selftests/kvm/lib/x86_64/tdx/tdx.c | 5 + 2 files changed, 7 insertions(+) diff --git

[RFC PATCH v5 26/29] KVM: selftests: TDX: Add support for TDG.VP.VEINFO.GET

2023-12-12 Thread Sagi Shahar
From: Ackerley Tng Signed-off-by: Ackerley Tng Signed-off-by: Ryan Afranji Signed-off-by: Sagi Shahar --- .../selftests/kvm/include/x86_64/tdx/tdx.h| 21 +++ .../selftests/kvm/lib/x86_64/tdx/tdx.c| 19 + 2 files changed, 40 insertions(+) diff

[RFC PATCH v5 23/29] KVM: selftests: TDX: Add shared memory test

2023-12-12 Thread Sagi Shahar
From: Ryan Afranji Adds a test that sets up shared memory between the host and guest. Signed-off-by: Ryan Afranji Signed-off-by: Sagi Shahar Signed-off-by: Ackerley Tng --- tools/testing/selftests/kvm/Makefile | 1 + .../selftests/kvm/include/x86_64/tdx/tdx.h| 2 +

[RFC PATCH v5 20/29] KVM: selftests: TDX: Verify the behavior when host consumes a TD private memory

2023-12-12 Thread Sagi Shahar
From: Ryan Afranji The test checks that host can only read fixed values when trying to access the guest's private memory. Signed-off-by: Ryan Afranji Signed-off-by: Sagi Shahar Signed-off-by: Ackerley Tng --- .../selftests/kvm/x86_64/tdx_vm_tests.c | 85 +++ 1 file

[RFC PATCH v5 22/29] KVM: selftests: Add functions to allow mapping as shared

2023-12-12 Thread Sagi Shahar
From: Ackerley Tng Signed-off-by: Ackerley Tng Signed-off-by: Ryan Afranji Signed-off-by: Sagi Shahar --- .../selftests/kvm/include/kvm_util_base.h | 24 ++ tools/testing/selftests/kvm/lib/kvm_util.c| 32 +++ .../selftests/kvm/lib/x86_64/processor.c |

[RFC PATCH v5 21/29] KVM: selftests: TDX: Add TDG.VP.INFO test

2023-12-12 Thread Sagi Shahar
From: Roger Wang Adds a test for TDG.VP.INFO Signed-off-by: Roger Wang Signed-off-by: Sagi Shahar Signed-off-by: Ackerley Tng Signed-off-by: Ryan Afranji --- .../selftests/kvm/include/x86_64/tdx/tdcall.h | 19 +++ .../selftests/kvm/include/x86_64/tdx/tdx.h| 5 +

[RFC PATCH v5 18/29] KVM: selftests: TDX: Add TDX MMIO writes test

2023-12-12 Thread Sagi Shahar
The test verifies MMIO writes of various sizes from the guest to the host. Signed-off-by: Sagi Shahar Signed-off-by: Ackerley Tng Signed-off-by: Ryan Afranji --- .../selftests/kvm/include/x86_64/tdx/tdx.h| 2 + .../selftests/kvm/lib/x86_64/tdx/tdx.c| 14 +++

[RFC PATCH v5 19/29] KVM: selftests: TDX: Add TDX CPUID TDVMCALL test

2023-12-12 Thread Sagi Shahar
This test issues a CPUID TDVMCALL from inside the guest to get the CPUID values as seen by KVM. Signed-off-by: Sagi Shahar Signed-off-by: Ackerley Tng Signed-off-by: Ryan Afranji --- .../selftests/kvm/include/x86_64/tdx/tdx.h| 4 + .../selftests/kvm/lib/x86_64/tdx/tdx.c| 26 +

[RFC PATCH v5 17/29] KVM: selftests: TDX: Add TDX MMIO reads test

2023-12-12 Thread Sagi Shahar
The test verifies MMIO reads of various sizes from the host to the guest. Signed-off-by: Sagi Shahar Signed-off-by: Ackerley Tng Signed-off-by: Ryan Afranji --- .../selftests/kvm/include/x86_64/tdx/tdcall.h | 2 + .../selftests/kvm/include/x86_64/tdx/tdx.h| 3 +

[RFC PATCH v5 16/29] KVM: selftests: TDX: Add TDX HLT exit test

2023-12-12 Thread Sagi Shahar
The test verifies that the guest runs TDVMCALL and the guest vCPU enters to the halted state. Signed-off-by: Erdem Aktas Signed-off-by: Sagi Shahar Signed-off-by: Ackerley Tng Signed-off-by: Ryan Afranji --- .../selftests/kvm/include/x86_64/tdx/tdx.h| 2 +

[RFC PATCH v5 15/29] KVM: selftests: TDX: Add TDX MSR read/write tests

2023-12-12 Thread Sagi Shahar
The test verifies reads and writes for MSR registers with different access level. Signed-off-by: Sagi Shahar Signed-off-by: Ackerley Tng Signed-off-by: Ryan Afranji --- .../selftests/kvm/include/x86_64/tdx/tdx.h| 5 + .../selftests/kvm/lib/x86_64/tdx/tdx.c| 27 +++

[RFC PATCH v5 14/29] KVM: selftests: TDX: Add TDX IO reads test

2023-12-12 Thread Sagi Shahar
The test verifies IO reads of various sizes from the host to the guest. Signed-off-by: Sagi Shahar Signed-off-by: Ackerley Tng Signed-off-by: Ryan Afranji --- .../selftests/kvm/x86_64/tdx_vm_tests.c | 87 +++ 1 file changed, 87 insertions(+) diff --git

[RFC PATCH v5 13/29] KVM: selftests: TDX: Add TDX IO writes test

2023-12-12 Thread Sagi Shahar
The test verifies IO writes of various sizes from the guest to the host. Signed-off-by: Sagi Shahar Signed-off-by: Ackerley Tng Signed-off-by: Ryan Afranji --- .../selftests/kvm/include/x86_64/tdx/tdcall.h | 3 + .../selftests/kvm/x86_64/tdx_vm_tests.c | 91 +++ 2 files

[RFC PATCH v5 12/29] KVM: selftests: TDX: Add basic get_td_vmcall_info test

2023-12-12 Thread Sagi Shahar
The test calls get_td_vmcall_info from the guest and verifies the expected returned values. Signed-off-by: Sagi Shahar Signed-off-by: Ackerley Tng Signed-off-by: Ryan Afranji --- .../selftests/kvm/include/x86_64/tdx/tdx.h| 3 + .../kvm/include/x86_64/tdx/test_util.h| 27 +++

[RFC PATCH v5 11/29] KVM: selftests: TDX: Add basic TDX CPUID test

2023-12-12 Thread Sagi Shahar
The test reads CPUID values from inside a TD VM and compare them to expected values. The test targets CPUID values which are virtualized as "As Configured", "As Configured (if Native)", "Calculated", "Fixed" and "Native" according to the TDX spec. Signed-off-by: Sagi Shahar Signed-off-by:

[RFC PATCH v5 10/29] KVM: selftests: TDX: Adding test case for TDX port IO

2023-12-12 Thread Sagi Shahar
From: Erdem Aktas Verifies TDVMCALL READ and WRITE operations. Signed-off-by: Erdem Aktas Signed-off-by: Sagi Shahar Signed-off-by: Ackerley Tng Signed-off-by: Ryan Afranji --- .../kvm/include/x86_64/tdx/test_util.h| 34 .../selftests/kvm/x86_64/tdx_vm_tests.c | 82

[RFC PATCH v5 09/29] KVM: selftests: TDX: Add report_fatal_error test

2023-12-12 Thread Sagi Shahar
The test checks report_fatal_error functionality. Signed-off-by: Sagi Shahar Signed-off-by: Ackerley Tng Signed-off-by: Ryan Afranji --- .../selftests/kvm/include/x86_64/tdx/tdx.h| 6 ++- .../kvm/include/x86_64/tdx/tdx_util.h | 1 + .../kvm/include/x86_64/tdx/test_util.h

[RFC PATCH v5 08/29] KVM: selftests: TDX: Add TDX lifecycle test

2023-12-12 Thread Sagi Shahar
From: Erdem Aktas Adding a test to verify TDX lifecycle by creating a TD and running a dummy TDG.VP.VMCALL inside it. Signed-off-by: Erdem Aktas Signed-off-by: Ryan Afranji Signed-off-by: Sagi Shahar Co-developed-by: Ackerley Tng Signed-off-by: Ackerley Tng ---

[RFC PATCH v5 06/29] KVM: selftests: TDX: Use KVM_TDX_CAPABILITIES to validate TDs' attribute configuration

2023-12-12 Thread Sagi Shahar
From: Ackerley Tng This also exercises the KVM_TDX_CAPABILITIES ioctl. Suggested-by: Isaku Yamahata Signed-off-by: Ackerley Tng Signed-off-by: Ryan Afranji Signed-off-by: Sagi Shahar --- .../selftests/kvm/lib/x86_64/tdx/tdx_util.c | 69 ++- 1 file changed, 66

[RFC PATCH v5 07/29] KVM: selftests: TDX: Update load_td_memory_region for VM memory backed by guest memfd

2023-12-12 Thread Sagi Shahar
From: Ackerley Tng If guest memory is backed by restricted memfd + UPM is being used, hence encrypted memory region has to be registered + Can avoid making a copy of guest memory before getting TDX to initialize the memory region Signed-off-by: Ackerley Tng Signed-off-by: Ryan Afranji

[RFC PATCH v5 04/29] KVM: selftests: Refactor steps in vCPU descriptor table initialization

2023-12-12 Thread Sagi Shahar
From: Ackerley Tng Split the vCPU descriptor table initialization process into a few steps and expose them: + Setting up the IDT + Syncing exception handlers into the guest In kvm_setup_idt(), we conditionally allocate guest memory for vm->idt to avoid double allocation when kvm_setup_idt() is

[RFC PATCH v5 05/29] KVM: selftests: Add helper functions to create TDX VMs

2023-12-12 Thread Sagi Shahar
From: Erdem Aktas TDX requires additional IOCTLs to initialize VM and vCPUs to add private memory and to finalize the VM memory. Also additional utility functions are provided to manipulate a TD, similar to those that manipulate a VM in the current selftest framework. A TD's initial register

[RFC PATCH v5 01/29] KVM: selftests: Add function to allow one-to-one GVA to GPA mappings

2023-12-12 Thread Sagi Shahar
From: Ackerley Tng One-to-one GVA to GPA mappings can be used in the guest to set up boot sequences during which paging is enabled, hence requiring a transition from using physical to virtual addresses in consecutive instructions. Signed-off-by: Ackerley Tng Signed-off-by: Ryan Afranji

[RFC PATCH v5 03/29] KVM: selftests: Store initial stack address in struct kvm_vcpu

2023-12-12 Thread Sagi Shahar
From: Ackerley Tng TDX guests' registers cannot be initialized directly using vcpu_regs_set(), hence the stack pointer needs to be initialized by the guest itself, running boot code beginning at the reset vector. We store the stack address as part of struct kvm_vcpu so that it can be accessible

[RFC PATCH v5 02/29] KVM: selftests: Expose function that sets up sregs based on VM's mode

2023-12-12 Thread Sagi Shahar
From: Ackerley Tng This allows initializing sregs without setting vCPU registers in KVM. No functional change intended. Signed-off-by: Ackerley Tng Signed-off-by: Ryan Afranji Signed-off-by: Sagi Shahar --- .../selftests/kvm/include/x86_64/processor.h | 2 +

[RFC PATCH v5 00/29] TDX KVM selftests

2023-12-12 Thread Sagi Shahar
Hello, This is v4 of the patch series for TDX selftests. It has been updated for Intel’s v17 of the TDX host patches which was proposed here: https://lore.kernel.org/all/cover.1699368322.git.isaku.yamah...@intel.com/ The tree can be found at:

Re: [PATCH v7 02/39] prctl: arch-agnostic prctl for shadow stack

2023-12-12 Thread Mark Brown
On Tue, Dec 12, 2023 at 08:17:09PM +, Edgecombe, Rick P wrote: > On Wed, 2023-11-22 at 09:42 +, Mark Brown wrote: > > These features are expected to be inherited by new threads and > > cleared > > on exec(), unknown features should be rejected for enable but > > accepted > > for locking

Re: [PATCH v7 02/39] prctl: arch-agnostic prctl for shadow stack

2023-12-12 Thread Edgecombe, Rick P
On Wed, 2023-11-22 at 09:42 +, Mark Brown wrote: > These features are expected to be inherited by new threads and > cleared > on exec(), unknown features should be rejected for enable but > accepted > for locking (in order to allow for future proofing). The reason why I stuck with arch_prctl

[PATCH v2] tracing/selftests: Add test to test max subbuf size with trace_marker

2023-12-12 Thread Steven Rostedt
From: "Steven Rostedt (Google)" Now that the trace_marker can write up to the max size of the sub buffer. Add a test to see if it actually can happen. The README is updated to state that the trace_marker writes can be broken up, and the test checks the README for that statement so that it does

Re: [PATCH v6 0/6] iommufd: Add nesting infrastructure (part 2/2)

2023-12-12 Thread Nicolin Chen
On Tue, Dec 12, 2023 at 03:21:00PM -0400, Jason Gunthorpe wrote: > On Tue, Dec 12, 2023 at 11:13:37AM -0800, Nicolin Chen wrote: > > On Tue, Dec 12, 2023 at 10:44:21AM -0400, Jason Gunthorpe wrote: > > > On Mon, Dec 11, 2023 at 11:30:00PM -0800, Nicolin Chen wrote: > > > > > > > > > Could the

Re: [PATCH bpf-next v5 9/9] bpf: xfrm: Add selftest for bpf_xdp_get_xfrm_state()

2023-12-12 Thread Daniel Xu
cc Kumar On Tue, Dec 12, 2023 at 09:17:02AM -0700, Daniel Xu wrote: > On Mon, Dec 11, 2023 at 04:25:06PM -0800, Eyal Birger wrote: > > On Mon, Dec 11, 2023 at 3:49 PM Daniel Xu wrote: > > > > > > On Mon, Dec 11, 2023 at 03:13:07PM -0800, Eyal Birger wrote: > > > > On Mon, Dec 11, 2023 at 2:31 PM

[PATCH v2 4/5] selftests/damon: add a test for update_schemes_tried_regions sysfs command

2023-12-12 Thread SeongJae Park
Add a selftest for verifying the accuracy of DAMON's access monitoring functionality. The test starts a program of artificial access pattern, monitor the access pattern using DAMON, and check if DAMON finds expected amount of hot data region (working set size) with only acceptable error rate.

  1   2   >