apparmor: Fix 8-byte alignment for initial dfa blob streams
authorHelge Deller <deller@gmx.de>
Sat, 31 May 2025 15:08:21 +0000 (17:08 +0200)
committerJohn Johansen <john.johansen@canonical.com>
Sun, 20 Jul 2025 09:19:27 +0000 (02:19 -0700)
commitc567de2c4f5fe6e079672e074e1bc6122bf7e444
tree11f2bfd101cca32f7b927e9e9b48bebac52f16c1
parent3fa0af4cc8a31d4139ee85a7b0e3d9b4f37b3093
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>
security/apparmor/lsm.c