From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Andy Lutomirski <luto@kernel.org>,
Lukas Bulwahn <lukas.bulwahn@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
X86 ML <x86@kernel.org>, Akinobu Mita <akinobu.mita@gmail.com>,
Joerg Roedel <jroedel@suse.de>, "H . Peter Anvin" <hpa@zytor.com>,
<kernel-janitors@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] x86/cpu: correct values for GDT_ENTRY_INIT
Date: Thu, 26 Nov 2020 23:52:08 +0000 [thread overview]
Message-ID: <3d9f41b1-9687-4aae-ad7d-2e38a33132ba@citrix.com> (raw)
In-Reply-To: <CALCETrUyoaJyJ8mGpq9bdanKKfHgjg_1B=N0rtmuHCmCP9Q9=g@mail.gmail.com>
On 26/11/2020 19:15, Andy Lutomirski wrote:
> On Thu, Nov 26, 2020 at 11:07 AM Lukas Bulwahn <lukas.bulwahn@gmail.com> wrote:
>> On Thu, Nov 26, 2020 at 6:16 PM Andrew Cooper <andrew.cooper3@citrix.com> wrote:
>>> On 26/11/2020 11:54, Lukas Bulwahn wrote:
>>>> Commit 1e5de18278e6 ("x86: Introduce GDT_ENTRY_INIT()") unintentionally
>>>> transformed a few 0xffff values to 0xfffff (note: five times "f" instead of
>>>> four) as part of the refactoring.
>>> The transformation in that change is correct.
>>>
>>> Segment bases are 20 bits wide in x86,
I of course meant segment limits here, rather than bases.
>>> Does:
>>>
>>> diff --git a/arch/x86/include/asm/desc_defs.h
>>> b/arch/x86/include/asm/desc_defs.h
>>> index f7e7099af595..9561f3c66e9e 100644
>>> --- a/arch/x86/include/asm/desc_defs.h
>>> +++ b/arch/x86/include/asm/desc_defs.h
>>> @@ -22,7 +22,7 @@ struct desc_struct {
>>>
>>> #define GDT_ENTRY_INIT(flags, base, limit) \
>>> { \
>>> - .limit0 = (u16) (limit), \
>>> + .limit0 = (u16) (limit) & 0xFFFF, \
>>> .limit1 = ((limit) >> 16) & 0x0F, \
>>> .base0 = (u16) (base), \
>>> .base1 = ((base) >> 16) & 0xFF, \
>>>
>>> fix the warning?
>>>
>> Thanks, I will try that out, and try compiling a 32-bit kernel as well.
> You should also try comparing the objdump output before and after your
> patch. objdump -D will produce bizarre output but should work.
Expanding on this a little, if that does indeed fix the sparse warning,
then I'd make an argument for this being a bug in sparse. Explicitly
casting to u16 is semantically and intentionally identical to & 0xffff.
~Andrew
next prev parent reply other threads:[~2020-11-26 23:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-26 11:54 Lukas Bulwahn
2020-11-26 17:16 ` Andrew Cooper
2020-11-26 19:07 ` Lukas Bulwahn
2020-11-26 19:15 ` Andy Lutomirski
2020-11-26 23:52 ` Andrew Cooper [this message]
2020-11-27 11:25 ` David Laight
2020-11-30 2:28 ` [x86/cpu] 3d5f2fa9fa: Kernel_panic-not_syncing:Attempted_to_kill_init!exitcode= kernel test robot
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=3d9f41b1-9687-4aae-ad7d-2e38a33132ba@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=akinobu.mita@gmail.com \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=jroedel@suse.de \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lukas.bulwahn@gmail.com \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@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
all inboxes | Powered by JetHome®