linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Gregory Price <gourry.memverge@gmail.com>,
	linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-arch@vger.kernel.org, avagin@gmail.com,
	peterz@infradead.org, luto@kernel.org, krisman@collabora.com,
	tglx@linutronix.de, corbet@lwn.net, shuah@kernel.org,
	arnd@arndb.de, Gregory Price <gregory.price@memverge.com>
Subject: Re: [PATCH v15 2/4] syscall user dispatch: untag selector addresses before access_ok
Date: Tue, 4 Apr 2023 18:33:40 +0100	[thread overview]
Message-ID: <ZCxfdC+v4v6EEy4v@arm.com> (raw)
In-Reply-To: <20230404104506.GA24740@redhat.com>

On Tue, Apr 04, 2023 at 12:45:06PM +0200, Oleg Nesterov wrote:
> doesn't this mean that access_ok() on arm64 could use
> untagged_addr(addr) unconditionally without any security risk?

Yes, from the security perspective, but there are ABI implications.

Currently untagged_addr() in access_ok() is conditional on the user
process enabling the tagged address ABI (prctl() that sets a TIF flag).
The reason we did not enable this by default was a slight fear of
breaking the ABI since tagged pointers were not allowed at the syscall
boundary. It turned out that the fear was justified since the
unconditional untagged_addr() in brk() broke user space (see commit
dcde237319e6 "mm: Avoid creating virtual address aliases in
brk()/mmap()/mremap()"; the user was doing an sbrk(PY_SSIZE_T_MAX) and
bits 56 and higher were ignored by the kernel).

I'd be ok with untagging the address unconditionally in the arm64
access_ok() introduce another unaliased_access_ok() (I'm not good at
naming functions) that preserves the non-tagged behaviour and we use it
in brk/mmap/mremap().

This may actually be a good idea as an additional fix. If an application
enables the tagged address ABI we still have the address aliasing issue
for brk(). We get away with this since glibc, if MTE is enabled, stops
using brk() for heap in favour of mmap(PROT_MTE). But one may use hwasan
without full MTE and it would have a similar issue.

-- 
Catalin

  reply	other threads:[~2023-04-04 17:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-30 21:21 [PATCH v15 0/4] Checkpoint Support for Syscall User Dispatch Gregory Price
2023-03-30 21:21 ` [PATCH v15 1/4] syscall_user_dispatch: helper function to operate on given task Gregory Price
2023-03-30 21:21 ` [PATCH v15 2/4] syscall user dispatch: untag selector addresses before access_ok Gregory Price
2023-03-30 22:40   ` Catalin Marinas
2023-04-04 10:45     ` Oleg Nesterov
2023-04-04 17:33       ` Catalin Marinas [this message]
2023-04-05 10:57         ` Catalin Marinas
2023-04-05 16:02           ` Oleg Nesterov
2023-03-30 21:21 ` [PATCH v15 3/4] ptrace,syscall_user_dispatch: checkpoint/restore support for SUD Gregory Price
2023-03-30 21:21 ` [PATCH v15 4/4] selftest,ptrace: Add selftest for syscall user dispatch config api Gregory Price

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZCxfdC+v4v6EEy4v@arm.com \
    --to=catalin.marinas@arm.com \
    --cc=arnd@arndb.de \
    --cc=avagin@gmail.com \
    --cc=corbet@lwn.net \
    --cc=gourry.memverge@gmail.com \
    --cc=gregory.price@memverge.com \
    --cc=krisman@collabora.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=shuah@kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).