public inbox for linux-security-module@vger.kernel.org
 help / color / mirror / Atom feed
From: Helge Deller <deller@gmx.de>
To: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>,
	Helge Deller <deller@kernel.org>,
	John Johansen <john.johansen@canonical.com>,
	david laight <david.laight@runbox.com>
Cc: linux-kernel@vger.kernel.org, apparmor@lists.ubuntu.com,
	linux-security-module@vger.kernel.org,
	linux-parisc@vger.kernel.org
Subject: Re: [PATCH 0/2] apparmor unaligned memory fixes
Date: Wed, 26 Nov 2025 17:58:55 +0100	[thread overview]
Message-ID: <0d03ddb9-d01f-435e-a57c-fbea32844b66@gmx.de> (raw)
In-Reply-To: <78f1ff26f06c0e61d71c1a7f05a7c03c4ec03bef.camel@physik.fu-berlin.de>

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@gmx.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

  reply	other threads:[~2025-11-26 16:59 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-31 15:08 [PATCH 0/2] apparmor unaligned memory fixes deller
2025-05-31 15:08 ` [PATCH 1/2] apparmor: Fix 8-byte alignment for initial dfa blob streams deller
2025-05-31 15:08 ` [PATCH 2/2] apparmor: Fix unaligned memory accesses in KUnit test deller
2025-11-18  9:04 ` [PATCH 0/2] apparmor unaligned memory fixes John Paul Adrian Glaubitz
2025-11-18 11:09   ` Helge Deller
2025-11-18 11:43     ` John Paul Adrian Glaubitz
2025-11-18 12:49       ` Helge Deller
2025-11-23  2:08         ` John Johansen
2025-11-25 15:11           ` Helge Deller
2025-11-25 19:20             ` John Johansen
2025-11-25 21:13               ` Helge Deller
2025-11-26  9:11                 ` John Johansen
2025-11-26 10:44                   ` david laight
2025-11-26 11:03                     ` Helge Deller
2025-11-26 11:31                       ` Helge Deller
2025-11-26 16:16                         ` John Paul Adrian Glaubitz
2025-11-26 16:58                           ` Helge Deller [this message]
2025-11-26 17:26                             ` John Paul Adrian Glaubitz
2025-11-26 14:22                       ` david laight
2025-11-26 15:12                         ` Helge Deller
2025-11-26 19:33                           ` John Johansen
2025-11-26 20:15                             ` Helge Deller
2025-11-26 21:10                               ` John Johansen
2025-11-27  9:25                               ` John Paul Adrian Glaubitz
2025-11-27  9:43                                 ` John Paul Adrian Glaubitz
2025-11-28  9:54                               ` John Paul Adrian Glaubitz
2025-11-26 21:23                           ` david laight
2025-11-26 22:18                             ` John Johansen
2025-11-26 19:22                     ` John Johansen
2025-11-26  7:27             ` John Paul Adrian Glaubitz
2025-11-26  7:52             ` John Paul Adrian Glaubitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0d03ddb9-d01f-435e-a57c-fbea32844b66@gmx.de \
    --to=deller@gmx.de \
    --cc=apparmor@lists.ubuntu.com \
    --cc=david.laight@runbox.com \
    --cc=deller@kernel.org \
    --cc=glaubitz@physik.fu-berlin.de \
    --cc=john.johansen@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox