[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YUKNn3erTbH+ytpM@zeniv-ca.linux.org.uk>
Date: Thu, 16 Sep 2021 00:19:43 +0000
From: Al Viro <viro@...iv.linux.org.uk>
To: Michael Schmitz <schmitzmic@...il.com>
Cc: linux-m68k@...ts.linux-m68k.org,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Greg Ungerer <gerg@...ux-m68k.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] m68k: leave stack mangling to asm wrapper of
sigreturn()
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.
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?
Powered by blists - more mailing lists