Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-06-01 Thread Kees Cook
On Tue, May 28, 2019 at 06:02:45PM +0100, Catalin Marinas wrote: > On Thu, May 23, 2019 at 02:31:16PM -0700, Kees Cook wrote: > > syzkaller already attempts to randomly inject non-canonical and > > 0x addresses for user pointers in syscalls in an effort to > > find bugs like

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-31 Thread Catalin Marinas
On Fri, May 31, 2019 at 06:24:06PM +0200, Andrey Konovalov wrote: > On Fri, May 31, 2019 at 6:20 PM Catalin Marinas > wrote: > > On Fri, May 31, 2019 at 04:29:10PM +0200, Andrey Konovalov wrote: > > > On Thu, May 30, 2019 at 7:15 PM Catalin Marinas > > > wrote: > > > > On Tue, May 28, 2019 at

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-31 Thread Andrey Konovalov
On Fri, May 31, 2019 at 6:20 PM Catalin Marinas wrote: > > On Fri, May 31, 2019 at 04:29:10PM +0200, Andrey Konovalov wrote: > > On Thu, May 30, 2019 at 7:15 PM Catalin Marinas > > wrote: > > > On Tue, May 28, 2019 at 04:14:45PM +0200, Andrey Konovalov wrote: > > > > Thanks for a lot of

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-31 Thread Andrey Konovalov
On Thu, May 30, 2019 at 7:15 PM Catalin Marinas wrote: > > On Tue, May 28, 2019 at 04:14:45PM +0200, Andrey Konovalov wrote: > > Thanks for a lot of valuable input! I've read through all the replies > > and got somewhat lost. What are the changes I need to do to this > > series? > > > > 1. Should

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-30 Thread Catalin Marinas
On Tue, May 28, 2019 at 04:14:45PM +0200, Andrey Konovalov wrote: > Thanks for a lot of valuable input! I've read through all the replies > and got somewhat lost. What are the changes I need to do to this > series? > > 1. Should I move untagging for memory syscalls back to the generic > code so

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-29 Thread Catalin Marinas
On Tue, May 28, 2019 at 11:11:26PM -0700, Christoph Hellwig wrote: > On Tue, May 28, 2019 at 04:14:45PM +0200, Andrey Konovalov wrote: > > Thanks for a lot of valuable input! I've read through all the replies > > and got somewhat lost. What are the changes I need to do to this > > series? > > > >

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-29 Thread Christoph Hellwig
On Tue, May 28, 2019 at 04:14:45PM +0200, Andrey Konovalov wrote: > Thanks for a lot of valuable input! I've read through all the replies > and got somewhat lost. What are the changes I need to do to this > series? > > 1. Should I move untagging for memory syscalls back to the generic > code so

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-28 Thread Catalin Marinas
On Thu, May 23, 2019 at 02:31:16PM -0700, Kees Cook wrote: > syzkaller already attempts to randomly inject non-canonical and > 0x addresses for user pointers in syscalls in an effort to > find bugs like CVE-2017-5123 where waitid() via unchecked put_user() was > able to write directly

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-28 Thread Andrey Konovalov
Thanks for a lot of valuable input! I've read through all the replies and got somewhat lost. What are the changes I need to do to this series? 1. Should I move untagging for memory syscalls back to the generic code so other arches would make use of it as well, or should I keep the arm64 specific

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-24 Thread Khalid Aziz
On 5/24/19 4:11 AM, Catalin Marinas wrote: > On Thu, May 23, 2019 at 03:49:05PM -0600, Khalid Aziz wrote: >> On 5/23/19 2:11 PM, Catalin Marinas wrote: >>> On Thu, May 23, 2019 at 11:51:40AM -0600, Khalid Aziz wrote: On 5/21/19 6:04 PM, Kees Cook wrote: > As an aside: I think Sparc ADI

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-24 Thread Dave Martin
On Thu, May 23, 2019 at 05:57:09PM +0100, Catalin Marinas wrote: > On Thu, May 23, 2019 at 11:42:57AM +0100, Dave P Martin wrote: > > On Wed, May 22, 2019 at 09:20:52PM -0300, Jason Gunthorpe wrote: > > > On Wed, May 22, 2019 at 02:49:28PM +0100, Dave Martin wrote: > > > > If multiple people will

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-24 Thread Catalin Marinas
On Thu, May 23, 2019 at 02:31:16PM -0700, Kees Cook wrote: > On Thu, May 23, 2019 at 06:43:46PM +0100, Catalin Marinas wrote: > > On Thu, May 23, 2019 at 09:38:19AM -0700, Kees Cook wrote: > > > What about testing tools that intentionally insert high bits for syscalls > > > and are _expecting_

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-24 Thread Catalin Marinas
On Thu, May 23, 2019 at 03:49:05PM -0600, Khalid Aziz wrote: > On 5/23/19 2:11 PM, Catalin Marinas wrote: > > On Thu, May 23, 2019 at 11:51:40AM -0600, Khalid Aziz wrote: > >> On 5/21/19 6:04 PM, Kees Cook wrote: > >>> As an aside: I think Sparc ADI support in Linux actually side-stepped > >>>

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-23 Thread Khalid Aziz
On 5/23/19 2:11 PM, Catalin Marinas wrote: > Hi Khalid, > > On Thu, May 23, 2019 at 11:51:40AM -0600, Khalid Aziz wrote: >> On 5/21/19 6:04 PM, Kees Cook wrote: >>> As an aside: I think Sparc ADI support in Linux actually side-stepped >>> this[1] (i.e. chose "solution 1"): "All addresses passed

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-23 Thread Khalid Aziz
On 5/23/19 2:11 PM, Catalin Marinas wrote: > Hi Khalid, > > On Thu, May 23, 2019 at 11:51:40AM -0600, Khalid Aziz wrote: >> On 5/21/19 6:04 PM, Kees Cook wrote: >>> As an aside: I think Sparc ADI support in Linux actually side-stepped >>> this[1] (i.e. chose "solution 1"): "All addresses passed

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-23 Thread Kees Cook
On Thu, May 23, 2019 at 06:43:46PM +0100, Catalin Marinas wrote: > On Thu, May 23, 2019 at 09:38:19AM -0700, Kees Cook wrote: > > What on this front would you be comfortable with? Given it's a new > > feature isn't it sufficient to have a CONFIG (and/or boot option)? > > I'd rather avoid

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-23 Thread Catalin Marinas
Hi Khalid, On Thu, May 23, 2019 at 11:51:40AM -0600, Khalid Aziz wrote: > On 5/21/19 6:04 PM, Kees Cook wrote: > > As an aside: I think Sparc ADI support in Linux actually side-stepped > > this[1] (i.e. chose "solution 1"): "All addresses passed to kernel must > > be non-ADI tagged addresses."

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-23 Thread Khalid Aziz
On 5/21/19 6:04 PM, Kees Cook wrote: > As an aside: I think Sparc ADI support in Linux actually side-stepped > this[1] (i.e. chose "solution 1"): "All addresses passed to kernel must > be non-ADI tagged addresses." (And sadly, "Kernel does not enable ADI > for kernel code.") I think this was a

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-23 Thread Catalin Marinas
On Thu, May 23, 2019 at 09:38:19AM -0700, Kees Cook wrote: > On Thu, May 23, 2019 at 03:44:49PM +0100, Catalin Marinas wrote: > > There is also the obvious requirement which I didn't mention: new user > > space continues to run on new/subsequent kernel versions. That's one of > > the points of

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-23 Thread Catalin Marinas
On Thu, May 23, 2019 at 08:44:12AM -0700, enh wrote: > On Thu, May 23, 2019 at 7:45 AM Catalin Marinas > wrote: > > On Wed, May 22, 2019 at 01:47:36PM -0700, Kees Cook wrote: > > > For userspace, how would a future binary choose TBI over MTE? If it's > > > a library issue, we can't use an ELF

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-23 Thread Catalin Marinas
On Thu, May 23, 2019 at 11:42:57AM +0100, Dave P Martin wrote: > On Wed, May 22, 2019 at 09:20:52PM -0300, Jason Gunthorpe wrote: > > On Wed, May 22, 2019 at 02:49:28PM +0100, Dave Martin wrote: > > > If multiple people will care about this, perhaps we should try to > > > annotate types more

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-23 Thread Kees Cook
On Thu, May 23, 2019 at 03:44:49PM +0100, Catalin Marinas wrote: > There is also the obvious requirement which I didn't mention: new user > space continues to run on new/subsequent kernel versions. That's one of > the points of contention for this series (ignoring MTE) with the > maintainers

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-23 Thread enh
On Thu, May 23, 2019 at 7:45 AM Catalin Marinas wrote: > > On Wed, May 22, 2019 at 01:47:36PM -0700, Kees Cook wrote: > > On Wed, May 22, 2019 at 05:35:27PM +0100, Catalin Marinas wrote: > > > The two hard requirements I have for supporting any new hardware feature > > > in Linux are (1) a single

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-23 Thread Catalin Marinas
On Wed, May 22, 2019 at 09:58:22AM -0700, enh wrote: > i was questioning the argument about the ioctl issues, and saying that > from my perspective, untagging bugs are not really any different than > any other kind of kernel bug. Once this series gets in, they are indeed just kernel bugs. What I

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-23 Thread Catalin Marinas
On Wed, May 22, 2019 at 12:21:27PM -0700, Kees Cook wrote: > If a process wants to not tag, that's also up to the allocator where > it can decide not to ask the kernel, and just not tag. Nothing breaks in > userspace if a process is NOT tagging and untagged_addr() exists or is > missing. This, I

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-23 Thread Catalin Marinas
On Wed, May 22, 2019 at 01:47:36PM -0700, Kees Cook wrote: > On Wed, May 22, 2019 at 05:35:27PM +0100, Catalin Marinas wrote: > > The two hard requirements I have for supporting any new hardware feature > > in Linux are (1) a single kernel image binary continues to run on old > > hardware while

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-23 Thread Dave Martin
On Wed, May 22, 2019 at 09:20:52PM -0300, Jason Gunthorpe wrote: > On Wed, May 22, 2019 at 02:49:28PM +0100, Dave Martin wrote: > > On Tue, May 21, 2019 at 03:48:56PM -0300, Jason Gunthorpe wrote: > > > On Fri, May 17, 2019 at 03:49:31PM +0100, Catalin Marinas wrote: > > > > > > > The tagged

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-23 Thread Catalin Marinas
On Wed, May 22, 2019 at 04:09:31PM -0700, enh wrote: > On Wed, May 22, 2019 at 4:03 PM Evgenii Stepanov wrote: > > On Wed, May 22, 2019 at 1:47 PM Kees Cook wrote: > > > On Wed, May 22, 2019 at 05:35:27PM +0100, Catalin Marinas wrote: > > > > I would also expect the C library or dynamic loader

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-22 Thread Jason Gunthorpe
On Wed, May 22, 2019 at 02:49:28PM +0100, Dave Martin wrote: > On Tue, May 21, 2019 at 03:48:56PM -0300, Jason Gunthorpe wrote: > > On Fri, May 17, 2019 at 03:49:31PM +0100, Catalin Marinas wrote: > > > > > The tagged pointers (whether hwasan or MTE) should ideally be a > > > transparent feature

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-22 Thread enh
On Wed, May 22, 2019 at 4:03 PM Evgenii Stepanov wrote: > > On Wed, May 22, 2019 at 1:47 PM Kees Cook wrote: > > > > On Wed, May 22, 2019 at 05:35:27PM +0100, Catalin Marinas wrote: > > > The two hard requirements I have for supporting any new hardware feature > > > in Linux are (1) a single

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-22 Thread Evgenii Stepanov
On Wed, May 22, 2019 at 1:47 PM Kees Cook wrote: > > On Wed, May 22, 2019 at 05:35:27PM +0100, Catalin Marinas wrote: > > The two hard requirements I have for supporting any new hardware feature > > in Linux are (1) a single kernel image binary continues to run on old > > hardware while making

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-22 Thread Kees Cook
On Wed, May 22, 2019 at 05:35:27PM +0100, Catalin Marinas wrote: > The two hard requirements I have for supporting any new hardware feature > in Linux are (1) a single kernel image binary continues to run on old > hardware while making use of the new feature if available and (2) old > user space

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-22 Thread enh
On Wed, May 22, 2019 at 12:21 PM Kees Cook wrote: > > On Wed, May 22, 2019 at 08:30:21AM -0700, enh wrote: > > On Wed, May 22, 2019 at 3:11 AM Catalin Marinas > > wrote: > > > On Tue, May 21, 2019 at 05:04:39PM -0700, Kees Cook wrote: > > > > I just want to make sure I fully understand your

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-22 Thread Kees Cook
On Wed, May 22, 2019 at 08:30:21AM -0700, enh wrote: > On Wed, May 22, 2019 at 3:11 AM Catalin Marinas > wrote: > > On Tue, May 21, 2019 at 05:04:39PM -0700, Kees Cook wrote: > > > I just want to make sure I fully understand your concern about this > > > being an ABI break, and I work best with

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-22 Thread enh
On Wed, May 22, 2019 at 9:35 AM Catalin Marinas wrote: > > On Wed, May 22, 2019 at 08:30:21AM -0700, enh wrote: > > On Wed, May 22, 2019 at 3:11 AM Catalin Marinas > > wrote: > > > On Tue, May 21, 2019 at 05:04:39PM -0700, Kees Cook wrote: > > > > I just want to make sure I fully understand

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-22 Thread Catalin Marinas
On Wed, May 22, 2019 at 08:30:21AM -0700, enh wrote: > On Wed, May 22, 2019 at 3:11 AM Catalin Marinas > wrote: > > On Tue, May 21, 2019 at 05:04:39PM -0700, Kees Cook wrote: > > > I just want to make sure I fully understand your concern about this > > > being an ABI break, and I work best with

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-22 Thread enh
On Wed, May 22, 2019 at 3:11 AM Catalin Marinas wrote: > > Hi Kees, > > Thanks for joining the thread ;). > > On Tue, May 21, 2019 at 05:04:39PM -0700, Kees Cook wrote: > > On Tue, May 21, 2019 at 07:29:33PM +0100, Catalin Marinas wrote: > > > On Mon, May 20, 2019 at 04:53:07PM -0700, Evgenii

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-22 Thread Dave Martin
On Tue, May 21, 2019 at 03:48:56PM -0300, Jason Gunthorpe wrote: > On Fri, May 17, 2019 at 03:49:31PM +0100, Catalin Marinas wrote: > > > The tagged pointers (whether hwasan or MTE) should ideally be a > > transparent feature for the application writer but I don't think we can > > solve it

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-22 Thread Catalin Marinas
Hi Kees, Thanks for joining the thread ;). On Tue, May 21, 2019 at 05:04:39PM -0700, Kees Cook wrote: > On Tue, May 21, 2019 at 07:29:33PM +0100, Catalin Marinas wrote: > > On Mon, May 20, 2019 at 04:53:07PM -0700, Evgenii Stepanov wrote: > > > On Fri, May 17, 2019 at 7:49 AM Catalin Marinas >

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-21 Thread Kees Cook
On Tue, May 21, 2019 at 07:29:33PM +0100, Catalin Marinas wrote: > On Mon, May 20, 2019 at 04:53:07PM -0700, Evgenii Stepanov wrote: > > On Fri, May 17, 2019 at 7:49 AM Catalin Marinas > > wrote: > > > IMO (RFC for now), I see two ways forward: > > > [...] > > > 2. Similar shim to the above libc

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-21 Thread Jason Gunthorpe
On Fri, May 17, 2019 at 03:49:31PM +0100, Catalin Marinas wrote: > The tagged pointers (whether hwasan or MTE) should ideally be a > transparent feature for the application writer but I don't think we can > solve it entirely and make it seamless for the multitude of ioctls(). > I'd say you only

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-21 Thread Catalin Marinas
On Mon, May 20, 2019 at 04:53:07PM -0700, Evgenii Stepanov wrote: > On Fri, May 17, 2019 at 7:49 AM Catalin Marinas > wrote: > > IMO (RFC for now), I see two ways forward: > > > > 1. Make this a user space problem and do not allow tagged pointers into > >the syscall ABI. A libc wrapper would

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-20 Thread Evgenii Stepanov
On Fri, May 17, 2019 at 7:49 AM Catalin Marinas wrote: > > Hi Andrey, > > On Mon, May 06, 2019 at 06:30:46PM +0200, Andrey Konovalov wrote: > > One of the alternative approaches to untagging that was considered is to > > completely strip the pointer tag as the pointer enters the kernel with > >

Re: [PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-17 Thread Catalin Marinas
Hi Andrey, On Mon, May 06, 2019 at 06:30:46PM +0200, Andrey Konovalov wrote: > One of the alternative approaches to untagging that was considered is to > completely strip the pointer tag as the pointer enters the kernel with > some kind of a syscall wrapper, but that won't work with the countless

[PATCH v15 00/17] arm64: untag user pointers passed to the kernel

2019-05-06 Thread Andrey Konovalov
=== Overview arm64 has a feature called Top Byte Ignore, which allows to embed pointer tags into the top byte of each pointer. Userspace programs (such as HWASan, a memory debugging tool [1]) might use this feature and pass tagged user pointers to the kernel through syscalls or other interfaces.