Date: Wed, 15 Sep 2021 02:15:59 +0300 From: Konstantin Belousov <kostikbel@gmail.com> To: Jessica Clarke <jrtc27@freebsd.org> Cc: Edward Tomasz Napierala <trasz@freebsd.org>, src-committers <src-committers@freebsd.org>, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: bdf0f24bb16d - main - linux: implement PTRACE_GET_SYSCALL_INFO Message-ID: <YUEtL5KrzHueZ6Rd@kib.kiev.ua> In-Reply-To: <7C375F3A-889E-440F-A164-959A9A903733@freebsd.org> References: <202109142041.18EKf6RU040962@gitrepo.freebsd.org> <YUEl/Ii%2Bve5I%2BUGe@kib.kiev.ua> <7C375F3A-889E-440F-A164-959A9A903733@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Sep 14, 2021 at 11:54:08PM +0100, Jessica Clarke wrote: > On 14 Sep 2021, at 23:45, Konstantin Belousov <kostikbel@gmail.com> wrote: > > > > On Tue, Sep 14, 2021 at 08:41:06PM +0000, Edward Tomasz Napierala wrote: > >> The branch main has been updated by trasz: > >> > >> URL: https://cgit.FreeBSD.org/src/commit/?id=bdf0f24bb16d556a5b1e01cdfc087d08e91ac572 > >> > >> commit bdf0f24bb16d556a5b1e01cdfc087d08e91ac572 > >> Author: Edward Tomasz Napierala <trasz@FreeBSD.org> > >> AuthorDate: 2021-09-12 11:31:10 +0000 > >> Commit: Edward Tomasz Napierala <trasz@FreeBSD.org> > >> CommitDate: 2021-09-14 20:19:55 +0000 > >> > >> linux: implement PTRACE_GET_SYSCALL_INFO > >> > >> This is one of the pieces required to make modern (ie Focal) > >> strace(1) work. > >> > >> Reviewed By: jhb (earlier version) > >> Sponsored by: EPSRC > >> Differential Revision: https://reviews.freebsd.org/D28212 > >> --- > >> lib/libsysdecode/mktables | 2 +- > >> sys/amd64/linux/linux_ptrace.c | 98 +++++++++++++++++++++++++++++++++-- > >> sys/compat/freebsd32/freebsd32_misc.c | 3 ++ > >> sys/kern/sys_process.c | 17 ++++++ > >> sys/sys/ptrace.h | 4 ++ > >> 5 files changed, 120 insertions(+), 4 deletions(-) > >> > >> + case PT_GET_SC_ARGS_ALL: > >> + CTR1(KTR_PTRACE, "PT_GET_SC_ARGS_ALL: pid %d", p->p_pid); > >> + if ((td2->td_dbgflags & (TDB_SCE | TDB_SCX)) == 0 > >> +#ifdef COMPAT_FREEBSD32 > >> + || (wrap32 && !safe) > >> +#endif > >> + ) { > >> + error = EINVAL; > >> + break; > >> + } > >> + bcopy(td2->td_sa.args, addr, sizeof(td2->td_sa.args)); > >> + break; > > > > This is awful, you already got that feedback in review, as I read it. > > I strongly suggest to remove PT_GET_SC_ARGS_ALL, and instead checks something > > in the implementation of PT_GET_SC_ARGS to select either full copy or just > > nargs args. > > > > Easiest thing for 'something' would be SV_PROC_ABI(p) == SV_ABI_LINUX. > > That is incorrect. The original review just changed PT_GET_SC_ARGS even > for FreeBSD and that was what was described as horrible. John suggested > two alternatives: this approach, and having the Linuxulator bypass > kern_ptrace entirely by doing its own thing. My view is that - the whole thing with reading past nargs is horrible - having hidden API interface is horrible, it is obvious layering violation when you need to hide an API: the consumer calls at the wrong level. Another reason to dislike this is that we started to add new PT_ verbs at relatively high rate recently. I am aware of at least to more PT_ ops coming in. In other words, we are not too far from exhausting the MI range and then we would need to make some arrangements. Having one more PT_ value, esp. not useful for anything but for layering violation, is not good.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?YUEtL5KrzHueZ6Rd>