Received: from list by lists.gnu.org with archive (Exim 4.71) id 1XrvPX-0004DU-Is for mharc-grub-devel@gnu.org; Fri, 21 Nov 2014 16:06:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54849) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XrvPU-0004A2-0V for grub-devel@gnu.org; Fri, 21 Nov 2014 16:06:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XrvPT-0004Co-1L for grub-devel@gnu.org; Fri, 21 Nov 2014 16:06:31 -0500 Received: from mail-wi0-x234.google.com ([2a00:1450:400c:c05::234]:42722) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XrvPS-0004Cc-QP for grub-devel@gnu.org; Fri, 21 Nov 2014 16:06:30 -0500 Received: by mail-wi0-f180.google.com with SMTP id n3so502245wiv.7 for ; Fri, 21 Nov 2014 13:06:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:date:subject:to:message-id; bh=Z7eZO9mq5rngp6N7wOD+KkDd4IgDDt7/5KSrDA+NFNw=; b=uM4ScjgXP3ezQsU/LC43Bvp8q3ERprXe2ss3ngbDlIDtGWTFh8mqwR5/HKd8qOOb8P RVR3AdXt4CU73lKbR7kvupFL7dLjZzpTau1QOtxyRzhdx91N/qhAxQfc47yfPrtoUCn9 D0n8az5IcyuYkZ4aSvAQ6p/gxRdoF8r9DATWEk+N2prJPBmIbnSUyxBb9xsVfVb8rNEE hVXkQjD0rT3LFt0gBR4Au8h5UIauePr4usAn7ejHOUCBLGwWkqeVG6bP1em6LefK+qe7 RyOTFhtD0qm3CBvCn3skiIBAQ7cb4RvVn+xIK4FCXTY2pYf0WQIbsKkxcA82IMDHvBgY 4+aQ== X-Received: by 10.194.184.199 with SMTP id ew7mr11549991wjc.85.1416603990113; Fri, 21 Nov 2014 13:06:30 -0800 (PST) Received: from humel ([2002:59b0:dbd::1]) by mx.google.com with ESMTPSA id ga1sm674491wib.1.2014.11.21.13.06.29 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Nov 2014 13:06:29 -0800 (PST) Received: from zub by humel with local (Exim 4.84) (envelope-from ) id 1XrvPQ-0003ij-5U for grub-devel@gnu.org; Fri, 21 Nov 2014 22:06:28 +0100 From: David Kozub Date: Thu, 20 Nov 2014 21:53:14 +0100 Subject: [PATCH] grub-core/kern/arm/misc.S: fix unaligned grub_uint64_t local variable To: grub-devel@gnu.org Message-Id: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::234 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Nov 2014 21:06:33 -0000 The unaligned local in __aeabi_uidivmod leads to a store to a 64bit value at an address that is not divisible by 8 (in grub_divmod64). The compiler most likely generates a STRD instruction to store it and this causes an exception. Fixes Savannah bug #43632. This includes improvements done by Leif Lindholm. --- ChangeLog | 6 ++++++ grub-core/kern/arm/misc.S | 14 +++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6fbec06..8728c04 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2014-11-21 David Kozub + + * grub-core/kern/arm/misc.S: fix unaligned 64bit local variable + in __aeabi_uidivmod + Fixes Savannah bug #43632. + 2014-11-20 Andrei Borzenkov * tests/util/grub-fs-tester.in: Consistently print output diff --git a/grub-core/kern/arm/misc.S b/grub-core/kern/arm/misc.S index 8943cc3..16b6f8e 100644 --- a/grub-core/kern/arm/misc.S +++ b/grub-core/kern/arm/misc.S @@ -60,17 +60,17 @@ FUNCTION(__aeabi_lmul) .macro division parent - stmfd sp!, {lr} - sub sp, sp, #12 + sub sp, sp, #8 @ Allocate naturally aligned 64-bit space + stmfd sp!, {r3,lr} @ Dummy r3 to maintain stack alignment + add r3, sp, #8 @ Set r3 to address of 64-bit space + str r3, [sp] @ Stack parameter, pointer to 64-bit space mov r2, r1 - add r1, sp, #4 - str r1, [sp, #0] mov r1, #0 mov r3, #0 bl \parent - ldr r1, [sp, #4] - add sp, sp, #12 - ldmfd sp!, {lr} + ldr r1, [sp, #8] @ Extract remainder + ldmfd sp!, {r3,lr} @ Pop into an unused arg/scratch register + add sp, sp, #8 bx lr .endm -- 2.1.1