Skip to content

Commit a86255f

Browse files
nivedita76suryasaimadhu
authored andcommitted
x86/boot/compressed/64: Use 32-bit (zero-extended) MOV for z_output_len
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 is already done for z_input_len, the size of the compressed payload. [ bp: Also, z_output_len cannot be a 64-bit quantity because it participates in: init_size: .long INIT_SIZE # kernel initialization size through INIT_SIZE which is a 32-bit quantity determined by the .long directive (vs .quad for 64-bit). Furthermore, if it really must be a 64-bit quantity, then the insn must be MOVABS which can accommodate a 64-bit immediate and which the toolchain does not generate automatically. ] Signed-off-by: Arvind Sankar <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 48bfdb9 commit a86255f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/boot/compressed/head_64.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ SYM_FUNC_START_LOCAL_NOALIGN(.Lrelocated)
482482
leaq input_data(%rip), %rdx /* input_data */
483483
movl $z_input_len, %ecx /* input_len */
484484
movq %rbp, %r8 /* output target address */
485-
movq $z_output_len, %r9 /* decompressed length, end of relocs */
485+
movl $z_output_len, %r9d /* decompressed length, end of relocs */
486486
call extract_kernel /* returns kernel location in %rax */
487487
popq %rsi
488488

0 commit comments

Comments
 (0)