From: Dave Martin <Dave.Martin@arm.com>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>,
Andrey Konovalov <andreyknvl@google.com>,
Jan Stancek <jstancek@redhat.com>,
Vincenzo Frascino <Vincenzo.Frascino@arm.com>,
CKI Project <cki-project@redhat.com>,
LTP List <ltp@lists.linux.it>,
Linux Stable maillist <stable@vger.kernel.org>,
Memory Management <mm-qe@redhat.com>,
Szabolcs Nagy <Szabolcs.Nagy@arm.com>
Subject: Re: ? FAIL: Test report for kernel 5.4.0-rc2-d6c2c23.cki (stable-next)
Date: Wed, 16 Oct 2019 17:35:29 +0100 [thread overview]
Message-ID: <20191016163528.GA27757@arm.com> (raw)
In-Reply-To: <20191016145238.GL49619@arrakis.emea.arm.com>
On Wed, Oct 16, 2019 at 03:52:38PM +0100, Catalin Marinas wrote:
> On Wed, Oct 16, 2019 at 03:44:25PM +0100, Dave P Martin wrote:
> > On Wed, Oct 16, 2019 at 05:29:33AM +0100, Will Deacon wrote:
> > > diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h
> > > index b61b50bf68b1..c23c47360664 100644
> > > --- a/arch/arm64/include/asm/memory.h
> > > +++ b/arch/arm64/include/asm/memory.h
> > > @@ -215,12 +215,18 @@ static inline unsigned long kaslr_offset(void)
> > > * up with a tagged userland pointer. Clear the tag to get a sane pointer to
> > > * pass on to access_ok(), for instance.
> > > */
> > > -#define untagged_addr(addr) \
> > > +#define __untagged_addr(addr) \
> > > ((__force __typeof__(addr))sign_extend64((__force u64)(addr), 55))
> > >
> > > +#define untagged_addr(addr) ({ \
> >
> > Having the same informal name ("untagged") for two different address
> > representations seems like a recipe for confusion. Can we rename one of
> > them? (Say, untagged_address_if_user()?)
>
> I agree it's confusing. We can rename the __* one but the other is
> spread around the kernel (it can be done, though as a subsequent
> exercise; untagged_uaddr?).
>
> > > + __addr &= __untagged_addr(__addr); \
> > > + (__force __typeof__(addr))__addr; \
> > > +})
> >
> > Is there any reason why we can't just have
> >
> > #define untagged_addr ((__force __typeof__(addr))( \
> > (__force u64)(addr) & GENMASK_ULL(63, 56)))
>
> I guess you meant ~GENMASK_ULL(63,56) or GENMASK_ULL(55,0).
>
> This changes the overflow case for mlock() which would return -ENOMEM
> instead of -EINVAL (not sure we have a test for it though). Does it
> matter?
It looks like SUSv7 has m{,un}local() and mprotect() aligned with one
another regarding ENOMEM versus EINVAL:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/mprotect.html
https://pubs.opengroup.org/onlinepubs/9699919799/functions/mlock.html
So whatever we do, it should probably have the same effect on both
calls.
There's another wrinkle that occurrs to me though. Rounding "kernel"
addresses up can spuriously change ENOMEM to EINVAL -- but the fix for
userspace addresses (i.e., rounding down) can likewise spuriously change
EINVAL to ENOMEM.
Maybe this is OK -- the SUSv7 wording doesn't seem to call out address
wraparound as a special case, and therefore supposedly doesn't require
EINVAL to be returned for it.
The asymmetry is concerning though, and a bit ugly.
Cheers
---Dave
next prev parent reply other threads:[~2019-10-16 16:35 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-14 2:19 ❌ FAIL: Test report for kernel 5.4.0-rc2-d6c2c23.cki (stable-next) CKI Project
2019-10-14 7:28 ` Jan Stancek
2019-10-14 12:54 ` Andrey Konovalov
2019-10-14 16:26 ` Catalin Marinas
2019-10-14 21:33 ` Will Deacon
2019-10-15 15:26 ` Catalin Marinas
2019-10-15 16:02 ` Vincenzo Frascino
2019-10-15 16:14 ` Will Deacon
2019-10-16 4:29 ` Will Deacon
2019-10-16 8:12 ` Catalin Marinas
2019-10-16 8:18 ` Vincenzo Frascino
2019-10-16 13:55 ` Andrey Konovalov
2019-10-16 14:38 ` Jan Stancek
2019-10-16 14:44 ` ? " Dave Martin
2019-10-16 14:52 ` Catalin Marinas
2019-10-16 16:35 ` Dave Martin [this message]
2019-10-16 18:10 ` Szabolcs Nagy
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=20191016163528.GA27757@arm.com \
--to=dave.martin@arm.com \
--cc=Szabolcs.Nagy@arm.com \
--cc=Vincenzo.Frascino@arm.com \
--cc=andreyknvl@google.com \
--cc=catalin.marinas@arm.com \
--cc=cki-project@redhat.com \
--cc=jstancek@redhat.com \
--cc=ltp@lists.linux.it \
--cc=mm-qe@redhat.com \
--cc=stable@vger.kernel.org \
--cc=will@kernel.org \
/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).