linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Arvind Sankar <nivedita@alum.mit.edu>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org,
	Michael Matz <matz@suse.de>
Subject: Re: [PATCH v2] x86/boot: Use 32-bit (zero-extended) move for z_output_len
Date: Tue, 11 Feb 2020 19:15:59 +0100	[thread overview]
Message-ID: <20200211181559.GI32279@zn.tnic> (raw)
In-Reply-To: <20200211173333.1722739-1-nivedita@alum.mit.edu>

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

  reply	other threads:[~2020-02-11 18:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-07 19:44 [PATCH 1/3] x86/boot/compressed/32: Simplify calculation of output address Arvind Sankar
2020-01-07 19:44 ` [PATCH 2/3] x86/boot/compressed/64: Use leal to initialize boot stack pointer Arvind Sankar
2020-02-12 12:04   ` [tip: x86/boot] x86/boot/compressed/64: Use LEA " tip-bot2 for Arvind Sankar
2020-01-07 19:44 ` [PATCH 3/3] x86/boot/compressed/64: Use 32-bit move for z_output_len Arvind Sankar
2020-02-11 16:17   ` Borislav Petkov
2020-02-11 17:33     ` [PATCH v2] x86/boot: Use 32-bit (zero-extended) " Arvind Sankar
2020-02-11 18:15       ` Borislav Petkov [this message]
2020-02-11 19:27         ` Arvind Sankar
2020-02-12  9:47           ` Borislav Petkov
2020-02-12 12:04       ` [tip: x86/boot] x86/boot/compressed/64: Use 32-bit (zero-extended) MOV " tip-bot2 for Arvind Sankar
2020-01-23 11:04 ` [tip: x86/asm] x86/boot: Simplify calculation of output address tip-bot2 for Arvind Sankar

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=20200211181559.GI32279@zn.tnic \
    --to=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matz@suse.de \
    --cc=mingo@redhat.com \
    --cc=nivedita@alum.mit.edu \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --subject='Re: [PATCH v2] x86/boot: Use 32-bit (zero-extended) move for z_output_len' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).