Re: [PATCH 1/2] mmap locking API: Order lock of nascent mm outside lock of live mm

2020-10-05 Thread Jason Gunthorpe
On Mon, Oct 05, 2020 at 03:30:43AM +0200, Jann Horn wrote: > But another place where lockdep asserts should be added is find_vma(); > there are currently several architectures that sometimes improperly > call that with no lock held: Yes, I've seen several cases of this mis-use in drivers too Jaso

Re: [PATCH 1/2] mmap locking API: Order lock of nascent mm outside lock of live mm

2020-10-04 Thread Jann Horn
On Sat, Oct 3, 2020 at 11:30 PM Michel Lespinasse wrote: > Unrelated to the above: copy_from_user and copy_to_user should not be > called with mmap_lock held; it may be worth adding these assertions > too (probably in separate patches) ? We already have that: All (hopefully?) the userspace access

Re: [PATCH 1/2] mmap locking API: Order lock of nascent mm outside lock of live mm

2020-10-03 Thread Michel Lespinasse
On Fri, Oct 2, 2020 at 9:33 AM Jann Horn wrote: > On Fri, Oct 2, 2020 at 11:18 AM Michel Lespinasse wrote: > > On Thu, Oct 1, 2020 at 6:25 PM Jann Horn wrote: > > > Until now, the mmap lock of the nascent mm was ordered inside the mmap > > > lock > > > of the old mm (in dup_mmap() and in UML's

Re: [PATCH 1/2] mmap locking API: Order lock of nascent mm outside lock of live mm

2020-10-02 Thread Jann Horn
On Fri, Oct 2, 2020 at 11:18 AM Michel Lespinasse wrote: > On Thu, Oct 1, 2020 at 6:25 PM Jann Horn wrote: > > Until now, the mmap lock of the nascent mm was ordered inside the mmap lock > > of the old mm (in dup_mmap() and in UML's activate_mm()). > > A following patch will change the exec path

Re: [PATCH 1/2] mmap locking API: Order lock of nascent mm outside lock of live mm

2020-10-02 Thread Jason Gunthorpe
On Fri, Oct 02, 2020 at 02:17:49AM -0700, Michel Lespinasse wrote: > Also FYI I was going to play with these patches a bit to help answer > these questions on my own, but wasn't able to easily apply them as > they came lightly mangled (whitespace issues) when I saved them. Me too It seems OK, you

Re: [PATCH 1/2] mmap locking API: Order lock of nascent mm outside lock of live mm

2020-10-02 Thread Michel Lespinasse
On Thu, Oct 1, 2020 at 6:25 PM Jann Horn wrote: > Until now, the mmap lock of the nascent mm was ordered inside the mmap lock > of the old mm (in dup_mmap() and in UML's activate_mm()). > A following patch will change the exec path to very broadly lock the > nascent mm, but fine-grained locking sh

[PATCH 1/2] mmap locking API: Order lock of nascent mm outside lock of live mm

2020-10-01 Thread Jann Horn
Until now, the mmap lock of the nascent mm was ordered inside the mmap lock of the old mm (in dup_mmap() and in UML's activate_mm()). A following patch will change the exec path to very broadly lock the nascent mm, but fine-grained locking should still work at the same time for the new mm. To do th