From owner-dev-commits-src-all@freebsd.org Tue Sep 14 22:54:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 297BA672D87 for ; Tue, 14 Sep 2021 22:54:17 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H8JZ10Fhrz4bX1 for ; Tue, 14 Sep 2021 22:54:17 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f46.google.com with SMTP id s24so706001wmh.4 for ; Tue, 14 Sep 2021 15:54:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=DsJU0Jxs0hBwsxAQsLEhhEi7QLH5HrgYZ0H5iQQXB7g=; b=NAYYnJ4Y7bsvas1pLVxLws60Djd6Dlja6/SarXekEA1QlTVEMH+xyHRHGtXSL8suQU bsw7nMB0SYDAKd4pYH6Uoxir80pPT+RVaSa4MVvCI8ezuegnItN3oUiM25EF+n6QbBJL CTPr76czePeHJK93A/QId1s4b8FwhStIyGlqDE+ur91zZOwAtvktWoFhYh9cyeQ8FoyG dJqGlUL9lazwq23ZUfJxl67unwuKNzo8/dr6iLYt9j3VCC1yoMeFDYRWxVcbG3WslOHV NwOjaclvgtPv1+2bHkkVrEUU0XqTtp83LuzCeOLn1ruUZeMZlzHTP4BGNaCBiwmpK2Q+ k69Q== X-Gm-Message-State: AOAM5334naSh8LaCS5xp4z/XsAagBjnWclu6SvSx3QYKp3mS8yWnksAD 7pIPCCWpVZ6Ep536r+MmFpdOKcm1GKJGpizi X-Google-Smtp-Source: ABdhPJwWxSPTMSIMHwYpg9mnK8zI7qwmRbjeLfuz6xz7v9z0ZwSYscvFCiNCgeQxOY2ChhXF8DU+vw== X-Received: by 2002:a7b:c351:: with SMTP id l17mr1344455wmj.120.1631660050144; Tue, 14 Sep 2021 15:54:10 -0700 (PDT) Received: from smtpclient.apple (global-5-143.nat-2.net.cam.ac.uk. [131.111.5.143]) by smtp.gmail.com with ESMTPSA id z17sm6248693wrr.49.2021.09.14.15.54.09 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Sep 2021 15:54:09 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: git: bdf0f24bb16d - main - linux: implement PTRACE_GET_SYSCALL_INFO From: Jessica Clarke In-Reply-To: Date: Tue, 14 Sep 2021 23:54:08 +0100 Cc: Edward Tomasz Napierala , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <7C375F3A-889E-440F-A164-959A9A903733@freebsd.org> References: <202109142041.18EKf6RU040962@gitrepo.freebsd.org> To: Konstantin Belousov X-Mailer: Apple Mail (2.3654.120.0.1.13) X-Rspamd-Queue-Id: 4H8JZ10Fhrz4bX1 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Sep 2021 22:54:17 -0000 On 14 Sep 2021, at 23:45, Konstantin Belousov = wrote: >=20 > On Tue, Sep 14, 2021 at 08:41:06PM +0000, Edward Tomasz Napierala = wrote: >> The branch main has been updated by trasz: >>=20 >> URL: = https://cgit.FreeBSD.org/src/commit/?id=3Dbdf0f24bb16d556a5b1e01cdfc087d08= e91ac572 >>=20 >> commit bdf0f24bb16d556a5b1e01cdfc087d08e91ac572 >> Author: Edward Tomasz Napierala >> AuthorDate: 2021-09-12 11:31:10 +0000 >> Commit: Edward Tomasz Napierala >> CommitDate: 2021-09-14 20:19:55 +0000 >>=20 >> linux: implement PTRACE_GET_SYSCALL_INFO >>=20 >> This is one of the pieces required to make modern (ie Focal) >> strace(1) work. >>=20 >> 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(-) >>=20 >> + 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)) =3D=3D 0 >> +#ifdef COMPAT_FREEBSD32 >> + || (wrap32 && !safe) >> +#endif >> + ) { >> + error =3D EINVAL; >> + break; >> + } >> + bcopy(td2->td_sa.args, addr, sizeof(td2->td_sa.args)); >> + break; >=20 > 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. >=20 > Easiest thing for 'something' would be SV_PROC_ABI(p) =3D=3D = 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. Your option seems simpler but I don=E2=80=99t know if there=E2=80=99s a = good reason why that wasn=E2=80=99t suggested. Jess