Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

apparmor: Fix 8-byte alignment for initial dfa blob streams

The dfa blob stream for the aa_dfa_unpack() function is expected to be aligned
on a 8 byte boundary.

The static nulldfa_src[] and stacksplitdfa_src[] arrays store the initial
apparmor dfa blob streams, but since they are declared as an array-of-chars
the compiler and linker will only ensure a "char" (1-byte) alignment.

Add an __aligned(8) annotation to the arrays to tell the linker to always
align them on a 8-byte boundary. This avoids runtime warnings at startup on
alignment-sensitive platforms like parisc such as:

Kernel: unaligned access to 0x7f2a584a in aa_dfa_unpack+0x124/0x788 (iir 0xca0109f)
Kernel: unaligned access to 0x7f2a584e in aa_dfa_unpack+0x210/0x788 (iir 0xca8109c)
Kernel: unaligned access to 0x7f2a586a in aa_dfa_unpack+0x278/0x788 (iir 0xcb01090)

Signed-off-by: Helge Deller <deller@gmx.de>
Cc: stable@vger.kernel.org
Fixes: 98b824ff8984 ("apparmor: refcount the pdb")
Signed-off-by: John Johansen <john.johansen@canonical.com>

authored by

Helge Deller and committed by
John Johansen
c567de2c 3fa0af4c

+2 -2
+2 -2
security/apparmor/lsm.c
··· 2404 2404 __initcall(apparmor_nf_ip_init); 2405 2405 #endif 2406 2406 2407 - static char nulldfa_src[] = { 2407 + static char nulldfa_src[] __aligned(8) = { 2408 2408 #include "nulldfa.in" 2409 2409 }; 2410 2410 static struct aa_dfa *nulldfa; 2411 2411 2412 - static char stacksplitdfa_src[] = { 2412 + static char stacksplitdfa_src[] __aligned(8) = { 2413 2413 #include "stacksplitdfa.in" 2414 2414 }; 2415 2415 struct aa_dfa *stacksplitdfa;