From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andy Lutomirski Subject: Re: [PATCH v2] signal: add procfd_signal() syscall Date: Sat, 1 Dec 2018 07:52:37 -0800 Message-ID: References: <20181120105124.14733-1-christian@brauner.io> <87in0g5aqo.fsf@oldenburg.str.redhat.com> <36323361-90BD-41AF-AB5B-EE0D7BA02C21@amacapital.net> <993B98AC-51DF-4131-AF7F-7DA2A7F485F1@brauner.io> <20181129195551.woe2bl3z3yaysqb6@brauner.io> <6E21165F-2C76-4877-ABD9-0C86D55FD6AA@amacapital.net> <87y39b2lm2.fsf@xmission.com> <20181130065606.kmilbbq46oeycjp5@brauner.io> <87y399s3sc.fsf@xmission.com> <87tvjxp8pc.fsf@xmission.com> Mime-Version: 1.0 (1.0) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <87tvjxp8pc.fsf@xmission.com> Sender: linux-kernel-owner@vger.kernel.org To: "Eric W. Biederman" Cc: Arnd Bergmann , christian@brauner.io, Andy Lutomirski , Florian Weimer , Linux Kernel Mailing List , "Serge E. Hallyn" , Jann Horn , Andrew Morton , Oleg Nesterov , cyphar@cyphar.com, Al Viro , Linux FS-devel Mailing List , Linux API , Daniel Colascione , Tim Murray , linux-man@vger.kernel.org, Kees Cook List-Id: linux-api@vger.kernel.org > On Dec 1, 2018, at 7:28 AM, Eric W. Biederman wrot= e: >=20 >=20 > It just occurs to me that the simple way to implement > procfd_sigqueueinfo info is like: >=20 > 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); =20 > } >=20 > long procfd_sigqueueinfo(int fd, siginfo_t *uinfo) > { > kernel_siginfo info; >=20 > if (copy_siginfo_from_user_any(&info, uinfo)) > return -EFAULT; > ...; =20 > } >=20 > It looks like there is already a place in ptrace.c that already > hand rolls copy_siginfo_from_user_any. >=20 > 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=E2=80=99s less code overall than any other sugges= tion, too. > 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. >=20 > Because we will need 3 call sights: x86_64, x32 and ia32. As the layout > changes between those three subarchitecuters. >=20 >=20 If it=E2=80=99s done this way, it can just be =E2=80=9Ccommon=E2=80=9D in th= e 64-bit table. And we kick the can a bit farther down the road :) I=E2=80=99m working on patches to clean up x86=E2=80=99s syscall mess. It=E2= =80=99s slow because I keep finding new messes. So far I have rt_sigreturn w= orking like every other syscall =E2=80=94 whee. Also, Eric, for your edification, I have a draft patch set to radically simp= lify x86=E2=80=99s signal delivery and return. Once that=E2=80=99s done, I c= an trivially speed up delivery by a ton by using sysret.