[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87sgdmm8u4.fsf@nanos.tec.linutronix.de>
Date: Mon, 20 Jul 2020 18:48:03 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: Joerg Roedel <joro@...tes.org>
Cc: Arvind Sankar <nivedita@...m.mit.edu>, hpa@...or.com,
Andy Lutomirski <luto@...capital.net>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
x86@...nel.org, Andy Lutomirski <luto@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Joerg Roedel <jroedel@...e.de>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86/idt: Make sure idt_table takes a whole page
Joerg Roedel <joro@...tes.org> writes:
> On Sun, Jul 19, 2020 at 12:39:44PM +0200, Thomas Gleixner wrote:
>> *(.bss..page_aligned) \
>> + . = ALIGN(PAGE_SIZE); \
>> *(.dynbss) \
>> *(BSS_MAIN) \
>> *(COMMON) \
>
> I thougt about that too (and doing the same for .data..page_aligned),
> but decided that 'page_aligned' does not imply 'page_sized', so that
> putting other variables on the same page is fine in general and saves
> some memory. The problem why it breaks here is only because x86 maps a
> variabe which is not page-sized RO, so my thinking was that it should be
> fixed right there, at the variable.
>
> But if the above is fine too I prepare a patch which also aligns the end
> of .data..page_aligned.
If you do
struct foo foo __attribute__ ((aligned(__alignof__(PAGE_SIZE))));
then this ends up page aligned in the data section and the linker can
place another object right next to it.
But with explicit sections which store only page aligned objects there
is an implicit guarantee that the object is alone in the page in which
it is placed. That works for all objects except the last one. That's
inconsistent.
By enforcing page sized objects for this section you might also wreckage
memory sanitizers, because your object is artificially larger than it
should be and out of bound access becomes legit.
Thanks,
tglx
Powered by blists - more mailing lists