lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 13 Jan 2016 12:14:01 +0100
From:	Ard Biesheuvel <ard.biesheuvel@...aro.org>
To:	Mark Rutland <mark.rutland@....com>
Cc:	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>,
	kernel-hardening@...ts.openwall.com,
	Will Deacon <will.deacon@....com>,
	Catalin Marinas <catalin.marinas@....com>,
	Leif Lindholm <leif.lindholm@...aro.org>,
	Kees Cook <keescook@...omium.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Stuart Yoder <stuart.yoder@...escale.com>,
	Sharma Bhupesh <bhupesh.sharma@...escale.com>,
	Arnd Bergmann <arnd@...db.de>,
	Marc Zyngier <marc.zyngier@....com>,
	Christoffer Dall <christoffer.dall@...aro.org>
Subject: Re: [PATCH v3 07/21] arm64: move kernel image to base of vmalloc area

On 13 January 2016 at 12:11, Mark Rutland <mark.rutland@....com> wrote:
> On Wed, Jan 13, 2016 at 10:58:55AM +0100, Ard Biesheuvel wrote:
>> On 13 January 2016 at 09:39, Ard Biesheuvel <ard.biesheuvel@...aro.org> wrote:
>> > On 12 January 2016 at 19:14, Mark Rutland <mark.rutland@....com> wrote:
>> >> On Mon, Jan 11, 2016 at 02:19:00PM +0100, Ard Biesheuvel wrote:
>> >>> @@ -438,12 +442,29 @@ static void __init map_kernel(pgd_t *pgd)
>> >>>       map_kernel_chunk(pgd, __init_begin, __init_end, PAGE_KERNEL_EXEC);
>> >>>       map_kernel_chunk(pgd, _data, _end, PAGE_KERNEL);
>> >>>
>> >>> -     /*
>> >>> -      * The fixmap falls in a separate pgd to the kernel, and doesn't live
>> >>> -      * in the carveout for the swapper_pg_dir. We can simply re-use the
>> >>> -      * existing dir for the fixmap.
>> >>> -      */
>> >>> -     set_pgd(pgd_offset_raw(pgd, FIXADDR_START), *pgd_offset_k(FIXADDR_START));
>> >>> +     if (pgd_index(FIXADDR_START) != pgd_index((u64)_end)) {
>> >>
>> >> To match the style of early_fixmap_init, and given we already mapped the
>> >> kernel image, this could be:
>> >>
>> >>         if (pgd_none(pgd_offset_raw(pgd, FIXADDR_START))) {
>> >>
>> >> Which also serves as a run-time check that the pgd entry really was
>> >> clear.
>> >>
>> >
>> > Yes, that looks better. I will steal that :-)
>> >
>>
>> OK, that doesn't work. pgd_none() is hardcoded to 'false' when running
>> with fewer than 4 pgtable levels, and so we always hit the BUG() here.
>
> Ah, sorry.
>
> We could also check CONFIG_PGTABLE_LEVELS > 3 check, as with
> fixmap_init, perhaps?
>

I'm using this now:

if (!pgd_val(*pgd_offset_raw(pgd, FIXADDR_START))) {

which I think is appropriate, since we don't expect to share any top
level entry, folded or not.

-- 
Ard.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ