Re: [PATCH v7 0/6] introduce PIDFD_SELF* sentinels

2025-01-31 Thread Lorenzo Stoakes
On Thu, Jan 30, 2025 at 03:32:36PM -0800, Andrew Morton wrote: > On Thu, 30 Jan 2025 23:10:53 + Pedro Falcato > wrote: > > > On Thu, Jan 30, 2025 at 10:53 PM Lorenzo Stoakes > > wrote: > > > > > > > The above code sequence doesn't seem at all o

Re: [PATCH v7 0/6] introduce PIDFD_SELF* sentinels

2025-01-30 Thread Lorenzo Stoakes
On Thu, Jan 30, 2025 at 02:37:54PM -0800, Andrew Morton wrote: > On Thu, 30 Jan 2025 20:40:25 +0000 Lorenzo Stoakes > wrote: > > > If you wish to utilise a pidfd interface to refer to the current process or > > thread it is rather cumbersome, requiring something like:

[PATCH v7 1/6] pidfd: add PIDFD_SELF* sentinels to refer to own thread/process

2025-01-30 Thread Lorenzo Stoakes
considers to be a process. We adjust pidfd_get_task() and the pidfd_send_signal() system call with specific handling for this, implementing this functionality for process_madvise(), process_mrelease() (albeit, using it here wouldn't really make sense) and pidfd_send_signal(). Signed-off-by:

[PATCH v7 6/6] selftests/mm: use PIDFD_SELF in guard pages test

2025-01-30 Thread Lorenzo Stoakes
Now we have PIDFD_SELF available for process_madvise(), make use of it in the guard pages test. This is both more convenient and asserts that PIDFD_SELF works as expected. Signed-off-by: Lorenzo Stoakes --- tools/testing/selftests/mm/Makefile | 4 tools/testing/selftests/mm/guard

[PATCH v7 5/6] selftests: pidfd: add tests for PIDFD_SELF_*

2025-01-30 Thread Lorenzo Stoakes
sensibly tested as it would require the testing process to be dying). We also correct the pidfd_open_test.c fields which refer to .request_mask whereas the UAPI header refers to .mask, which otherwise break the import of the UAPI header. Signed-off-by: Lorenzo Stoakes --- tools/testing

[PATCH v7 4/6] selftests: pidfd: add pidfd.h UAPI wrapper

2025-01-30 Thread Lorenzo Stoakes
-by: Shuah Khan Signed-off-by: Lorenzo Stoakes --- tools/include/linux/pidfd.h| 14 ++ tools/testing/selftests/pidfd/Makefile | 3 +-- 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 tools/include/linux/pidfd.h diff --git a/tools/include/linux

[PATCH v7 0/6] introduce PIDFD_SELF* sentinels

2025-01-30 Thread Lorenzo Stoakes
kernel.org/linux-mm/cover.1728578231.git.lorenzo.stoa...@oracle.com/ RFC version: https://lore.kernel.org/linux-mm/cover.1727644404.git.lorenzo.stoa...@oracle.com/ Lorenzo Stoakes (6): pidfd: add PIDFD_SELF* sentinels to refer to own thread/process selftests/pidfd: add missing system heade

[PATCH v7 3/6] tools: testing: separate out wait_for_pid() into helper header

2025-01-30 Thread Lorenzo Stoakes
It seems tests other than the pidfd tests use the wait_for_pid() function declared in pidfd.h. Since we will shortly be modifying pidfd.h in a way that might clash with other tests, separate this out and update tests accordingly. Signed-off-by: Lorenzo Stoakes --- tools/testing/selftests

[PATCH v7 2/6] selftests/pidfd: add missing system header imcludes to pidfd tests

2025-01-30 Thread Lorenzo Stoakes
The pidfd_fdinfo_test.c and pidfd_setns_test.c tests appear to be missing fundamental system header imports required to execute correctly. Add these. Signed-off-by: Lorenzo Stoakes --- tools/testing/selftests/pidfd/pidfd_fdinfo_test.c | 1 + tools/testing/selftests/pidfd/pidfd_setns_test.c | 1

Re: [PATCH v1 1/2] mm: Clear uffd-wp PTE/PMD state on mremap()

2025-01-15 Thread Lorenzo Stoakes
On Wed, Jan 15, 2025 at 12:21:15PM -0500, Peter Xu wrote: > On Wed, Jan 15, 2025 at 04:58:06PM +, Ryan Roberts wrote: > > Hi Peter, David, > > Hey, Ryan, > > > > > On 07/01/2025 14:47, Ryan Roberts wrote: > > > When mremap()ing a memory region previously registered with userfaultfd > > > as wri

Re: [PATCH] selftests/memfd/memfd_test: Fix possible NULL pointer dereference

2025-01-14 Thread Lorenzo Stoakes
On Tue, Jan 14, 2025 at 11:21:15AM +0800, liuye wrote: > If name is NULL, a NULL pointer may be accessed in printf. > > Signed-off-by: liuye Reviewed-by: Lorenzo Stoakes > --- > tools/testing/selftests/memfd/memfd_test.c | 2 +- > 1 file changed, 1 insertion(+), 1 de

Re: [RFC PATCH RESEND v2 2/2] selftests/memfd: Add tests for F_SEAL_FUTURE_EXEC

2025-01-08 Thread Lorenzo Stoakes
On Thu, Jan 02, 2025 at 03:32:51PM -0800, Isaac J. Manjarres wrote: > Add tests to ensure that F_SEAL_FUTURE_EXEC behaves as expected. > > Signed-off-by: Isaac J. Manjarres This looks reasonable, Reviewed-by: Lorenzo Stoakes > --- > tools/testing/selftests/memfd/me

Re: [RFC PATCH RESEND v2 1/2] mm/memfd: Add support for F_SEAL_FUTURE_EXEC to memfd

2025-01-08 Thread Lorenzo Stoakes
On Wed, Jan 08, 2025 at 08:43:38PM +, Lorenzo Stoakes wrote: > On Mon, Jan 06, 2025 at 05:14:26PM -0800, Isaac Manjarres wrote: > > On Fri, Jan 03, 2025 at 04:03:44PM +0100, Jann Horn wrote: > > > On Fri, Jan 3, 2025 at 12:32 AM Isaac J. Manjarres > > > wrote: >

Re: [RFC PATCH RESEND v2 1/2] mm/memfd: Add support for F_SEAL_FUTURE_EXEC to memfd

2025-01-08 Thread Lorenzo Stoakes
On Thu, Jan 02, 2025 at 03:32:50PM -0800, Isaac J. Manjarres wrote: > Android currently uses the ashmem driver [1] for creating shared memory > regions between processes. Ashmem buffers can initially be mapped with > PROT_READ, PROT_WRITE, and PROT_EXEC. Processes can then use the > ASHMEM_SET_PROT

Re: [RFC PATCH RESEND v2 1/2] mm/memfd: Add support for F_SEAL_FUTURE_EXEC to memfd

2025-01-08 Thread Lorenzo Stoakes
On Mon, Jan 06, 2025 at 05:14:26PM -0800, Isaac Manjarres wrote: > On Fri, Jan 03, 2025 at 04:03:44PM +0100, Jann Horn wrote: > > On Fri, Jan 3, 2025 at 12:32 AM Isaac J. Manjarres > > wrote: > > > Android currently uses the ashmem driver [1] for creating shared memory > > > regions between proces

Re: [RFC PATCH RESEND v2 0/2] Add file seal to prevent future exec mappings

2025-01-08 Thread Lorenzo Stoakes
On Thu, Jan 02, 2025 at 03:32:49PM -0800, Isaac J. Manjarres wrote: > * Resending because I accidentally forgot to include Lorenzo in the > "to" list. > > Android uses the ashmem driver [1] for creating shared memory regions > between processes. The ashmem driver exposes an ioctl command for > pr

Re: [RFC PATCH v1 1/2] mm/memfd: Add support for F_SEAL_FUTURE_EXEC to memfd

2025-01-08 Thread Lorenzo Stoakes
On Mon, Jan 06, 2025 at 04:44:33PM -0800, Kees Cook wrote: > On Mon, Jan 06, 2025 at 10:26:27AM -0800, Jeff Xu wrote: > > + Kees because this is related to W^X memfd and security. > > > > On Fri, Jan 3, 2025 at 7:14 AM Jann Horn wrote: > > > > > > On Fri,

Re: [PATCH v6 2/5] pidfd: add PIDFD_SELF_* sentinels to refer to own thread/process

2025-01-07 Thread Lorenzo Stoakes
On Mon, Jan 06, 2025 at 01:03:31PM -0800, Shakeel Butt wrote: > Hey Lorenzo & Christian, what's the latest here? I see Christian has > code suggestions at [1] which just needs to be addressed. Any thing > else? I am hoping we can get this merged in the coming open window. This is on my radar don't

Re: [RFC PATCH v1 1/2] mm/memfd: Add support for F_SEAL_FUTURE_EXEC to memfd

2024-12-06 Thread Lorenzo Stoakes
On Fri, Dec 06, 2024 at 12:48:09PM -0800, Isaac Manjarres wrote: > On Fri, Dec 06, 2024 at 06:19:49PM +0000, Lorenzo Stoakes wrote: > > On Thu, Dec 05, 2024 at 05:09:22PM -0800, Isaac J. Manjarres wrote: > > > diff --git a/mm/mmap.c b/mm/mmap.c > > > index b1b2a2

Re: [RFC PATCH v1 1/2] mm/memfd: Add support for F_SEAL_FUTURE_EXEC to memfd

2024-12-06 Thread Lorenzo Stoakes
On Thu, Dec 05, 2024 at 05:09:22PM -0800, Isaac J. Manjarres wrote: > Android currently uses the ashmem driver [1] for creating shared memory > regions between processes. Ashmem buffers can initially be mapped with > PROT_READ, PROT_WRITE, and PROT_EXEC. Processes can then use the > ASHMEM_SET_PROT

[PATCH] selftests/mm: add fork CoW guard page test

2024-12-05 Thread Lorenzo Stoakes
asserts that the behaviour is as we expect. This is grouped with other, more important, fork tests that ensure that guard pages are correctly propagated on fork. Fix a typo in a nearby comment at the same time. Signed-off-by: Lorenzo Stoakes --- tools/testing/selftests/mm/guard-pages.c | 73

Re: [PATCH v6 2/5] pidfd: add PIDFD_SELF_* sentinels to refer to own thread/process

2024-12-02 Thread Lorenzo Stoakes
On Fri, Nov 08, 2024 at 02:28:14PM +, Lorenzo Stoakes wrote: > On Wed, Oct 30, 2024 at 04:37:37PM +0000, Lorenzo Stoakes wrote: > > On Mon, Oct 28, 2024 at 04:06:07PM +, Lorenzo Stoakes wrote: > > > I guess I'll try to adapt that and respin a v7 when I get a chance

Re: [PATCH v6 2/5] pidfd: add PIDFD_SELF_* sentinels to refer to own thread/process

2024-11-08 Thread Lorenzo Stoakes
On Wed, Oct 30, 2024 at 04:37:37PM +, Lorenzo Stoakes wrote: > On Mon, Oct 28, 2024 at 04:06:07PM +0000, Lorenzo Stoakes wrote: > > I guess I'll try to adapt that and respin a v7 when I get a chance. > > Hm looking at this draft patch, it seems like a total rework of pidfd&

Re: [PATCH v6 2/5] pidfd: add PIDFD_SELF_* sentinels to refer to own thread/process

2024-10-30 Thread Lorenzo Stoakes
On Mon, Oct 28, 2024 at 04:06:07PM +, Lorenzo Stoakes wrote: > I guess I'll try to adapt that and respin a v7 when I get a chance. Hm looking at this draft patch, it seems like a total rework of pidfd's across the board right (now all pidfd's will need to be converted to p

Re: [PATCH] kselftest/arm64: Use ksft_perror() to log MTE failures

2024-10-29 Thread Lorenzo Stoakes
that set errno. > Standardise on using the ksft_perror() helper in these cases so that more > information is available should the tests fail. > > Signed-off-by: Mark Brown Thanks very much for this! LGTM! Acked-by: Lorenzo Stoakes > --- > tools/testing/selftests/arm64/mte/mte_common_util

Re: [PATCH v6 2/5] pidfd: add PIDFD_SELF_* sentinels to refer to own thread/process

2024-10-28 Thread Lorenzo Stoakes
On Mon, Oct 28, 2024 at 04:34:33PM +0100, Christian Brauner wrote: > On Sat, Oct 26, 2024 at 08:24:58AM +0100, Lorenzo Stoakes wrote: > > It is useful to be able to utilise the pidfd mechanism to reference the > > current thread or process (from a userland point of view - thread g

[PATCH v6 2/5] pidfd: add PIDFD_SELF_* sentinels to refer to own thread/process

2024-10-26 Thread Lorenzo Stoakes
..), process_madvise(), process_mrelease(), pidfd_send_signal(), and pidfd_getfd() system calls. Things such as polling a pidfs and general fd operations are not supported, this strictly provides the sentinel for APIs which explicitly accept a pidfd. Suggested-by: Pedro Falcato Reviewed-by: Shak

[PATCH v6 1/5] pidfd: extend pidfd_get_pid() and de-duplicate pid lookup

2024-10-26 Thread Lorenzo Stoakes
pid lookup and to consistently handle this in one place. This lays the groundwork for a subsequent patch which adds a new sentinel pidfd to explicitly reference the current process (i.e. thread group leader) without the need for a pidfd. Reviewed-by: Shakeel Butt Signed-off-by: Lorenzo Stoa

[PATCH v6 5/5] selftests: pidfd: add tests for PIDFD_SELF_*

2024-10-26 Thread Lorenzo Stoakes
ed as it would require the testing process to be dying). Reviewed-by: Shuah Khan Signed-off-by: Lorenzo Stoakes --- tools/testing/selftests/pidfd/pidfd.h | 2 + .../selftests/pidfd/pidfd_getfd_test.c| 141 ++ .../selftests/pidfd/pidfd_setns_test.c

[PATCH v6 4/5] selftests: pidfd: add pidfd.h UAPI wrapper

2024-10-26 Thread Lorenzo Stoakes
-by: Shuah Khan Signed-off-by: Lorenzo Stoakes --- tools/include/linux/pidfd.h| 14 ++ tools/testing/selftests/pidfd/Makefile | 3 +-- 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 tools/include/linux/pidfd.h diff --git a/tools/include/linux

[PATCH v6 3/5] tools: testing: separate out wait_for_pid() into helper header

2024-10-26 Thread Lorenzo Stoakes
It seems tests other than the pidfd tests use the wait_for_pid() function declared in pidfd.h. Since we will shortly be modifying pidfd.h in a way that might clash with other tests, separate this out and update tests accordingly. Signed-off-by: Lorenzo Stoakes --- tools/testing/selftests

[PATCH v6 0/5] introduce PIDFD_SELF* sentinels

2024-10-26 Thread Lorenzo Stoakes
28578231.git.lorenzo.stoa...@oracle.com/ RFC version: https://lore.kernel.org/linux-mm/cover.1727644404.git.lorenzo.stoa...@oracle.com/ Lorenzo Stoakes (5): pidfd: extend pidfd_get_pid() and de-duplicate pid lookup pidfd: add PIDFD_SELF_* sentinels to refer to own thread/process tools: testing:

Re: [PATCH v5 2/5] pidfd: add PIDFD_SELF_* sentinels to refer to own thread/process

2024-10-26 Thread Lorenzo Stoakes
On Fri, Oct 25, 2024 at 01:31:49PM -0700, John Hubbard wrote: > On 10/25/24 12:49 PM, Lorenzo Stoakes wrote: > > On Fri, Oct 25, 2024 at 11:44:34AM -0700, John Hubbard wrote: > > > On 10/25/24 11:38 AM, Pedro Falcato wrote: > > > > On Fri, Oct 25, 2024 at 6:41 P

Re: [PATCH v5 2/5] pidfd: add PIDFD_SELF_* sentinels to refer to own thread/process

2024-10-25 Thread Lorenzo Stoakes
On Fri, Oct 25, 2024 at 02:51:29PM -0700, John Hubbard wrote: > On 10/25/24 2:09 PM, Lorenzo Stoakes wrote: > > On Fri, Oct 25, 2024 at 01:31:49PM -0700, John Hubbard wrote: > > > On 10/25/24 12:49 PM, Lorenzo Stoakes wrote: > > > > On Fri, Oct 25, 2024 at 11:44:

Re: [PATCH v5 2/5] pidfd: add PIDFD_SELF_* sentinels to refer to own thread/process

2024-10-25 Thread Lorenzo Stoakes
On Fri, Oct 25, 2024 at 11:44:34AM -0700, John Hubbard wrote: > On 10/25/24 11:38 AM, Pedro Falcato wrote: > > On Fri, Oct 25, 2024 at 6:41 PM John Hubbard wrote: > > > > > > On 10/25/24 5:50 AM, Pedro Falcato wrote: > > > > On Fri, Oct 25, 2024 at

Re: [PATCH v5 2/5] pidfd: add PIDFD_SELF_* sentinels to refer to own thread/process

2024-10-25 Thread Lorenzo Stoakes
On Fri, Oct 25, 2024 at 01:50:12PM +0100, Pedro Falcato wrote: > On Fri, Oct 25, 2024 at 10:41 AM Lorenzo Stoakes > wrote: > > > > It is useful to be able to utilise the pidfd mechanism to reference the > > current thread or process (from a userland point of view - thre

[PATCH v5 3/5] tools: testing: separate out wait_for_pid() into helper header

2024-10-25 Thread Lorenzo Stoakes
It seems tests other than the pidfd tests use the wait_for_pid() function declared in pidfd.h. Since we will shortly be modifying pidfd.h in a way that might clash with other tests, separate this out and update tests accordingly. Signed-off-by: Lorenzo Stoakes --- tools/testing/selftests

[PATCH v5 0/5] introduce PIDFD_SELF* sentinels

2024-10-25 Thread Lorenzo Stoakes
esting accordingly. https://lore.kernel.org/linux-mm/cover.1728578231.git.lorenzo.stoa...@oracle.com/ RFC version: https://lore.kernel.org/linux-mm/cover.1727644404.git.lorenzo.stoa...@oracle.com/ Lorenzo Stoakes (5): pidfd: extend pidfd_get_pid() and de-duplicate pid lookup pidfd: add PIDFD_SELF_*

[PATCH v5 2/5] pidfd: add PIDFD_SELF_* sentinels to refer to own thread/process

2024-10-25 Thread Lorenzo Stoakes
..), process_madvise(), process_mrelease(), pidfd_send_signal(), and pidfd_getfd() system calls. Things such as polling a pidfs and general fd operations are not supported, this strictly provides the sentinel for APIs which explicitly accept a pidfd. Reviewed-by: Shakeel Butt Signed-off-by: Lorenzo Stoak

[PATCH v5 5/5] selftests: pidfd: add tests for PIDFD_SELF_*

2024-10-25 Thread Lorenzo Stoakes
ed as it would require the testing process to be dying). Reviewed-by: Shuah Khan Signed-off-by: Lorenzo Stoakes --- tools/testing/selftests/pidfd/pidfd.h | 2 + .../selftests/pidfd/pidfd_getfd_test.c| 141 ++ .../selftests/pidfd/pidfd_setns_test.c

[PATCH v5 4/5] selftests: pidfd: add pidfd.h UAPI wrapper

2024-10-25 Thread Lorenzo Stoakes
-by: Shuah Khan Signed-off-by: Lorenzo Stoakes --- tools/include/linux/pidfd.h| 14 ++ tools/testing/selftests/pidfd/Makefile | 3 +-- 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 tools/include/linux/pidfd.h diff --git a/tools/include/linux

[PATCH v5 1/5] pidfd: extend pidfd_get_pid() and de-duplicate pid lookup

2024-10-25 Thread Lorenzo Stoakes
pid lookup and to consistently handle this in one place. This lays the groundwork for a subsequent patch which adds a new sentinel pidfd to explicitly reference the current process (i.e. thread group leader) without the need for a pidfd. Reviewed-by: Shakeel Butt Signed-off-by: Lorenzo Stoa

Re: [PATCH v4 4/4] selftests: pidfd: add tests for PIDFD_SELF_*

2024-10-25 Thread Lorenzo Stoakes
D_SELF_*") > url: > https://github.com/intel-lab-lkp/linux/commits/Lorenzo-Stoakes/pidfd-extend-pidfd_get_pid-and-de-duplicate-pid-lookup/20241018-050825 Thanks. This issue is because, incredibly, the cgroup tests import ../pidfd/pidfd.h solely to use a helper, but in doing so inadv

Re: [PATCH v4 2/4] pidfd: add PIDFD_SELF_* sentinels to refer to own thread/process

2024-10-23 Thread Lorenzo Stoakes
On Wed, Oct 23, 2024 at 10:18:28AM -0700, Shakeel Butt wrote: > On Wed, Oct 23, 2024 at 08:18:35AM GMT, Lorenzo Stoakes wrote: > > On Tue, Oct 22, 2024 at 05:53:00PM -0700, Shakeel Butt wrote: > > > On Thu, Oct 17, 2024 at 10:05:50PM GMT, Lorenzo Stoakes wrote: > > > &

Re: [PATCH v4 2/4] pidfd: add PIDFD_SELF_* sentinels to refer to own thread/process

2024-10-23 Thread Lorenzo Stoakes
On Tue, Oct 22, 2024 at 05:53:00PM -0700, Shakeel Butt wrote: > On Thu, Oct 17, 2024 at 10:05:50PM GMT, Lorenzo Stoakes wrote: > > It is useful to be able to utilise the pidfd mechanism to reference the > > current thread or process (from a userland point of view - thread group >

Re: [PATCH v4 2/4] pidfd: add PIDFD_SELF_* sentinels to refer to own thread/process

2024-10-21 Thread Lorenzo Stoakes
On Thu, Oct 17, 2024 at 10:05:50PM +0100, Lorenzo Stoakes wrote: > It is useful to be able to utilise the pidfd mechanism to reference the > current thread or process (from a userland point of view - thread group > leader from the kernel's point of view). > > Therefore introdu

Re: [PATCH v4 3/4] selftests: pidfd: add pidfd.h UAPI wrapper

2024-10-18 Thread Lorenzo Stoakes
On Thu, Oct 17, 2024 at 02:45:43PM -0700, John Hubbard wrote: > On 10/17/24 2:05 PM, Lorenzo Stoakes wrote: > > Conflicts can arise between system fcntl.h and linux/fcntl.h, imported by > > the linux/pidfd.h UAPI header. > > > > Work around this by adding a wrapper for

[PATCH v4 4/4] selftests: pidfd: add tests for PIDFD_SELF_*

2024-10-17 Thread Lorenzo Stoakes
ed as it would require the testing process to be dying). Reviewed-by: Shuah Khan Signed-off-by: Lorenzo Stoakes --- tools/testing/selftests/pidfd/pidfd.h | 2 + .../selftests/pidfd/pidfd_getfd_test.c| 141 ++ .../selftests/pidfd/pidfd_setns_test.c

[PATCH v4 3/4] selftests: pidfd: add pidfd.h UAPI wrapper

2024-10-17 Thread Lorenzo Stoakes
-by: Shuah Khan Signed-off-by: Lorenzo Stoakes --- tools/include/linux/pidfd.h| 14 ++ tools/testing/selftests/pidfd/Makefile | 3 +-- 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 tools/include/linux/pidfd.h diff --git a/tools/include/linux

[PATCH v4 1/4] pidfd: extend pidfd_get_pid() and de-duplicate pid lookup

2024-10-17 Thread Lorenzo Stoakes
pid lookup and to consistently handle this in one place. This lays the groundwork for a subsequent patch which adds a new sentinel pidfd to explicitly reference the current process (i.e. thread group leader) without the need for a pidfd. Signed-off-by: Lorenzo Stoakes --- include/linux/pid.h |

[PATCH v4 2/4] pidfd: add PIDFD_SELF_* sentinels to refer to own thread/process

2024-10-17 Thread Lorenzo Stoakes
..), process_madvise(), process_mrelease(), pidfd_send_signal(), and pidfd_getfd() system calls. Things such as polling a pidfs and general fd operations are not supported, this strictly provides the sentinel for APIs which explicitly accept a pidfd. Signed-off-by: Lorenzo Stoakes --- include/linux/pid.

[PATCH v4 0/4] introduce PIDFD_SELF* sentinels

2024-10-17 Thread Lorenzo Stoakes
linux-mm/cover.1727644404.git.lorenzo.stoa...@oracle.com/ Lorenzo Stoakes (4): pidfd: extend pidfd_get_pid() and de-duplicate pid lookup pidfd: add PIDFD_SELF_* sentinels to refer to own thread/process selftests: pidfd: add pidfd.h UAPI wrapper selftests: pidfd: add tests for PIDFD_SEL

Re: [PATCH v3 3/3] selftests: pidfd: add tests for PIDFD_SELF_*

2024-10-17 Thread Lorenzo Stoakes
On Thu, Oct 17, 2024 at 01:37:06PM -0600, Shuah Khan wrote: > On 10/17/24 11:38, Lorenzo Stoakes wrote: > > On Thu, Oct 17, 2024 at 10:37:00AM -0700, John Hubbard wrote: > > > On 10/17/24 10:28 AM, Lorenzo Stoakes wrote: > > > > On Thu, Oct 17, 2024 at 10:17:

Re: [PATCH v3 3/3] selftests: pidfd: add tests for PIDFD_SELF_*

2024-10-17 Thread Lorenzo Stoakes
On Thu, Oct 17, 2024 at 10:37:00AM -0700, John Hubbard wrote: > On 10/17/24 10:28 AM, Lorenzo Stoakes wrote: > > On Thu, Oct 17, 2024 at 10:17:54AM -0700, John Hubbard wrote: > > > On 10/17/24 5:06 AM, Lorenzo Stoakes wrote: > ... > > > >

Re: [PATCH v3 3/3] selftests: pidfd: add tests for PIDFD_SELF_*

2024-10-17 Thread Lorenzo Stoakes
On Thu, Oct 17, 2024 at 10:17:54AM -0700, John Hubbard wrote: > On 10/17/24 5:06 AM, Lorenzo Stoakes wrote: > > +cc John, sorry I forgot to cc you on other replies!! > > > > On Thu, Oct 17, 2024 at 09:08:19AM +0100, Lorenzo Stoakes wrote: > > [snip] > > > &

Re: [PATCH v3 3/3] selftests: pidfd: add tests for PIDFD_SELF_*

2024-10-17 Thread Lorenzo Stoakes
+cc John, sorry I forgot to cc you on other replies!! On Thu, Oct 17, 2024 at 09:08:19AM +0100, Lorenzo Stoakes wrote: [snip] > > In any case I think copying the header to the tools/ directory with this > linux/fcntl.h in some way stubbed out (we could even stub out fcntl.h > th

Re: [PATCH v3 3/3] selftests: pidfd: add tests for PIDFD_SELF_*

2024-10-17 Thread Lorenzo Stoakes
On Wed, Oct 16, 2024 at 04:38:50PM -0600, Shuah Khan wrote: > On 10/16/24 16:06, Lorenzo Stoakes wrote: > > On Wed, Oct 16, 2024 at 02:00:27PM -0600, Shuah Khan wrote: > > > On 10/16/24 04:20, Lorenzo Stoakes wrote: > > > > Add tests to assert that PIDFD_SELF_* c

Re: [PATCH v3 3/3] selftests: pidfd: add tests for PIDFD_SELF_*

2024-10-17 Thread Lorenzo Stoakes
On Wed, Oct 16, 2024 at 07:14:34PM -0700, John Hubbard wrote: > On 10/16/24 3:06 PM, Lorenzo Stoakes wrote: > > On Wed, Oct 16, 2024 at 02:00:27PM -0600, Shuah Khan wrote: > > > On 10/16/24 04:20, Lorenzo Stoakes wrote: > ... > > > > diff --git a/tools/testing/s

Re: [PATCH v3 3/3] selftests: pidfd: add tests for PIDFD_SELF_*

2024-10-16 Thread Lorenzo Stoakes
On Wed, Oct 16, 2024 at 11:06:34PM +0100, Lorenzo Stoakes wrote: [sniip] > > > > The import will be fine and you can control that with -I flag in > > the makefile. Remove these and try to get including linux/pidfd.h > > working. > > I just tried this and it's n

Re: [PATCH v3 3/3] selftests: pidfd: add tests for PIDFD_SELF_*

2024-10-16 Thread Lorenzo Stoakes
On Wed, Oct 16, 2024 at 02:00:27PM -0600, Shuah Khan wrote: > On 10/16/24 04:20, Lorenzo Stoakes wrote: > > Add tests to assert that PIDFD_SELF_* correctly refers to the current > > thread and process. > > > > This is only practically meaningful to pidfd_send_signal()

Re: [PATCH v2 1/3] pidfd: extend pidfd_get_pid() and de-duplicate pid lookup

2024-10-16 Thread Lorenzo Stoakes
On Wed, Oct 16, 2024 at 03:00:55PM +0200, Christian Brauner wrote: > On Fri, Oct 11, 2024 at 12:05:55PM +0100, Lorenzo Stoakes wrote: > > The means by which a pid is determined from a pidfd is duplicated, with > > some callers holding a reference to the (pid)fd, and others explici

[PATCH v3 3/3] selftests: pidfd: add tests for PIDFD_SELF_*

2024-10-16 Thread Lorenzo Stoakes
ed as it would require the testing process to be dying). Signed-off-by: Lorenzo Stoakes --- tools/testing/selftests/pidfd/pidfd.h | 8 + .../selftests/pidfd/pidfd_getfd_test.c| 141 ++ .../selftests/pidfd/pidfd_setns_test.c| 11 ++ tools/testing/self

[PATCH v3 2/3] pidfd: add PIDFD_SELF_* sentinels to refer to own thread/process

2024-10-16 Thread Lorenzo Stoakes
s such as polling a pidfs and general fd operations are not supported, this strictly provides the sentinel for APIs which explicitly accept a pidfd. Signed-off-by: Lorenzo Stoakes --- include/linux/pid.h| 9 +++--- include/uapi/linux/pidfd.h | 15 + kernel/exit.c

[PATCH v3 1/3] pidfd: extend pidfd_get_pid() and de-duplicate pid lookup

2024-10-16 Thread Lorenzo Stoakes
s allows us to eliminate open-coded pidfd pid lookup and to consistently handle this in one place. This lays the groundwork for a subsequent patch which adds a new sentinel pidfd to explicitly reference the current process (i.e. thread group leader) without the need for a pidfd. Signed-off-by:

[PATCH v3 0/3] introduce PIDFD_SELF* sentinels

2024-10-16 Thread Lorenzo Stoakes
S respectively. * Updated testing accordingly. https://lore.kernel.org/linux-mm/cover.1728578231.git.lorenzo.stoa...@oracle.com/ RFC version: https://lore.kernel.org/linux-mm/cover.1727644404.git.lorenzo.stoa...@oracle.com/ Lorenzo Stoakes (3): pidfd: extend pidfd_get_pid() and de-duplicat

Re: [PATCH v2 1/3] pidfd: extend pidfd_get_pid() and de-duplicate pid lookup

2024-10-16 Thread Lorenzo Stoakes
1/3] pidfd: > extend pidfd_get_pid() and de-duplicate pid lookup") > url: > https://github.com/intel-lab-lkp/linux/commits/Lorenzo-Stoakes/pidfd-extend-pidfd_get_pid-and-de-duplicate-pid-lookup/20241011-191241 > base: https://git.kernel.org/cgit/linux/kernel/git/shuah/linux-kselftest

Re: [PATCH v2 1/3] pidfd: extend pidfd_get_pid() and de-duplicate pid lookup

2024-10-16 Thread Lorenzo Stoakes
On Wed, Oct 16, 2024 at 01:16:15AM -0700, Suren Baghdasaryan wrote: > On Tue, Oct 15, 2024 at 11:05 PM Lorenzo Stoakes > wrote: > > > > On Tue, Oct 15, 2024 at 12:40:41PM -0700, Suren Baghdasaryan wrote: > > [snip] > > > > -struct pid *pidfd_get_pid(

Re: [PATCH v2 1/3] pidfd: extend pidfd_get_pid() and de-duplicate pid lookup

2024-10-15 Thread Lorenzo Stoakes
On Tue, Oct 15, 2024 at 12:40:41PM -0700, Suren Baghdasaryan wrote: [snip] > > -struct pid *pidfd_get_pid(unsigned int fd, unsigned int *flags) > > +struct pid *__pidfd_get_pid(unsigned int pidfd, bool pin_pid, > > + bool allow_proc, unsigned int *flags, > > +

[PATCH v2 3/3] selftests: pidfd: add tests for PIDFD_SELF_*

2024-10-11 Thread Lorenzo Stoakes
ed as it would require the testing process to be dying). Signed-off-by: Lorenzo Stoakes --- tools/testing/selftests/pidfd/pidfd.h | 8 + .../selftests/pidfd/pidfd_getfd_test.c| 141 ++ .../selftests/pidfd/pidfd_setns_test.c| 11 ++ tools/testing/self

[PATCH v2 2/3] pidfd: add PIDFD_SELF_* sentinels to refer to own thread/process

2024-10-11 Thread Lorenzo Stoakes
s such as polling a pidfs and general fd operations are not supported, this strictly provides the sentinel for APIs which explicitly accept a pidfd. Signed-off-by: Lorenzo Stoakes --- include/linux/pid.h| 9 +++--- include/uapi/linux/pidfd.h | 15 + kernel/exit.c

[PATCH v2 0/3] introduce PIDFD_SELF* sentinels

2024-10-11 Thread Lorenzo Stoakes
orenzo.stoa...@oracle.com/ Lorenzo Stoakes (3): pidfd: extend pidfd_get_pid() and de-duplicate pid lookup pidfd: add PIDFD_SELF_* sentinels to refer to own thread/process selftests: pidfd: add tests for PIDFD_SELF_* include/linux/pid.h | 43 +- i

[PATCH v2 1/3] pidfd: extend pidfd_get_pid() and de-duplicate pid lookup

2024-10-11 Thread Lorenzo Stoakes
s allows us to eliminate open-coded pidfd pid lookup and to consistently handle this in one place. This lays the groundwork for a subsequent patch which adds a new sentinel pidfd to explicitly reference the current process (i.e. thread group leader) without the need for a pidfd. Signed-off-by:

Re: [PATCH 3/3] selftests: pidfd: add tests for PIDFD_SELF_*

2024-10-11 Thread Lorenzo Stoakes
On Thu, Oct 10, 2024 at 05:16:22PM -0600, Shuah Khan wrote: > On 10/10/24 12:15, Lorenzo Stoakes wrote: > > Add tests to assert that PIDFD_SELF_* correctly refers to the current > > thread and process. > > > > This is only practically meaningful to pidfd_send_signal()

[PATCH 3/3] selftests: pidfd: add tests for PIDFD_SELF_*

2024-10-10 Thread Lorenzo Stoakes
ed as it would require the testing process to be dying). Signed-off-by: Lorenzo Stoakes --- tools/testing/selftests/pidfd/pidfd.h | 8 ++ .../selftests/pidfd/pidfd_getfd_test.c| 136 ++ .../selftests/pidfd/pidfd_setns_test.c| 11 ++ tools/testing/self

[PATCH 2/3] pidfd: add PIDFD_SELF* sentinels to refer to own thread/process

2024-10-10 Thread Lorenzo Stoakes
s such as polling a pidfs and general fd operations are not supported, this strictly provides the sentinel for APIs which explicitly accept a pidfd. Signed-off-by: Lorenzo Stoakes --- include/linux/pid.h| 9 +++--- include/uapi/linux/pidfd.h | 15 + kernel/exit.c | 3 +- k

[PATCH 1/3] pidfd: extend pidfd_get_pid() and de-duplicate pid lookup

2024-10-10 Thread Lorenzo Stoakes
s allows us to eliminate open-coded pidfd pid lookup and to consistently handle this in one place. This lays the groundwork for a subsequent patch which adds a new sentinel pidfd to explicitly reference the current process (i.e. thread group leader) without the need for a pidfd. Signed-off-by:

[PATCH 0/3] introduce PIDFD_SELF* sentinels

2024-10-10 Thread Lorenzo Stoakes
LF and PIDFD_SELF_PROCESS respectively. * Updated testing accordingly. RFC version: https://lore.kernel.org/linux-mm/1d19f18c-5a60-44b5-a96f-9d0e74f2b02c@lucifer.local/ Lorenzo Stoakes (3): pidfd: extend pidfd_get_pid() and de-duplicate pid lookup pidfd: add PIDFD_SELF_* sentinels to re

Re: [RFC PATCH 0/3] introduce PIDFD_SELF

2024-10-01 Thread Lorenzo Stoakes
On Tue, Oct 01, 2024 at 12:21:32PM GMT, Christian Brauner wrote: > On Mon, Sep 30, 2024 at 03:32:25PM GMT, Lorenzo Stoakes wrote: > > On Mon, Sep 30, 2024 at 04:21:23PM GMT, Aleksa Sarai wrote: [snip] > > > Sorry to bike-shed, but to match /proc/self and /proc/thread-self

Re: [RFC PATCH 0/3] introduce PIDFD_SELF

2024-09-30 Thread Lorenzo Stoakes
On Mon, Sep 30, 2024 at 04:21:23PM GMT, Aleksa Sarai wrote: > On 2024-09-30, Lorenzo Stoakes wrote: > > On Mon, Sep 30, 2024 at 02:34:33PM GMT, Christian Brauner wrote: > > > On Mon, Sep 30, 2024 at 11:39:49AM GMT, Lorenzo Stoakes wrote: > > > > On Mon, Sep 30, 2

Re: [RFC PATCH 0/3] introduce PIDFD_SELF

2024-09-30 Thread Lorenzo Stoakes
On Mon, Sep 30, 2024 at 02:34:33PM GMT, Christian Brauner wrote: > On Mon, Sep 30, 2024 at 11:39:49AM GMT, Lorenzo Stoakes wrote: > > On Mon, Sep 30, 2024 at 12:33:18PM GMT, Florian Weimer wrote: > > > * Lorenzo Stoakes: > > > > > > > If you wish to ut

Re: [RFC PATCH 0/3] introduce PIDFD_SELF

2024-09-30 Thread Lorenzo Stoakes
On Mon, Sep 30, 2024 at 12:33:18PM GMT, Florian Weimer wrote: > * Lorenzo Stoakes: > > > If you wish to utilise a pidfd interface to refer to the current process > > (from the point of view of userland - from the kernel point of view - the > > thread group leader),

[RFC PATCH 1/3] pidfd: refactor pidfd_get_pid/to_pid() and de-duplicate pid lookup

2024-09-30 Thread Lorenzo Stoakes
ch which adds a new sentinel pidfd to explicitly reference the current process (i.e. thread group leader) without the need for a pidfd. Signed-off-by: Lorenzo Stoakes --- include/linux/pid.h | 42 +- kernel/pid.c

[RFC PATCH 2/3] pidfd: add PIDFD_SELF sentinel to refer to own process

2024-09-30 Thread Lorenzo Stoakes
pidfs and general fd operations are not supported, this strictly provides the sentinel for APIs which explicitly accept a pidfd. Signed-off-by: Lorenzo Stoakes --- include/linux/pid.h| 9 +++--- include/uapi/linux/pidfd.h | 3 ++ kernel/exit.c | 3 +- kernel/nsproxy.c

[RFC PATCH 3/3] selftests: pidfd: add tests for PIDFD_SELF

2024-09-30 Thread Lorenzo Stoakes
would require the testing process to be dying). Signed-off-by: Lorenzo Stoakes --- tools/testing/selftests/pidfd/pidfd.h | 5 +++ .../selftests/pidfd/pidfd_getfd_test.c| 38 +++ .../selftests/pidfd/pidfd_setns_test.c| 6 +++ tools/testing/selftests/pidfd/pidfd_t

[RFC PATCH 0/3] introduce PIDFD_SELF

2024-09-30 Thread Lorenzo Stoakes
tions such as open() or poll(), as this would require extensive work and be of no real use. Lorenzo Stoakes (3): pidfd: refactor pidfd_get_pid/to_pid() and de-duplicate pid lookup pidfd: add PIDFD_SELF sentinel to refer to own process selftests: pidfd: add tests for PIDFD_SELF include/l

[PATCH] selftests/mm: add pkey_sighandler_xx, hugetlb_dio to .gitignore

2024-09-24 Thread Lorenzo Stoakes
did not add these to .gitignore. Correct this. Signed-off-by: Lorenzo Stoakes --- tools/testing/selftests/mm/.gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/testing/selftests/mm/.gitignore b/tools/testing/selftests/mm/.gitignore index da030b43e43b..689bbd520296 100644 --- a/tools/

[tip: x86/mm] x86/mm: Increase pgt_buf size for 5-level page tables

2021-01-04 Thread tip-bot2 for Lorenzo Stoakes
The following commit has been merged into the x86/mm branch of tip: Commit-ID: 167dcfc08b0b1f964ea95d410aa496fd78adf475 Gitweb: https://git.kernel.org/tip/167dcfc08b0b1f964ea95d410aa496fd78adf475 Author:Lorenzo Stoakes AuthorDate:Tue, 15 Dec 2020 20:56:41 Committer

Re: [PATCH] x86/mm: increase pgt_buf size for 5-level page tables

2021-01-04 Thread Lorenzo Stoakes
Happy NY all, thanks for the review! I haven't contributed an x86-specific mm patch before so am not sure of the process - usually I submit patches to the mm mailing list and Andrew gathers them up into his tree, is there anything else I need to do with this? Thanks, Lorenzo

[PATCH] x86/mm: increase pgt_buf size for 5-level page tables

2020-12-15 Thread Lorenzo Stoakes
her 3 or 4 page tables respectively. This patch updates INIT_PGD_PAGE_COUNT to reflect this. Signed-off-by: Lorenzo Stoakes --- arch/x86/mm/init.c | 19 ++- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c index e26f5c5

Re: linux-next boot error: kernel BUG at include/linux/page-flags.h:LINE!

2020-12-03 Thread Lorenzo Stoakes
On Thu, 3 Dec 2020 at 12:24, Mike Rapoport wrote: > Yeah, the change to initialization of "unavailable" memory missed pfn 0 :( > This should fix it: Tried locally and it fixes the issue for me :)

[PATCH] mm: page_alloc: refactor setup_per_zone_lowmem_reserve()

2020-11-29 Thread Lorenzo Stoakes
lower zone this patch reverse the process and populates each zone's lowmem_reserve[] values in ascending order. This clarifies what is going on especially in the case of zero managed pages or ratio which is now explicitly shown to clear these values. Signed-off-by: Lorenzo

Re: linux-next boot error: WARNING in prepare_kswapd_sleep

2020-11-25 Thread Lorenzo Stoakes
On Wed, 25 Nov 2020 at 06:25, Alex Shi wrote: > Acked. Thanks. I submitted as an actual patch, refactored it slightly to avoid duplication of page_memcg(). > and further more, could you like try another patch? I tried that patch against the syzkaller failure case and it worked fine! Cheers, Lo

[PATCH] mm/memcg: warn on missing memcg on mem_cgroup_page_lruvec()

2020-11-25 Thread Lorenzo Stoakes
to assert that this is the case. Signed-off-by: Lorenzo Stoakes Reported-by: syzbot+ce635500093181f39...@syzkaller.appspotmail.com --- include/linux/memcontrol.h | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index

Re: linux-next boot error: WARNING in prepare_kswapd_sleep

2020-11-24 Thread Lorenzo Stoakes
On Tue, 24 Nov 2020 at 07:54, syzbot wrote: > syzbot found the following issue on: > > HEAD commit:d9137320 Add linux-next specific files for 20201124 This appears to be a product of 4b2904f3 ("mm/memcg: add missed warning in mem_cgroup_lruvec") adding a VM_WARN_ON_ONCE() to mem_cgroup_lruvec

Re: linux-next boot error: BUG: unable to handle kernel NULL pointer dereference in mempool_init_node

2020-11-11 Thread Lorenzo Stoakes
ommon.c +++ b/mm/kasan/common.c @@ -387,6 +387,11 @@ void __kasan_slab_free_mempool(void *ptr, unsigned long ip) struct page *page; page = virt_to_head_page(ptr); + + if (!PageSlab(page)) { + return; + } + kasan_slab_free(page->slab_cache, ptr, i

Re: [PATCH RESEND] drm/via: use get_user_pages_unlocked()

2017-02-28 Thread Lorenzo Stoakes
patches were simply a mechanical/cautious replacement for code that is more or less exactly equivalent but if this would make sense perhaps it'd be worth using gup_fast() where possible? -- Lorenzo Stoakes https://ljs.io

[PATCH RESEND] drm/via: use get_user_pages_unlocked()

2017-02-27 Thread Lorenzo Stoakes
Moving from get_user_pages() to get_user_pages_unlocked() simplifies the code and takes advantage of VM_FAULT_RETRY functionality when faulting in pages. Signed-off-by: Lorenzo Stoakes --- drivers/gpu/drm/via/via_dmablit.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff

Re: [PATCH] drm/via: use get_user_pages_unlocked()

2017-02-20 Thread Lorenzo Stoakes
On 6 January 2017 at 07:09, Lorenzo Stoakes wrote: > > Adding Andrew, as this may be another less active corner of the corner, > thanks! Hi all, Thought I'd also give this one a gentle nudge now the merge window has re-opened, Andrew - are you ok to pick this up? I've check

Re: [PATCH] drivers/virt: use get_user_pages_unlocked()

2017-02-20 Thread Lorenzo Stoakes
On 3 January 2017 at 21:36, Michal Hocko wrote: > On Tue 03-01-17 21:14:20, Lorenzo Stoakes wrote: >> Just a gentle ping on this :) I think this might be a slightly >> abandoned corner of the kernel so not sure who else to ping to get >> this moving. > > Maybe An

Re: [PATCH] drm/via: use get_user_pages_unlocked()

2017-01-05 Thread Lorenzo Stoakes
On 3 January 2017 at 20:23, Lorenzo Stoakes wrote: > Hi All, > > Just a gentle ping on this one :) > > Cheers, Lorenzo > > On 1 November 2016 at 19:43, Lorenzo Stoakes wrote: >> Moving from get_user_pages() to get_user_pages_unlocked() simplifies the code >> and

  1   2   3   >