[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0d03ddb9-d01f-435e-a57c-fbea32844b66@gmx.de>
Date: Wed, 26 Nov 2025 17:58:55 +0100
From: Helge Deller <deller@....de>
To: John Paul Adrian Glaubitz <glaubitz@...sik.fu-berlin.de>,
Helge Deller <deller@...nel.org>, John Johansen
<john.johansen@...onical.com>, david laight <david.laight@...box.com>
Cc: linux-kernel@...r.kernel.org, apparmor@...ts.ubuntu.com,
linux-security-module@...r.kernel.org, linux-parisc@...r.kernel.org
Subject: Re: [PATCH 0/2] apparmor unaligned memory fixes
On 11/26/25 17:16, John Paul Adrian Glaubitz wrote:
> Hi Helge,
>
> On Wed, 2025-11-26 at 12:31 +0100, Helge Deller wrote:
>> Like this (untested!) patch:
>>
>> [PATCH] apparmor: Optimize table creation from possibly unaligned memory
>>
>> Source blob may come from userspace and might be unaligned.
>> Try to optize the copying process by avoiding unaligned memory accesses.
>>
>> Signed-off-by: Helge Deller <deller@....de>
>>
>> diff --git a/security/apparmor/include/match.h b/security/apparmor/include/match.h
>> index 1fbe82f5021b..225df6495c84 100644
>> --- a/security/apparmor/include/match.h
>> +++ b/security/apparmor/include/match.h
>> @@ -111,9 +111,14 @@ struct aa_dfa {
>> typeof(LEN) __i; \
>> TTYPE *__t = (TTYPE *) TABLE; \
>> BTYPE *__b = (BTYPE *) BLOB; \
>> - for (__i = 0; __i < LEN; __i++) { \
>> - __t[__i] = NTOHX(__b[__i]); \
>> - } \
>> + BUILD_BUG_ON(sizeof(TTYPE) != sizeof(BTYPE)); \
>> + /* copy to naturally aligned table address */ \
>> + memcpy(__t, __b, (LEN) * sizeof(BTYPE)); \
>> + /* convert from big-endian if necessary */ \
>> + if (!IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)) \
>> + for (__i = 0; __i < LEN; __i++, __t++) { \
>> + *__t = NTOHX(*__t); \
>> + } \
>> } while (0)
>>
>> static inline size_t table_size(size_t len, size_t el_size)
>
> So, is this patch supposed to replace all the other proposed patches?
It just replaces the patch from John.
But please test the v2 patch I sent instead...
Helge
Powered by blists - more mailing lists