Re: [PATCH] mm: Fix vm_brk_flags() to not bail out while holding lock

2023-09-29 Thread Liam R. Howlett
sue since no caller sets a flag other > than VM_EXEC. > > Cc: Andrew Morton > Cc: Liam R. Howlett > Cc: Yu Zhao > Cc: linux...@kvack.org > Fixes: 2e7ce7d354f2 ("mm/mmap: change do_brk_flags() to expand existing VMA > and add do_brk_munmap()") > Signed-off-by:

Re: [PATCH 27/82] m68k: Refactor intentional wrap-around calculation

2024-01-22 Thread Liam R. Howlett
ng sum; > struct vm_area_struct *vma; > > /* Check for overflow. */ With your nice self-documenting code, you can probably drop that comment. With or without the change, Reviewed-by: Liam R. Howlett > - if (addr + len < addr) > +

Re: [RFC PATCH v1 0/1] seal system mappings

2024-10-08 Thread Liam R. Howlett
* Jeff Xu [241008 11:01]: > Hi Liam, > > On Mon, Oct 7, 2024 at 7:19 PM Liam R. Howlett > wrote: > > > > * jef...@chromium.org [241004 12:32]: > > > From: Jeff Xu > > > > > > Seal vdso, vvar, sigpage, uprobes and vsyscall. > > > &

Re: [RFC PATCH v1 0/1] seal system mappings

2024-10-07 Thread Liam R. Howlett
* jef...@chromium.org [241004 12:32]: > From: Jeff Xu > > Seal vdso, vvar, sigpage, uprobes and vsyscall. > > Those mappings are readonly or executable only, sealing can protect > them from ever changing during the life time of the process. > > System mappings such as vdso, vvar, and sigpage (

Re: [RFC PATCH v2 1/1] exec: seal system mappings

2024-10-16 Thread Liam R. Howlett
* jef...@chromium.org [241014 17:50]: > From: Jeff Xu > > Seal vdso, vvar, sigpage, uprobes and vsyscall. > > Those mappings are readonly or executable only, sealing can protect > them from ever changing during the life time of the process. For > complete descriptions of memory sealing, please

Re: [RFC PATCH v2 0/1] seal system mappings

2024-10-16 Thread Liam R. Howlett
* jef...@chromium.org [241014 17:50]: > From: Jeff Xu > > Seal vdso, vvar, sigpage, uprobes and vsyscall. > > Those mappings are readonly or executable only, sealing can protect > them from ever changing during the life time of the process. For > complete descriptions of memory sealing, please

Re: [RFC PATCH v2 1/1] exec: seal system mappings

2024-11-11 Thread Liam R. Howlett
* Jeff Xu [24 14:10]: > Hi Liam > > On Thu, Oct 17, 2024 at 9:01 AM Liam R. Howlett > wrote: > > > > > Does it make sense for this to live in exec? Couldn't you put it in the > > > > mm/mseal.c file? It's vma flags for mappings and you&#

Re: [RFC PATCH v2 1/1] exec: seal system mappings

2024-10-17 Thread Liam R. Howlett
> On Wed, Oct 16, 2024 at 6:10 PM Liam R. Howlett > wrote: ... > > > diff --git a/arch/x86/entry/vsyscall/vsyscall_64.c > > > b/arch/x86/entry/vsyscall/vsyscall_64.c > > > index 2fb7d53cf333..20a3000550d2 100644 > > > --- a/arch/x86/entry/vsyscal

Re: [RFC PATCH v2 0/1] seal system mappings

2024-10-16 Thread Liam R. Howlett
* Jeff Xu [241016 20:59]: > On Wed, Oct 16, 2024 at 4:18 PM Liam R. Howlett > wrote: > > > > * jef...@chromium.org [241014 17:50]: > > > From: Jeff Xu > > > > > > Seal vdso, vvar, sigpage, uprobes and vsyscall. > > > > > > Thos

Re: [PATCH v3 1/1] exec: seal system mappings

2024-11-13 Thread Liam R. Howlett
* jef...@chromium.org [241113 14:16]: > From: Jeff Xu Thanks, this looks much better. Some minor things below. > > Seal vdso, vvar, sigpage, uprobes and vsyscall. > > Those mappings are readonly or executable only, sealing can protect > them from ever changing or unmapped during the life tim

Re: [PATCH v1] mseal: move can_do_mseal to mseal.c

2024-12-05 Thread Liam R. Howlett
* jef...@chromium.org [241205 20:39]: > From: Jeff Xu > > No code logic change. > > can_do_mseal is called exclusively by mseal.c, > and mseal.c is compiled only when CONFIG_64BIT flag is > set in makefile. Therefore, it is unnecessary to have > 32 bit stub function in the header file. There i

Re: [PATCH v4 1/1] exec: seal system mappings

2025-01-03 Thread Liam R. Howlett
* Kees Cook [241217 17:19]: > On Mon, Nov 25, 2024 at 08:20:21PM +, jef...@chromium.org wrote: > > Seal vdso, vvar, sigpage, uprobes and vsyscall. > > > > Those mappings are readonly or executable only, sealing can protect > > them from ever changing or unmapped during the life time of the pr

Re: [RFC PATCH v5 1/7] mseal, system mappings: kernel config and header change

2025-02-12 Thread Liam R. Howlett
* jef...@chromium.org [250211 22:22]: > From: Jeff Xu > > Provide infrastructure to mseal system mappings. Establish > two kernel configs (CONFIG_MSEAL_SYSTEM_MAPPINGS, > ARCH_HAS_MSEAL_SYSTEM_MAPPINGS) and a header file (userprocess.h) > for future patches. > > As discussed during mseal() upst

Re: [PATCH v4 1/1] exec: seal system mappings

2024-12-16 Thread Liam R. Howlett
* Jeff Xu [241216 13:35]: ... > > > > I like the idea and I think the opt-out solution should work for CRIU. > > CRIU will be able to call this prctl and re-execute itself. > > > Great! Let's iterate on the opt-out solution then. > This patch set has been NACK'ed. Please rework your solution

Re: [PATCH v4 1/1] exec: seal system mappings

2025-01-22 Thread Liam R. Howlett
* enh [250121 10:38]: > On Fri, Jan 17, 2025 at 5:08 PM Liam R. Howlett > wrote: > > > > * enh [250117 14:35]: > > ... > > > > > > > > as a maintainer of a different linux libc, i've long wanted a "tell me > > > everything t

Re: [PATCH v4 1/1] exec: seal system mappings

2025-01-17 Thread Liam R. Howlett
* enh [250117 14:35]: ... > > as a maintainer of a different linux libc, i've long wanted a "tell me > everything there is to know about this vma" syscall rather than having > to parse /proc/maps... > You mean an ioctl()-based API to query VMAs from /proc//maps? Andrii had something like that

Re: [RFC PATCH v5 1/7] mseal, system mappings: kernel config and header change

2025-02-13 Thread Liam R. Howlett
* Liam R. Howlett [250213 19:14]: > * Jeff Xu [250213 17:00]: > > On Thu, Feb 13, 2025 at 12:54 PM Liam R. Howlett > > wrote: > > > > > > > > > > > > > > VM_SEALED isn't defined in 32-bit systems, and mseal.c isn't part of &g

Re: [RFC PATCH v5 1/7] mseal, system mappings: kernel config and header change

2025-02-13 Thread Liam R. Howlett
* Jeff Xu [250213 12:17]: > On Wed, Feb 12, 2025 at 7:05 AM Liam R. Howlett > wrote: > > > ... > > > > > > In this version, we've improved the handling of system mapping sealing > > > from > > > previous versions, instead of modifying t

Re: [RFC PATCH v5 0/7] mseal system mappings

2025-02-13 Thread Liam R. Howlett
* Kees Cook [250212 17:05]: > On Wed, Feb 12, 2025 at 11:24:35AM +, Lorenzo Stoakes wrote: > > On Wed, Feb 12, 2025 at 03:21:48AM +, jef...@chromium.org wrote: > > > From: Jeff Xu > > > > > > The commit message in the first patch contains the full description of > > > this series. > > >

Re: [RFC PATCH v5 0/7] mseal system mappings

2025-02-13 Thread Liam R. Howlett
* Kees Cook [250213 14:34]: > > > On February 13, 2025 10:35:21 AM PST, "Liam R. Howlett" > wrote: > >* Kees Cook [250212 17:05]: > >> On Wed, Feb 12, 2025 at 11:24:35AM +, Lorenzo Stoakes wrote: > >> > On Wed, Feb 12, 2025 at 03:21:48A

Re: [RFC PATCH v5 1/7] mseal, system mappings: kernel config and header change

2025-02-13 Thread Liam R. Howlett
* Kees Cook [250213 15:11]: > On Thu, Feb 13, 2025 at 01:29:46PM -0500, Liam R. Howlett wrote: > > * Jeff Xu [250213 12:17]: > > > On Wed, Feb 12, 2025 at 7:05 AM Liam R. Howlett > > > wrote: > > > > > > > ... > > > > > > >

Re: [RFC PATCH v5 1/7] mseal, system mappings: kernel config and header change

2025-02-13 Thread Liam R. Howlett
* Jeff Xu [250213 17:00]: > On Thu, Feb 13, 2025 at 12:54 PM Liam R. Howlett > wrote: > > > > > > > > > > > VM_SEALED isn't defined in 32-bit systems, and mseal.c isn't part of > > > > > the build. This is intentional. Any

Re: [PATCH v6 1/7] mseal, system mappings: kernel config and header change

2025-02-24 Thread Liam R. Howlett
* Kees Cook [250224 13:55]: > On Mon, Feb 24, 2025 at 10:52:13AM -0800, Dave Hansen wrote: > > On 2/24/25 10:44, Jeff Xu wrote: > > > For example: > > > Consider the case below in src/third_party/kernel/v6.6/fs/proc/task_mmu.c, > > > > > > #ifdef CONFIG_64BIT > > > [ilog2(VM_SEALED)] = "sl", > >

Re: [PATCH v6 1/7] mseal, system mappings: kernel config and header change

2025-02-24 Thread Liam R. Howlett
* Jeff Xu [250224 14:07]: ... > > > > > > #ifdef CONFIG_64BIT > > > [ilog2(VM_SEALED)] = "sl", > > > #endif > > > > > > Redefining VM_SEALED to VM_NONE for 32 bit won't detect the problem > > > in case that "#ifdef CONFIG_64BIT" line is missing. > > > > I don't think it is reasonable to insist

Re: [PATCH v6 1/7] mseal, system mappings: kernel config and header change

2025-02-24 Thread Liam R. Howlett
* Jeff Xu [250224 14:42]: > On Mon, Feb 24, 2025 at 11:25 AM Kees Cook wrote: > > > > On Mon, Feb 24, 2025 at 11:10:22AM -0800, Jeff Xu wrote: > > > On Mon, Feb 24, 2025 at 11:03 AM Liam R. Howlett > > > wrote: > > > > > > > > * Jeff

Re: [PATCH v6 2/7] selftests: x86: test_mremap_vdso: skip if vdso is msealed

2025-02-24 Thread Liam R. Howlett
* jef...@chromium.org [250224 12:45]: > From: Jeff Xu > > Add code to detect if the vdso is memory sealed, skip the test > if it is. It also skips the test if fopen fails on smaps, but maybe that's super rare? > > Signed-off-by: Jeff Xu > --- > .../testing/selftests/x86/test_mremap_vdso.c

Re: [PATCH v6 3/7] mseal, system mappings: enable x86-64

2025-02-24 Thread Liam R. Howlett
* jef...@chromium.org [250224 12:45]: > From: Jeff Xu > > Provide support for CONFIG_MSEAL_SYSTEM_MAPPINGS on x86-64, > covering the vdso, vvar, vvar_vclock. > > Production release testing passes on Android and Chrome OS. > > Signed-off-by: Jeff Xu > --- > arch/x86/Kconfig | 1 + >

Re: [PATCH v6 1/7] mseal, system mappings: kernel config and header change

2025-02-24 Thread Liam R. Howlett
* Jeff Xu [250224 14:23]: > On Mon, Feb 24, 2025 at 11:11 AM Liam R. Howlett > wrote: > > > > * Kees Cook [250224 13:55]: > > > On Mon, Feb 24, 2025 at 10:52:13AM -0800, Dave Hansen wrote: > > > > On 2/24/25 10:44, Jeff Xu wrote: > > > >

Re: [PATCH v6 1/7] mseal, system mappings: kernel config and header change

2025-02-24 Thread Liam R. Howlett
* Jeff Xu [250224 13:44]: > On Mon, Feb 24, 2025 at 10:21 AM Dave Hansen wrote: > > > > On 2/24/25 09:45, jef...@chromium.org wrote: > > > +/* > > > + * mseal of userspace process's system mappings. > > > + */ > > > +#ifdef CONFIG_MSEAL_SYSTEM_MAPPINGS > > > +#define MSEAL_SYSTEM_MAPPINGS_VM_FLAG

Re: [PATCH v6 7/7] mseal, system mappings: update mseal.rst

2025-02-24 Thread Liam R. Howlett
* jef...@chromium.org [250224 12:45]: > From: Jeff Xu > > Update memory sealing documentation to include details about system > mappings. > > Signed-off-by: Jeff Xu > --- > Documentation/userspace-api/mseal.rst | 7 +++ > 1 file changed, 7 insertions(+) > > diff --git a/Documentation/use

Re: [PATCH v6 1/7] mseal, system mappings: kernel config and header change

2025-02-24 Thread Liam R. Howlett
* Jeff Xu [250224 14:40]: > On Mon, Feb 24, 2025 at 11:18 AM Liam R. Howlett > wrote: > > > > Also, do we need something like the above test for VM_SEALED_SYS? > > > Do you mean adding selftest for sealing vdso ? or test the > VM_SEALED_

Re: [PATCH v7 6/7] mseal, system mappings: uprobe mapping

2025-02-26 Thread Liam R. Howlett
* Lorenzo Stoakes [250226 13:06]: > On Wed, Feb 26, 2025 at 07:01:36PM +0100, Oleg Nesterov wrote: > > On 02/26, Lorenzo Stoakes wrote: > > > > > > On Wed, Feb 26, 2025 at 05:26:04PM +0100, Oleg Nesterov wrote: > > > > On 02/24, jef...@chromium.org wrote: > > > > > > > > > > Unlike other system ma

Re: [PATCH v7 4/7] mseal, system mappings: enable arm64

2025-02-26 Thread Liam R. Howlett
* Lorenzo Stoakes [250226 00:26]: > On Tue, Feb 25, 2025 at 02:26:50PM -0800, Jeff Xu wrote: > > On Mon, Feb 24, 2025 at 10:20 PM Lorenzo Stoakes > > wrote: > > > > > > On Mon, Feb 24, 2025 at 10:52:43PM +, jef...@chromium.org wrote: > > > > From: Jeff Xu > > > > > > > > Provide support for

Re: [PATCH v7 1/7] mseal, system mappings: kernel config and header change

2025-02-25 Thread Liam R. Howlett
* jef...@chromium.org [250224 17:52]: > From: Jeff Xu > > Provide infrastructure to mseal system mappings. Establish > two kernel configs (CONFIG_MSEAL_SYSTEM_MAPPINGS, > ARCH_HAS_MSEAL_SYSTEM_MAPPINGS) and VM_SEALED_SYSMAP > macro for future patches. > > Signed-off-by: Jeff Xu > --- > includ

Re: [PATCH v8 6/7] mseal sysmap: update mseal.rst

2025-03-03 Thread Liam R. Howlett
* jef...@chromium.org [250303 00:09]: > From: Jeff Xu > > Update memory sealing documentation to include details about system > mappings. > > Signed-off-by: Jeff Xu > Reviewed-by: Kees Cook Reviewed-by: Liam R. Howlett > --- > Documentation/u

Re: [PATCH v8 5/7] mseal sysmap: uprobe mapping

2025-03-03 Thread Liam R. Howlett
e. It could be sealed from creation. > > Test was done with perf tool, and observe the uprobe mapping is sealed. > > Signed-off-by: Jeff Xu Reviewed-by: Liam R. Howlett > --- > kernel/events/uprobes.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --gi

Re: [PATCH v8 4/7] mseal sysmap: enable arm64

2025-03-03 Thread Liam R. Howlett
f-by: Jeff Xu Reviewed-by: Liam R. Howlett > --- > arch/arm64/Kconfig | 1 + > arch/arm64/kernel/vdso.c | 12 > 2 files changed, 9 insertions(+), 4 deletions(-) > > diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig > index 940343beb3d4..282d6cb13cfb 1

Re: [PATCH v8 0/7] mseal system mappings

2025-03-03 Thread Liam R. Howlett
> V8: > - Change ARCH_SUPPORTS_MSEAL_X to ARCH_SUPPORTS_MSEAL_X (Liam R. Howlett) It looks like this was captured wrong in just this update. Change ARCH_HAS => ARCH_SUPPORTS. Code looks correct. Kees also ran down the meaning of the two more than I did, so thanks again Kees! > -

Re: [PATCH v8 2/7] selftests: x86: test_mremap_vdso: skip if vdso is msealed

2025-03-03 Thread Liam R. Howlett
* jef...@chromium.org [250303 00:09]: > From: Jeff Xu > > Add code to detect if the vdso is memory sealed, skip the test > if it is. > > Signed-off-by: Jeff Xu > Reviewed-by: Kees Cook > Reviewed-by: Lorenzo Stoakes Reviewed-by: Liam R. Howlett > --- &

Re: [PATCH v8 3/7] mseal sysmap: enable x86-64

2025-03-03 Thread Liam R. Howlett
ch cleaner. Reviewed-by: Liam R. Howlett > --- > arch/x86/Kconfig | 1 + > arch/x86/entry/vdso/vma.c | 7 --- > 2 files changed, 5 insertions(+), 3 deletions(-) > > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig > index be2c311f5118..c6f9ebcbe009 100644 >

Re: [PATCH v8 1/7] mseal sysmap: kernel config and header change

2025-03-03 Thread Liam R. Howlett
f-by: Jeff Xu Reviewed-by: Liam R. Howlett > --- > include/linux/mm.h | 10 ++ > init/Kconfig | 22 ++ > security/Kconfig | 21 + > 3 files changed, 53 insertions(+) > > diff --git a/include/linux/mm.h b/include/