Re: [PATCH v3 resend 1/2] mm: Add an F_SEAL_FUTURE_WRITE seal to memfd

2018-11-11 Thread Joel Fernandes
On Sun, Nov 11, 2018 at 07:14:33AM -0800, Andy Lutomirski wrote: [...] > >> I see two reasonable solutions: > >> > >> 1. Don’t fiddle with the struct file at all. Instead make the > >> inode flag > >> work by itself. > > > > Currently, the

Re: [PATCH v3 resend 1/2] mm: Add an F_SEAL_FUTURE_WRITE seal to memfd

2018-11-11 Thread Andy Lutomirski
> On Nov 11, 2018, at 12:30 AM, Daniel Colascione wrote: > >> On Sun, Nov 11, 2018 at 12:09 AM, Joel Fernandes >> wrote: >> On Sat, Nov 10, 2018 at 07:40:10PM -0800, Andy Lutomirski wrote: >> [...] >> I see two reasonable solutions: >> >> 1. Don’t fiddle with the st

Re: [PATCH v3 resend 1/2] mm: Add an F_SEAL_FUTURE_WRITE seal to memfd

2018-11-11 Thread Daniel Colascione
On Sun, Nov 11, 2018 at 12:09 AM, Joel Fernandes wrote: > On Sat, Nov 10, 2018 at 07:40:10PM -0800, Andy Lutomirski wrote: > [...] >> >>> I see two reasonable solutions: >> >>> >> >>> 1. Don’t fiddle with the struct file at all. Instead make the inode >> >>> flag >> >>> work b

Re: [PATCH v3 resend 1/2] mm: Add an F_SEAL_FUTURE_WRITE seal to memfd

2018-11-11 Thread Joel Fernandes
On Sat, Nov 10, 2018 at 07:40:10PM -0800, Andy Lutomirski wrote: [...] > >>> I see two reasonable solutions: > >>> > >>> 1. Don’t fiddle with the struct file at all. Instead make the inode > >>> flag > >>> work by itself. > >> > >> Currently, the various VFS paths che

Re: [PATCH v3 resend 1/2] mm: Add an F_SEAL_FUTURE_WRITE seal to memfd

2018-11-10 Thread Joel Fernandes
On Sat, Nov 10, 2018 at 07:40:10PM -0800, Andy Lutomirski wrote: > > > > On Nov 10, 2018, at 6:38 PM, Joel Fernandes wrote: > > > >> On Sat, Nov 10, 2018 at 02:18:23PM -0800, Andy Lutomirski wrote: > >> > On Nov 10, 2018, at 2:09 PM, Joel Fernandes > wrote: > > > On Sat,

Re: [PATCH v3 resend 1/2] mm: Add an F_SEAL_FUTURE_WRITE seal to memfd

2018-11-10 Thread Andy Lutomirski
> On Nov 10, 2018, at 6:38 PM, Joel Fernandes wrote: > >> On Sat, Nov 10, 2018 at 02:18:23PM -0800, Andy Lutomirski wrote: >> On Nov 10, 2018, at 2:09 PM, Joel Fernandes wrote: > On Sat, Nov 10, 2018 at 11:11:27AM -0800, Daniel Colascione wrote: >> On Sat, Nov 10, 2018 at

Re: [PATCH v3 resend 1/2] mm: Add an F_SEAL_FUTURE_WRITE seal to memfd

2018-11-10 Thread Joel Fernandes
On Sat, Nov 10, 2018 at 02:18:23PM -0800, Andy Lutomirski wrote: > > > On Nov 10, 2018, at 2:09 PM, Joel Fernandes wrote: > > > >> On Sat, Nov 10, 2018 at 11:11:27AM -0800, Daniel Colascione wrote: > >>> On Sat, Nov 10, 2018 at 10:45 AM, Daniel Colascione > >>> wrote: > On Sat, Nov 10, 20

Re: [PATCH v3 resend 1/2] mm: Add an F_SEAL_FUTURE_WRITE seal to memfd

2018-11-10 Thread Andy Lutomirski
> On Nov 10, 2018, at 2:09 PM, Joel Fernandes wrote: > >> On Sat, Nov 10, 2018 at 11:11:27AM -0800, Daniel Colascione wrote: >>> On Sat, Nov 10, 2018 at 10:45 AM, Daniel Colascione >>> wrote: On Sat, Nov 10, 2018 at 10:24 AM, Joel Fernandes wrote: Thanks Andy for your thought

Re: [PATCH v3 resend 1/2] mm: Add an F_SEAL_FUTURE_WRITE seal to memfd

2018-11-10 Thread Joel Fernandes
On Sat, Nov 10, 2018 at 11:11:27AM -0800, Daniel Colascione wrote: > On Sat, Nov 10, 2018 at 10:45 AM, Daniel Colascione wrote: > > On Sat, Nov 10, 2018 at 10:24 AM, Joel Fernandes > > wrote: > >> Thanks Andy for your thoughts, my comments below: > [snip] > >> I don't see it as warty, different

Re: [PATCH v3 resend 1/2] mm: Add an F_SEAL_FUTURE_WRITE seal to memfd

2018-11-10 Thread Andy Lutomirski
> On Nov 10, 2018, at 11:11 AM, Daniel Colascione wrote: > >> On Sat, Nov 10, 2018 at 10:45 AM, Daniel Colascione >> wrote: >>> On Sat, Nov 10, 2018 at 10:24 AM, Joel Fernandes >>> wrote: >>> Thanks Andy for your thoughts, my comments below: > [snip] >>> I don't see it as warty, different s

Re: [PATCH v3 resend 1/2] mm: Add an F_SEAL_FUTURE_WRITE seal to memfd

2018-11-10 Thread Daniel Colascione
On Sat, Nov 10, 2018 at 10:45 AM, Daniel Colascione wrote: > On Sat, Nov 10, 2018 at 10:24 AM, Joel Fernandes > wrote: >> Thanks Andy for your thoughts, my comments below: [snip] >> I don't see it as warty, different seals will work differently. It works >> quite well for our usecase, and since

Re: [PATCH v3 resend 1/2] mm: Add an F_SEAL_FUTURE_WRITE seal to memfd

2018-11-10 Thread Daniel Colascione
On Sat, Nov 10, 2018 at 10:24 AM, Joel Fernandes wrote: > Thanks Andy for your thoughts, my comments below: > > On Fri, Nov 09, 2018 at 10:05:14PM -0800, Andy Lutomirski wrote: >> >> >> > On Nov 9, 2018, at 7:20 PM, Joel Fernandes wrote: >> > >> >> On Fri, Nov 09, 2018 at 10:19:03PM +0100, Jann H

Re: [PATCH v3 resend 1/2] mm: Add an F_SEAL_FUTURE_WRITE seal to memfd

2018-11-10 Thread Joel Fernandes
Thanks Andy for your thoughts, my comments below: On Fri, Nov 09, 2018 at 10:05:14PM -0800, Andy Lutomirski wrote: > > > > On Nov 9, 2018, at 7:20 PM, Joel Fernandes wrote: > > > >> On Fri, Nov 09, 2018 at 10:19:03PM +0100, Jann Horn wrote: > >>> On Fri, Nov 9, 2018 at 10:06 PM Jann Horn wrot

Re: [PATCH v3 resend 1/2] mm: Add an F_SEAL_FUTURE_WRITE seal to memfd

2018-11-10 Thread Joel Fernandes
On Sat, Nov 10, 2018 at 04:26:46AM -0800, Daniel Colascione wrote: > On Friday, November 9, 2018, Joel Fernandes wrote: > > > On Fri, Nov 09, 2018 at 10:19:03PM +0100, Jann Horn wrote: > > > On Fri, Nov 9, 2018 at 10:06 PM Jann Horn wrote: > > > > On Fri, Nov 9, 2018 at 9:46 PM Joel Fernandes (G

Re: [PATCH v3 resend 1/2] mm: Add an F_SEAL_FUTURE_WRITE seal to memfd

2018-11-09 Thread Andy Lutomirski
> On Nov 9, 2018, at 7:20 PM, Joel Fernandes wrote: > >> On Fri, Nov 09, 2018 at 10:19:03PM +0100, Jann Horn wrote: >>> On Fri, Nov 9, 2018 at 10:06 PM Jann Horn wrote: >>> On Fri, Nov 9, 2018 at 9:46 PM Joel Fernandes (Google) >>> wrote: Android uses ashmem for sharing memory regions.

Re: [PATCH v3 resend 1/2] mm: Add an F_SEAL_FUTURE_WRITE seal to memfd

2018-11-09 Thread Joel Fernandes
On Fri, Nov 09, 2018 at 12:36:34PM -0800, Andrew Morton wrote: > On Wed, 7 Nov 2018 20:15:36 -0800 "Joel Fernandes (Google)" > wrote: > > > Android uses ashmem for sharing memory regions. We are looking forward > > to migrating all usecases of ashmem to memfd so that we can possibly > > remove

Re: [PATCH v3 resend 1/2] mm: Add an F_SEAL_FUTURE_WRITE seal to memfd

2018-11-09 Thread Joel Fernandes
On Fri, Nov 09, 2018 at 10:19:03PM +0100, Jann Horn wrote: > On Fri, Nov 9, 2018 at 10:06 PM Jann Horn wrote: > > On Fri, Nov 9, 2018 at 9:46 PM Joel Fernandes (Google) > > wrote: > > > Android uses ashmem for sharing memory regions. We are looking forward > > > to migrating all usecases of ashme

Re: [PATCH v3 resend 1/2] mm: Add an F_SEAL_FUTURE_WRITE seal to memfd

2018-11-09 Thread Joel Fernandes
On Fri, Nov 09, 2018 at 08:02:14PM +, Michael Tirado wrote: [...] > > > That aside: I wonder whether a better API would be something that > > > allows you to create a new readonly file descriptor, instead of > > > fiddling with the writability of an existing fd. > > > > Every now and then I try

Re: [PATCH v3 resend 1/2] mm: Add an F_SEAL_FUTURE_WRITE seal to memfd

2018-11-09 Thread Joel Fernandes
On Fri, Nov 09, 2018 at 03:14:02PM -0800, Andy Lutomirski wrote: > That aside: I wonder whether a better API would be something that > allows you to create a new readonly file descriptor, instead of > fiddling with the writability of an existing fd. > >>> > >>> That doesn't work, un

Re: [PATCH v3 resend 1/2] mm: Add an F_SEAL_FUTURE_WRITE seal to memfd

2018-11-09 Thread Michael Tirado
On Fri, Nov 9, 2018 at 9:41 PM Andy Lutomirski wrote: > > > > > On Nov 9, 2018, at 1:06 PM, Jann Horn wrote: > > > > +linux-api for API addition > > +hughd as FYI since this is somewhat related to mm/shmem > > > > On Fri, Nov 9, 2018 at 9:46 PM Joel Fernandes (Google) > > wrote: > >> Android use

Re: [PATCH v3 resend 1/2] mm: Add an F_SEAL_FUTURE_WRITE seal to memfd

2018-11-09 Thread Joel Fernandes
On Fri, Nov 09, 2018 at 10:06:31PM +0100, Jann Horn wrote: > +linux-api for API addition > +hughd as FYI since this is somewhat related to mm/shmem > > On Fri, Nov 9, 2018 at 9:46 PM Joel Fernandes (Google) > wrote: > > Android uses ashmem for sharing memory regions. We are looking forward > > to

Re: [PATCH v3 resend 1/2] mm: Add an F_SEAL_FUTURE_WRITE seal to memfd

2018-11-09 Thread Andy Lutomirski
> On Nov 9, 2018, at 2:42 PM, Daniel Colascione wrote: > > On Fri, Nov 9, 2018 at 2:37 PM, Andy Lutomirski wrote: >>> Another, more general fix might be to prevent /proc/pid/fd/N opens >>> from "upgrading" access modes. But that'd be a bigger ABI break. >> >> I think we should fix that, too.

Re: [PATCH v3 resend 1/2] mm: Add an F_SEAL_FUTURE_WRITE seal to memfd

2018-11-09 Thread Daniel Colascione
On Fri, Nov 9, 2018 at 2:37 PM, Andy Lutomirski wrote: >> Another, more general fix might be to prevent /proc/pid/fd/N opens >> from "upgrading" access modes. But that'd be a bigger ABI break. > > I think we should fix that, too. I consider it a bug fix, not an ABI break, > personally. Someone,

Re: [PATCH v3 resend 1/2] mm: Add an F_SEAL_FUTURE_WRITE seal to memfd

2018-11-09 Thread Andy Lutomirski
> On Nov 9, 2018, at 2:20 PM, Daniel Colascione wrote: > >> On Fri, Nov 9, 2018 at 1:06 PM, Jann Horn wrote: >> >> +linux-api for API addition >> +hughd as FYI since this is somewhat related to mm/shmem >> >> On Fri, Nov 9, 2018 at 9:46 PM Joel Fernandes (Google) >> wrote: >>> Android uses

Re: [PATCH v3 resend 1/2] mm: Add an F_SEAL_FUTURE_WRITE seal to memfd

2018-11-09 Thread Daniel Colascione
On Fri, Nov 9, 2018 at 1:06 PM, Jann Horn wrote: > > +linux-api for API addition > +hughd as FYI since this is somewhat related to mm/shmem > > On Fri, Nov 9, 2018 at 9:46 PM Joel Fernandes (Google) > wrote: > > Android uses ashmem for sharing memory regions. We are looking forward > > to migrati

Re: [PATCH v3 resend 1/2] mm: Add an F_SEAL_FUTURE_WRITE seal to memfd

2018-11-09 Thread Andy Lutomirski
> On Nov 9, 2018, at 1:06 PM, Jann Horn wrote: > > +linux-api for API addition > +hughd as FYI since this is somewhat related to mm/shmem > > On Fri, Nov 9, 2018 at 9:46 PM Joel Fernandes (Google) > wrote: >> Android uses ashmem for sharing memory regions. We are looking forward >> to migrat

Re: [PATCH v3 resend 1/2] mm: Add an F_SEAL_FUTURE_WRITE seal to memfd

2018-11-09 Thread Jann Horn
On Fri, Nov 9, 2018 at 10:06 PM Jann Horn wrote: > On Fri, Nov 9, 2018 at 9:46 PM Joel Fernandes (Google) > wrote: > > Android uses ashmem for sharing memory regions. We are looking forward > > to migrating all usecases of ashmem to memfd so that we can possibly > > remove the ashmem driver in th

Re: [PATCH v3 resend 1/2] mm: Add an F_SEAL_FUTURE_WRITE seal to memfd

2018-11-09 Thread Jann Horn
+linux-api for API addition +hughd as FYI since this is somewhat related to mm/shmem On Fri, Nov 9, 2018 at 9:46 PM Joel Fernandes (Google) wrote: > Android uses ashmem for sharing memory regions. We are looking forward > to migrating all usecases of ashmem to memfd so that we can possibly > remo

Re: [PATCH v3 resend 1/2] mm: Add an F_SEAL_FUTURE_WRITE seal to memfd

2018-11-09 Thread Andrew Morton
On Wed, 7 Nov 2018 20:15:36 -0800 "Joel Fernandes (Google)" wrote: > Android uses ashmem for sharing memory regions. We are looking forward > to migrating all usecases of ashmem to memfd so that we can possibly > remove the ashmem driver in the future from staging while also > benefiting from u

Re: [PATCH v3 resend 1/2] mm: Add an F_SEAL_FUTURE_WRITE seal to memfd

2018-11-09 Thread Joel Fernandes
On Wed, Nov 07, 2018 at 08:15:36PM -0800, Joel Fernandes (Google) wrote: > Android uses ashmem for sharing memory regions. We are looking forward > to migrating all usecases of ashmem to memfd so that we can possibly > remove the ashmem driver in the future from staging while also > benefiting from

[PATCH v3 resend 1/2] mm: Add an F_SEAL_FUTURE_WRITE seal to memfd

2018-11-07 Thread Joel Fernandes (Google)
Android uses ashmem for sharing memory regions. We are looking forward to migrating all usecases of ashmem to memfd so that we can possibly remove the ashmem driver in the future from staging while also benefiting from using memfd and contributing to it. Note staging drivers are also not ABI and ge