From nobody Wed Aug 31 01:32:13 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MHRVj3zVKz4bqCL; Wed, 31 Aug 2022 01:32:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MHRVj32Cwz3C3J; Wed, 31 Aug 2022 01:32:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1661909533; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=X6JlZx6/xNYiTlHDrsInxw6vuA7r4B4wsn2Ii6peNMw=; b=IZBc3uxHEsnFEQ06m+u2W4aN6MS4eOIJoV9bG0T5v768KVu10w0CyXE6zDT/aVxPItqoiE Csp3fDDe/jdg89ZvKGisadbqzsxPKXlFyD9Q4kYUlYN1mShBV15OOyHq56gkYQ4rbwEav5 8lmufqgGsyykBL7hEo8NNIx0fKXbtBsBwMugfosmZq1zScKN+TREdl3OZKGM8b/O7q58ZN 0XTBcuViCTZV8stfRCyT6Sjh82o2bTsjvDXJwl1dI7THGmBODXm/FfD2hbI1mykY6C13gP Gs9SVJaalcfrIAlNJlbym18NtUjCVjLQ+Dssz8FpGeEQALyTtTmQUope01fuwg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MHRVj1zsHzy2R; Wed, 31 Aug 2022 01:32:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 27V1WDq0033158; Wed, 31 Aug 2022 01:32:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 27V1WDAj033157; Wed, 31 Aug 2022 01:32:13 GMT (envelope-from git) Date: Wed, 31 Aug 2022 01:32:13 GMT Message-Id: <202208310132.27V1WDAj033157@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: cd304fdbe95b - stable/13 - i386: do not allow userspace to set tf_trapno on sigreturn(2) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: cd304fdbe95b844f4dff5cd40d213f6923c8767b Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1661909533; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=X6JlZx6/xNYiTlHDrsInxw6vuA7r4B4wsn2Ii6peNMw=; b=Pi8v9FEvpFzzF3a7rx7MYs/BG/j+2cT/+vD5VayTMBME2iIH+UqFpHezAcDfwRywHyZciC k+I3E3UJjdcBYbxQmO8jr/b4TVdkT54i60rlsqOYlFqhGcixBoiv2fmP+ScCMOQVKMH1dm aOC/lRmsjRuoKRBo3VsMOI/NwFAe4og8FbqSk0CNBp7SaFA8T9azFJDMpaBwgnonUPD9hF NukuYE5TFR9I96WUqNThdTjWr7GIRbhKshD4QlmiXSflAIW0vk8LAIPEuY1d1gJeRM63bW DIjDdnBsUMAmd6U8lUNyF5yS9fABIiu6TDokKmMwEuZneYuXcOi/GTCsa4/LNg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1661909533; a=rsa-sha256; cv=none; b=XD+NUILcjkh7JHBt9f4KRVfqAnr5flZFpTDCNxEDdqKqjsH0X2hVm3jHt3GBFq1sPmDlS9 I1AbDO2UcaMveK+U5+LBtiBPFeUMFnbu/ICeANQwBWuALW8Fzn+FrKXY3gfh+Joc/IdOlP xidtWQzLBJabJwLSlk0SjS1Uz7e37uA+SPibm56vhZgX5D0IIjp0S+uhQ+ewi+bO6i4mmE 85cPK430mDAAWRsLDM/e2Mf5zA0EsYigffDiSI/18pU4tJG2AucgrkNnWJDyRzBGO6CZp8 QpJAHroQ40f/gc4ElvxrfWECFEC7RYAWo4zba4ZIvtKlA4JX99bnWqidj7ntdQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=cd304fdbe95b844f4dff5cd40d213f6923c8767b commit cd304fdbe95b844f4dff5cd40d213f6923c8767b Author: Konstantin Belousov AuthorDate: 2022-08-19 01:26:37 +0000 Commit: Konstantin Belousov CommitDate: 2022-08-31 01:20:27 +0000 i386: do not allow userspace to set tf_trapno on sigreturn(2) PR: 265889 (cherry picked from commit dc4a2d1d0e838579f21d9d1fef8655f902f06ab2) --- sys/i386/i386/exec_machdep.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/i386/i386/exec_machdep.c b/sys/i386/i386/exec_machdep.c index 2223dd2a1efa..a3fc0178d322 100644 --- a/sys/i386/i386/exec_machdep.c +++ b/sys/i386/i386/exec_machdep.c @@ -636,6 +636,7 @@ osigreturn(struct thread *td, struct osigreturn_args *uap) regs->tf_esp = scp->sc_sp; regs->tf_eip = scp->sc_pc; regs->tf_eflags = eflags; + regs->tf_trapno = T_RESERVED; #if defined(COMPAT_43) if (scp->sc_onstack & 1) @@ -735,6 +736,7 @@ freebsd4_sigreturn(struct thread *td, struct freebsd4_sigreturn_args *uap) bcopy(&ucp->uc_mcontext.mc_fs, regs, sizeof(*regs)); } + regs->tf_trapno = T_RESERVED; #if defined(COMPAT_43) if (ucp->uc_mcontext.mc_onstack & 1) @@ -869,6 +871,7 @@ sys_sigreturn(struct thread *td, struct sigreturn_args *uap) return (ret); bcopy(&ucp->uc_mcontext.mc_fs, regs, sizeof(*regs)); } + regs->tf_trapno = T_RESERVED; #if defined(COMPAT_43) if (ucp->uc_mcontext.mc_onstack & 1)