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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200211181559.GI32279@zn.tnic>
Date:   Tue, 11 Feb 2020 19:15:59 +0100
From:   Borislav Petkov <bp@...en8.de>
To:     Arvind Sankar <nivedita@...m.mit.edu>
Cc:     Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>,
        "H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
        linux-kernel@...r.kernel.org, Michael Matz <matz@...e.de>
Subject: Re: [PATCH v2] x86/boot: Use 32-bit (zero-extended) move for
 z_output_len

On Tue, Feb 11, 2020 at 12:33:33PM -0500, Arvind Sankar wrote:
> z_output_len is the size of the decompressed payload (i.e. vmlinux +
> vmlinux.relocs) and is generated as an unsigned 32-bit quantity by
> mkpiggy.c.
> 
> The current movq $z_output_len, %r9 instruction generates a
> sign-extended move to %r9. Using movl $z_output_len, %r9d will instead
> zero-extend into %r9, which is appropriate for an unsigned 32-bit
> quantity. This is also what we already do for z_input_len, the size of
> the compressed payload.

Yes, thanks.

What I'll also add to this is the fact that

init_size:              .long INIT_SIZE         # kernel initialization size

where z_output_len participates in through INIT_SIZE is a 32-bit
quantity determined by the ".long" so even if something made
z_output_len bigger than 32-bit by explicitly using MOVABS so that it
builds fine, you'd still get:

arch/x86/boot/header.S: Assembler messages:
arch/x86/boot/header.S:568: Warning: value 0x10103b000 truncated to 0x103b000

as a warning.

Btw, while poking at this, we found out that the MOV really remains
MOV and not MOVABS if gas doesn't know what the quantity behind the
z_output_len symbol is, as it is a symbol assignment. Which, AFAIU, with
ELF64 objects, it should be using 8-byte quantities in the symbol table
to accommodate such assignments. But for some reason it doesn't.

Anyway, Michael can correct me if I'm still imprecise here.

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ