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 <[email protected]>
> > > 
> > > 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

Reply via email to