[lkml]   [2021]   [Sep]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 3/3] m68k: leave stack mangling to asm wrapper of sigreturn()
Hi Al,

On 16/09/21 12:19, Al Viro wrote:
> On Thu, Sep 16, 2021 at 11:35:05AM +1200, Michael Schmitz wrote:
>> This one's a little harder - you use a 84 byte gap on each sigreturn, no
>> matter what the frame size we need to restore. The original
>> mangle_kernel_stack() only makes room on the stack when it has no other
>> option (using twice as much size - correct me if I'm wrong).
>> Ideally, we'd only leave a gap for mangle_kernel_stack() to use if the frame
>> size requires us to do so. Working that out in asm glue would be
>> sufficiently convoluted as to cancel out the benefits of cleaning up the C
>> sigreturn part. Probably not worth it.
> You'd need to
> * load the frame type from sigcontext (and deal with EFAULT, etc.)
> * make decision based on that
> * pass the type down into sigreturn(), so we wouldn't run into
> mismatches.
> And all that just to avoid a single "subtract a constant from stack pointer"
> insn. We are on a very shallow kernel stack here - it's a syscall entry,
> after all. And the stack footprint of do_sigreturn() is fairly small - e.g.
> stat(2) eats a lot more.

Thanks, that's what I was wondering. Not worth the extra complexity then.

> We are not initializing the gap either - it's just reserved on stack; we only
> access it if we need to enlarge the stack frame.
> IOW, what would be the benefit of trying to avoid unconditional gap there?

Avoiding a kernel stack overflow - there are comments in the code that
warn against that, but those may be largely historic...



 \ /
  Last update: 2021-09-16 02:56    [W:0.076 / U:2.436 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site