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

2025-01-14 Thread Jeff Xu
On Tue, Jan 14, 2025 at 3:41 PM Jeff Xu wrote: > > On Tue, Jan 14, 2025 at 2:42 PM Isaac Manjarres > wrote: > > > > On Tue, Jan 14, 2025 at 01:29:44PM -0800, Kees Cook wrote: > > > On Tue, Jan 14, 2025 at 12:02:28PM -0800, Isaac Manjarres wrote: > > > Alternatively, MFD_NOEXEC_SEAL could be exten

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

2025-01-14 Thread Jeff Xu
On Tue, Jan 14, 2025 at 2:42 PM Isaac Manjarres wrote: > > On Tue, Jan 14, 2025 at 01:29:44PM -0800, Kees Cook wrote: > > On Tue, Jan 14, 2025 at 12:02:28PM -0800, Isaac Manjarres wrote: > Alternatively, MFD_NOEXEC_SEAL could be extended > to prevent executable mappings, and MEMFD_NOEXEC_SCOPE_NO

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

2025-01-14 Thread Isaac Manjarres
On Tue, Jan 14, 2025 at 01:29:44PM -0800, Kees Cook wrote: > On Tue, Jan 14, 2025 at 12:02:28PM -0800, Isaac Manjarres wrote: > > I think the main issue in the threat model that I described is that > > an attacking process can gain control of a more priveleged process. > > I understood it to be ab

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

2025-01-14 Thread Kees Cook
On Tue, Jan 14, 2025 at 12:02:28PM -0800, Isaac Manjarres wrote: > I think the main issue in the threat model that I described is that > an attacking process can gain control of a more priveleged process. I understood it to be about an attacker gaining execution control through a rewritten functio

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

2025-01-14 Thread Isaac Manjarres
On Thu, Jan 09, 2025 at 03:30:36PM -0800, Jeff Xu wrote: > On Wed, Jan 8, 2025 at 11:06 AM Lorenzo Stoakes > wrote: > > > > 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

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

2025-01-09 Thread Jeff Xu
On Wed, Jan 8, 2025 at 11:06 AM Lorenzo Stoakes wrote: > > 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 w

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

2025-01-08 Thread Kees Cook
On Wed, Jan 08, 2025 at 07:06:13PM +, Lorenzo Stoakes wrote: > 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

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, Dec 6, 2024 at 7:19 PM Lorenzo Stoakes > >

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

2025-01-06 Thread Kees Cook
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, Dec 6, 2024 at 7:19 PM Lorenzo Stoakes > > wrote: > > > On Thu, Dec 05, 2024 at 05:09:22PM -0800, Isaac J. Manj

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

2025-01-06 Thread Jeff Xu
+ 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, Dec 6, 2024 at 7:19 PM Lorenzo Stoakes > wrote: > > On Thu, Dec 05, 2024 at 05:09:22PM -0800, Isaac J. Manjarres wrote: > > > + if (is_exec_sealed(seals)) { > > > > A

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

2025-01-03 Thread Jann Horn
On Fri, Dec 6, 2024 at 7:19 PM Lorenzo Stoakes wrote: > On Thu, Dec 05, 2024 at 05:09:22PM -0800, Isaac J. Manjarres wrote: > > + if (is_exec_sealed(seals)) { > > Are we intentionally disallowing a MAP_PRIVATE memfd's mapping's execution? > I've not tested this scenario so don't know i

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

2024-12-11 Thread Isaac Manjarres
On Fri, Dec 06, 2024 at 09:14:58PM +, Lorenzo Stoakes wrote: > On Fri, Dec 06, 2024 at 12:48:09PM -0800, Isaac Manjarres wrote: > > On Fri, Dec 06, 2024 at 06:19:49PM +, Lorenzo Stoakes wrote: > > > On Thu, Dec 05, 2024 at 05:09:22PM -0800, Isaac J. Manjarres wrote: > > > > diff --git a/mm/

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 +, 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 b1b2a24ef82e..c7b96b057fda 100644 > > > --

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

2024-12-06 Thread Isaac Manjarres
On Fri, Dec 06, 2024 at 09:49:35AM -0800, Kalesh Singh wrote: > On Thu, Dec 5, 2024 at 5:09 PM Isaac J. Manjarres > wrote: > > --- a/mm/mmap.c > > +++ b/mm/mmap.c > > @@ -375,6 +375,17 @@ unsigned long do_mmap(struct file *file, unsigned long > > addr, > > if (!file_mmap_ok(file,

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

2024-12-06 Thread Isaac Manjarres
On Fri, Dec 06, 2024 at 06:19:49PM +, 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 b1b2a24ef82e..c7b96b057fda 100644 > > --- a/mm/mmap.c > > +++ b/mm/mmap.c > > @@ -375,6 +375,17 @@ unsigned long do

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

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

2024-12-06 Thread Kalesh Singh
On Thu, Dec 5, 2024 at 5:09 PM 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_MASK io

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

2024-12-05 Thread Isaac J. Manjarres
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_MASK ioctl command to restrict--never add--the permissions that the buffer