lkml.org 
[lkml]   [2015]   [Oct]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v13 13/23] x86/asm/crypto: Create stack frames in aesni-intel_asm.S
On Thu, Oct 01, 2015 at 07:36:54PM +0200, Mathias Krause wrote:
> On Do, Okt 01, 2015 at 08:29:50 -0500, Josh Poimboeuf wrote:
> > On Thu, Oct 01, 2015 at 08:10:26AM +0200, minipli@ld-linux.so wrote:
> > > On Tue, Sep 22, 2015 at 10:47:04AM -0500, Josh Poimboeuf wrote:
> > > > ENTRY(aesni_set_key)
> > > > + FRAME_BEGIN
> > > > #ifndef __x86_64__
> > > > pushl KEYP
> > > > movl 8(%esp), KEYP # ctx
> > >
> > > This will break 32 bit builds using the aesni-intel.ko module. You need
> > > to adjust the esp-based offsets for the non-x86_64 case, as FRAME_BEGIN
> > > may do another push.
> > >
> > > How about adding a FRAME_OFFSET() macro to <asm/frame.h> to wrap the
> > > offsets?:
> > >
> > > #ifdef CONFIG_FRAME_POINTER
> > > # define FRAME_OFFSET(x) ((x) + (BITS_PER_LONG / 8))
> > > #else
> > > # define FRAME_OFFSET(x) (x)
> > > #endif
> > >
> > > And using them like this:
> > >
> > > movl FRAME_OFFSET(8)(%esp), KEYP # ctx
> >
> > Ah, right. The 32-bit ABI passes arguments on the stack instead of via
> > registers.
> >
> > For now, I'm inclined to just make FRAME_BEGIN and FRAME_END do nothing
> > on 32-bit. We're only doing stack validation on x86_64 and I don't know
> > if anybody cares about frame pointers on 32-bit at this point.
>
> Well, we had issues in the past, especially in that very module, but
> only on 32 bit systems. So it would be nice to get frame pointers right
> for 32 bit, too.

Ok, I'll make your suggested changes for this file with FRAME_OFFSET.

(But note that stacktool doesn't currently support 32 bit so it won't
detect any frame pointer issues in 32 bit code.)

--
Josh


\
 
 \ /
  Last update: 2015-10-01 20:01    [W:0.080 / U:0.256 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site