All of lore.kernel.org
 help / color / mirror / Atom feed
* Q: Can we get rid of __copy_siginfo_to_user32?
@ 2018-04-11  1:26 Eric W. Biederman
  2018-04-11  4:09 ` Andy Lutomirski
  0 siblings, 1 reply; 6+ messages in thread
From: Eric W. Biederman @ 2018-04-11  1:26 UTC (permalink / raw)
  To: Andy Lutomirski; +Cc: X86 ML, LKML


Andy,

I am looking at copy_siginfo_to_user32 and find it very unfortunate
that x86 with _sigchld_x32 needs to be the odd man out.  I am looking
at ways to simplify the special case.

The core of the special case comes from:
exit_to_usermode_loop
  do_signal
    handle_signal
       setup_rt_frame


In setup_rt_frame the code looks at ksig to see which kind of signal
frame should be written for the signal.

This leads to the one case in the kernel where copy_siginfo_to_user32
does not use is_ia32_syscall() or is_x32_syscall() to see which kind of
signal frame it needs to create.

Andy, since you have been all over the entry point code in recent years
do you know if we allow tasks that can do both ia32 and x86_64 system
calls?  That seems to be what we the testing of ksig to see which kind
of signal frame to setup is all about.

If we don't allow mixed abi's on x86_64 then can I see if I have a ia32
task in setup_rt_frame by just calling is_ia32_syscall()?

If we do allow mixed abi's do you know if it would be safe to
temporarily play with orig_ax or current_thread_info()->status?

My goal is to write two wrappers: copy_siginfo_to_user32_ia32, and
copy_siginfo_to_user32_x32 around the ordinary copy_siginfo_to_user32.
With only a runtime test to see which ABI we need to implement.

Aka change:
> 	case SIL_CHLD:
> 		to->si_pid    = from->si_pid;
> 		to->si_uid    = from->si_uid;
> 		to->si_status = from->si_status;
> #ifdef CONFIG_X86_X32_ABI
> 		if (x32_ABI) {
> 			to->_sifields._sigchld_x32._utime = from->si_utime;
> 			to->_sifields._sigchld_x32._stime = from->si_stime;
> 		} else
> #endif
> 		{
> 			to->si_utime = from->si_utime;
> 			to->si_stime = from->si_stime;
> 		}
> 		break;
to something like:                
> 	case SIL_CHLD:
> 		to->si_pid    = from->si_pid;
> 		to->si_uid    = from->si_uid;
> 		to->si_status = from->si_status;
> #ifdef CONFIG_X86_X32_ABI
> 		if (!is_ia32_syscall()) {
> 			to->_sifields._sigchld_x32._utime = from->si_utime;
> 			to->_sifields._sigchld_x32._stime = from->si_stime;
> 		} else
> #endif
> 		{
> 			to->si_utime = from->si_utime;
> 			to->si_stime = from->si_stime;
> 		}
> 		break;

I just don't understand the introdcacies of the ia32 and x32 emulation
to really guess which test I need to substitute in there.  So any help
or ideas would really be appreciated.

Eric

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-04-11 22:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-11  1:26 Q: Can we get rid of __copy_siginfo_to_user32? Eric W. Biederman
2018-04-11  4:09 ` Andy Lutomirski
2018-04-11 16:11   ` Q: Do si_time and si_utime need to be 64bit for y2038? Eric W. Biederman
2018-04-11 16:11     ` Eric W. Biederman
2018-04-11 20:13     ` Arnd Bergmann
2018-04-11 22:03       ` Eric W. Biederman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.