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-next>] [day] [month] [year] [list]
Message-Id: <20180222104101.2717185-1-arnd@arndb.de>
Date:   Thu, 22 Feb 2018 11:40:41 +0100
From:   Arnd Bergmann <arnd@...db.de>
To:     Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, x86@...nel.org,
        "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
Cc:     Arnd Bergmann <arnd@...db.de>, Martin Sebor <msebor@...il.com>,
        "H. Peter Anvin" <hpa@...or.com>, linux-kernel@...r.kernel.org
Subject: [PATCH] x86/boot/compressed/64: fix warning for 32-bit trampoline copy

gcc-8 warns that we copy TRAMPOLINE_32BIT_CODE_SIZE bytes from the pointer
to the function into actual trampoline, when that pointer is only 8 bytes:

In file included from arch/x86/boot/compressed/pgtable_64.c:3:
arch/x86/boot/compressed/pgtable_64.c: In function 'paging_prepare':
arch/x86/boot/compressed/../string.h:18:23: error: '__builtin_memcpy' reading 96 bytes from a region of size 8 [-Werror=stringop-overflow=]
 #define memcpy(d,s,l) __builtin_memcpy(d,s,l)
                       ^~~~~~~~~~~~~~~~~~~~~~~
arch/x86/boot/compressed/pgtable_64.c:62:2: note: in expansion of macro 'memcpy'
  memcpy(trampoline + TRAMPOLINE_32BIT_CODE_OFFSET / sizeof(unsigned long),
  ^~~~~~

I assume what was intended here is to copy the trampoline itself rather than
the pointer to the trampoline.

Cc: Martin Sebor <msebor@...il.com>
Fixes: b91993a87aff ("x86/boot/compressed/64: Prepare trampoline memory")
Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
This is a fairly new warning in gcc, it's possible that the code is
correct and the warning message got it wrong, please double-check this.

Was the 32-bit trampoline code in the 64-bit decompressor tested successfully?
---
 arch/x86/boot/compressed/pgtable_64.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/boot/compressed/pgtable_64.c b/arch/x86/boot/compressed/pgtable_64.c
index dad5da7b4c1a..35a0542fe397 100644
--- a/arch/x86/boot/compressed/pgtable_64.c
+++ b/arch/x86/boot/compressed/pgtable_64.c
@@ -60,7 +60,7 @@ struct paging_config paging_prepare(void)
 
 	/* Copy trampoline code in place */
 	memcpy(trampoline + TRAMPOLINE_32BIT_CODE_OFFSET / sizeof(unsigned long),
-			&trampoline_32bit_src, TRAMPOLINE_32BIT_CODE_SIZE);
+			trampoline_32bit_src, TRAMPOLINE_32BIT_CODE_SIZE);
 
 	/*
 	 * Set up a new page table that will be used for switching from 4-
-- 
2.9.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ