Re: [PATCH v2] signal: add procfd_signal() syscall
From: Christian Brauner
Date: Sat Dec 01 2018 - 11:27:59 EST
On December 2, 2018 4:52:37 AM GMT+13:00, Andy Lutomirski <luto@xxxxxxxxxxxxxx> wrote:
>
>
>> On Dec 1, 2018, at 7:28 AM, Eric W. Biederman <ebiederm@xxxxxxxxxxxx>
>wrote:
>>
>>
>> It just occurs to me that the simple way to implement
>> procfd_sigqueueinfo info is like:
>>
>> int copy_siginfo_from_user_any(kernel_siginfo_t *info, siginfo_t
>*uinfo)
>> {
>> #ifdef CONFIG_COMPAT
>> if (in_compat_syscall)
>> return copy_siginfo_from_user32(info, uinfo);
>> #endif
>> return copy_siginfo_from_user(info, uinfo);
>
>> }
>>
>> long procfd_sigqueueinfo(int fd, siginfo_t *uinfo)
>> {
>> kernel_siginfo info;
>>
>> if (copy_siginfo_from_user_any(&info, uinfo))
>> return -EFAULT;
>> ...;
>> }
>>
>> It looks like there is already a place in ptrace.c that already
>> hand rolls copy_siginfo_from_user_any.
>>
>> So while I would love to figure out the subset of siginfo_t tha we
>can
>> just pass through, as I think that would make a better more forward
>> compatible copy_siginfo_from_user32.
>
>Seems reasonable to me. Itâs less code overall than any other
>suggestion, too.
Thanks everyone, that was super helpful!
All things equal I'm going to send out an
updated version of the patch latest next week!
>
>> I think for this use case we just
>> add the in_compat_syscall test and then we just need to ensure this
>new
>> system call is placed in the proper places in the syscall table.
>>
>> Because we will need 3 call sights: x86_64, x32 and ia32. As the
>layout
>> changes between those three subarchitecuters.
>>
>>
>
>If itâs done this way, it can just be âcommonâ in the 64-bit table. And
>we kick the can a bit farther down the road :)
>
>Iâm working on patches to clean up x86âs syscall mess. Itâs slow
>because I keep finding new messes. So far I have rt_sigreturn working
>like every other syscall â whee.
>
>Also, Eric, for your edification, I have a draft patch set to radically
>simplify x86âs signal delivery and return. Once thatâs done, I can
>trivially speed up delivery by a ton by using sysret.