Skip to content

Commit c567de2

Browse files
hdellerjrjohansen
authored andcommitted
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 <[email protected]> Cc: [email protected] Fixes: 98b824f ("apparmor: refcount the pdb") Signed-off-by: John Johansen <[email protected]>
1 parent 3fa0af4 commit c567de2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

security/apparmor/lsm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2404,12 +2404,12 @@ static int __init apparmor_nf_ip_init(void)
24042404
__initcall(apparmor_nf_ip_init);
24052405
#endif
24062406

2407-
static char nulldfa_src[] = {
2407+
static char nulldfa_src[] __aligned(8) = {
24082408
#include "nulldfa.in"
24092409
};
24102410
static struct aa_dfa *nulldfa;
24112411

2412-
static char stacksplitdfa_src[] = {
2412+
static char stacksplitdfa_src[] __aligned(8) = {
24132413
#include "stacksplitdfa.in"
24142414
};
24152415
struct aa_dfa *stacksplitdfa;

0 commit comments

Comments
 (0)