On Wed, Jun 16, 2021 at 01:32:50PM -0500, Eric W. Biederman wrote:
> -.macro fork_like name
> +.macro allregs name
> .align 4
> .globl alpha_\name
> .ent alpha_\name
> + .cfi_startproc
> alpha_\name:
> .prologue 0
> - bsr $1, do_switch_stack
> + SAVE_SWITCH_STACK
> jsr $26, sys_\name
> - ldq $26, 56($sp)
> - lda $sp, SWITCH_STACK_SIZE($sp)
> + RESTORE_SWITCH_STACK
No. You've just added one hell of an overhead to fork(2),
for no reason whatsoever. sys_fork() et.al. does *NOT* modify the
callee-saved registers; it's plain C. So this change is complete
BS.
> +allregs exit
> +allregs exit_group
Details, please - what exactly makes exit(2) different from
e.g. open(2)?
On Wed, Jun 16, 2021 at 08:25:35PM +0000, Al Viro wrote:
> On Wed, Jun 16, 2021 at 01:32:50PM -0500, Eric W. Biederman wrote:
>
> > -.macro fork_like name
> > +.macro allregs name
> > .align 4
> > .globl alpha_\name
> > .ent alpha_\name
> > + .cfi_startproc
> > alpha_\name:
> > .prologue 0
> > - bsr $1, do_switch_stack
> > + SAVE_SWITCH_STACK
> > jsr $26, sys_\name
> > - ldq $26, 56($sp)
> > - lda $sp, SWITCH_STACK_SIZE($sp)
> > + RESTORE_SWITCH_STACK
>
> No. You've just added one hell of an overhead to fork(2),
> for no reason whatsoever. sys_fork() et.al. does *NOT* modify the
> callee-saved registers; it's plain C. So this change is complete
> BS.
>
> > +allregs exit
> > +allregs exit_group
>
> Details, please - what exactly makes exit(2) different from
> e.g. open(2)?
Ah... PTRACE_EVENT_EXIT garbage, fortunately having no counterparts in case of
open(2)... Still, WTF would you want to restore callee-saved registers for
in case of exit(2)?
Al Viro <[email protected]> writes:
> On Wed, Jun 16, 2021 at 01:32:50PM -0500, Eric W. Biederman wrote:
>
>> -.macro fork_like name
>> +.macro allregs name
>> .align 4
>> .globl alpha_\name
>> .ent alpha_\name
>> + .cfi_startproc
>> alpha_\name:
>> .prologue 0
>> - bsr $1, do_switch_stack
>> + SAVE_SWITCH_STACK
>> jsr $26, sys_\name
>> - ldq $26, 56($sp)
>> - lda $sp, SWITCH_STACK_SIZE($sp)
>> + RESTORE_SWITCH_STACK
>
> No. You've just added one hell of an overhead to fork(2),
> for no reason whatsoever. sys_fork() et.al. does *NOT* modify the
> callee-saved registers; it's plain C. So this change is complete
> BS.
Fork already saves the registers, all I did was restore them. Which
makes a debugger that modifies them in
PTRACE_EVENT_{FORK,VFORK,CLONE,VFORK_DONE} work.
>> +allregs exit
>> +allregs exit_group
>
> Details, please - what exactly makes exit(2) different from
> e.g. open(2)?
PTRACE_EVENT_EXIT.
Eric
Al Viro <[email protected]> writes:
> On Wed, Jun 16, 2021 at 08:25:35PM +0000, Al Viro wrote:
>> On Wed, Jun 16, 2021 at 01:32:50PM -0500, Eric W. Biederman wrote:
>>
>> > -.macro fork_like name
>> > +.macro allregs name
>> > .align 4
>> > .globl alpha_\name
>> > .ent alpha_\name
>> > + .cfi_startproc
>> > alpha_\name:
>> > .prologue 0
>> > - bsr $1, do_switch_stack
>> > + SAVE_SWITCH_STACK
>> > jsr $26, sys_\name
>> > - ldq $26, 56($sp)
>> > - lda $sp, SWITCH_STACK_SIZE($sp)
>> > + RESTORE_SWITCH_STACK
>>
>> No. You've just added one hell of an overhead to fork(2),
>> for no reason whatsoever. sys_fork() et.al. does *NOT* modify the
>> callee-saved registers; it's plain C. So this change is complete
>> BS.
>>
>> > +allregs exit
>> > +allregs exit_group
>>
>> Details, please - what exactly makes exit(2) different from
>> e.g. open(2)?
>
> Ah... PTRACE_EVENT_EXIT garbage, fortunately having no counterparts in case of
> open(2)... Still, WTF would you want to restore callee-saved registers for
> in case of exit(2)?
Someone might want or try to read them in the case of exit. Which
without some change will result in a read of other kernel stack content
on alpha.
Plus there are coredumps which definitely want to read everything.
Although admittedly that case no longer matters.
Eric
On Wed, Jun 16, 2021 at 03:47:28PM -0500, Eric W. Biederman wrote:
> Fork already saves the registers, all I did was restore them. Which
> makes a debugger that modifies them in
> PTRACE_EVENT_{FORK,VFORK,CLONE,VFORK_DONE} work.
... first time ever. Wonderful and well worth the overhead.
</sarcasm>
On Wed, Jun 16, 2021 at 03:49:44PM -0500, Eric W. Biederman wrote:
> Someone might want or try to read them in the case of exit. Which
> without some change will result in a read of other kernel stack content
> on alpha.
And someone might want a pony. Again, why bother restoring those,
_especially_ in case of exit(2)?
> Plus there are coredumps which definitely want to read everything.
Huh? In case of coredump we are going to have come through
$work_notifysig:
mov $sp, $16
DO_SWITCH_STACK
jsr $26, do_work_pending
so they *do* have full pt_regs saved. What's the problem?