diff mbox series

[v2,1/3] xen/arm: set -mno-unaligned-access compiler option for Arm32

Message ID 20231206071039.24435-2-jgross@suse.com (mailing list archive)
State Superseded
Headers show
Series xen: have a more generic unaligned.h header | expand

Commit Message

Jürgen Groß Dec. 6, 2023, 7:10 a.m. UTC
As the hypervisor is disabling unaligned accesses for Arm32, set the
-mno-unaligned-access compiler option for building. This will prohibit
unaligned accesses when e.g. accessing 2- or 4-byte data items in
packed data structures.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
V2:
- new patch
---
 xen/arch/arm/arch.mk | 1 +
 1 file changed, 1 insertion(+)

Comments

Jan Beulich Dec. 6, 2023, 8:44 a.m. UTC | #1
On 06.12.2023 08:10, Juergen Gross wrote:
> As the hypervisor is disabling unaligned accesses for Arm32, set the
> -mno-unaligned-access compiler option for building. This will prohibit
> unaligned accesses when e.g. accessing 2- or 4-byte data items in
> packed data structures.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>

Assuming this will want backporting, should it have some Fixes: tag?

Jan
Jürgen Groß Dec. 6, 2023, 10 a.m. UTC | #2
On 06.12.23 09:44, Jan Beulich wrote:
> On 06.12.2023 08:10, Juergen Gross wrote:
>> As the hypervisor is disabling unaligned accesses for Arm32, set the
>> -mno-unaligned-access compiler option for building. This will prohibit
>> unaligned accesses when e.g. accessing 2- or 4-byte data items in
>> packed data structures.
>>
>> Signed-off-by: Juergen Gross <jgross@suse.com>
> 
> Assuming this will want backporting, should it have some Fixes: tag?

IMHO this might not be needed, but the Arm maintainers should have the
final say.

This option is especially important after the whole series has been
applied, as get_unaligned() and put_unaligned() can then be used in Arm32
code, too. And without the added option this could cause crashes.


Juergen
Julien Grall Dec. 6, 2023, 10:57 a.m. UTC | #3
Hi Juergen,

On 06/12/2023 10:00, Juergen Gross wrote:
> On 06.12.23 09:44, Jan Beulich wrote:
>> On 06.12.2023 08:10, Juergen Gross wrote:
>>> As the hypervisor is disabling unaligned accesses for Arm32, set the
>>> -mno-unaligned-access compiler option for building. This will prohibit
>>> unaligned accesses when e.g. accessing 2- or 4-byte data items in
>>> packed data structures.
>>>
>>> Signed-off-by: Juergen Gross <jgross@suse.com>
>>
>> Assuming this will want backporting, should it have some Fixes: tag?
> 
> IMHO this might not be needed

You probably miss the discussion between Arnd and I where I pointed out 
that this should fix [1]. I haven't yet tested to confirm.

[1] 
https://lore.kernel.org/xen-devel/c71163f6-2646-6fae-cb22-600eb0486539@xen.org/

> 
> 
> Juergen
Julien Grall Dec. 6, 2023, 7:32 p.m. UTC | #4
On 06/12/2023 10:57, Julien Grall wrote:
> Hi Juergen,
> 
> On 06/12/2023 10:00, Juergen Gross wrote:
>> On 06.12.23 09:44, Jan Beulich wrote:
>>> On 06.12.2023 08:10, Juergen Gross wrote:
>>>> As the hypervisor is disabling unaligned accesses for Arm32, set the
>>>> -mno-unaligned-access compiler option for building. This will prohibit
>>>> unaligned accesses when e.g. accessing 2- or 4-byte data items in
>>>> packed data structures.
>>>>
>>>> Signed-off-by: Juergen Gross <jgross@suse.com>
>>>
>>> Assuming this will want backporting, should it have some Fixes: tag?
>>
>> IMHO this might not be needed
> 
> You probably miss the discussion between Arnd and I where I pointed out 
> that this should fix [1]. I haven't yet tested to confirm.

I can't find the GCC binaries I was using anymore :(. But I still think 
it is a good idea to backport it.

@Stefano can you add it in your list?

Acked-by: Julien Grall <jgrall@amazon.com>

Cheers,
diff mbox series

Patch

diff --git a/xen/arch/arm/arch.mk b/xen/arch/arm/arch.mk
index 58db76c4e1..022dcda192 100644
--- a/xen/arch/arm/arch.mk
+++ b/xen/arch/arm/arch.mk
@@ -7,6 +7,7 @@  $(call cc-option-add,CFLAGS,CC,-Wnested-externs)
 # Prevent floating-point variables from creeping into Xen.
 CFLAGS-$(CONFIG_ARM_32) += -msoft-float
 CFLAGS-$(CONFIG_ARM_32) += -mcpu=cortex-a15
+CFLAGS-$(CONFIG_ARM_32) += -mno-unaligned-access
 
 CFLAGS-$(CONFIG_ARM_64) += -mcpu=generic
 CFLAGS-$(CONFIG_ARM_64) += -mgeneral-regs-only # No fp registers etc