[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <85864bcfa48fe341c655ebcd4c7d53ae1e0c1d74.camel@physik.fu-berlin.de>
Date: Wed, 26 Nov 2025 18:26:51 +0100
From: John Paul Adrian Glaubitz <glaubitz@...sik.fu-berlin.de>
To: Helge Deller <deller@....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
Hi Helge,
On Wed, 2025-11-26 at 17:58 +0100, Helge Deller wrote:
> 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...
OK, so we need your previous patch that I already tested and your v2 of John's patch?
Adrian
--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer
`. `' Physicist
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
Powered by blists - more mailing lists