[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAG48ez0FAizJH-4LivpMPSnZqDUeUq0XHf6K8cA4xCqkiPMNYw@mail.gmail.com>
Date: Sat, 8 Sep 2018 02:46:35 +0200
From: Jann Horn <jannh@...gle.com>
To: Dave Hansen <dave.hansen@...ux.intel.com>
Cc: kernel list <linux-kernel@...r.kernel.org>,
sean.j.christopherson@...el.com,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
"the arch/x86 maintainers" <x86@...nel.org>,
Andy Lutomirski <luto@...nel.org>
Subject: Re: [RFC][PATCH 6/8] x86/mm: add vsyscall address helper
On Sat, Sep 8, 2018 at 2:25 AM Dave Hansen <dave.hansen@...ux.intel.com> wrote:
> We will shortly be using this check in two locations. Put it in
> a helper before we do so.
[...]
> +/*
> + * The (legacy) vsyscall page is the long page in the kernel portion
> + * of the address space that has user-accessible permissions.
> + */
> +static bool is_vsyscall_vaddr(unsigned long vaddr)
> +{
> + return (vaddr & ~0xfff) == VSYSCALL_ADDR;
> +}
<bikeshed>
Since you're touching this code anyway: Would it make sense to change
that constant to a more explicit "~0xfffUL" (or alternatively
PAGE_MASK)? I tend to end up staring at code like this forever, trying
to figure out whether the upper 32 bits of the constant end up being
set or clear. As a reader, looking at the current code, it's quite
annoying to see what actually happens - first there's a signed 32-bit
literal 0xfff, then a 32-bit negation happens, and then the number is
converted to 64 bits with sign extension.
</bikeshed>
Powered by blists - more mailing lists