From nobody Sat Jan 25 18:32:15 2025 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 4YgNZj2fByz5lkTp for ; Sat, 25 Jan 2025 18:32:29 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (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 "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YgNZh52qQz3K7P for ; Sat, 25 Jan 2025 18:32:28 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-436202dd7f6so35806705e9.0 for ; Sat, 25 Jan 2025 10:32:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737829947; x=1738434747; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qsYfUNl64lPxOW/AlxpPZJEM7nSj/mRKIfvUirn+BAM=; b=KPfQK/uimIAopxjkbHF0Vove+viT8Out2ZiIR9/HGrMTdMU+K5WFenxztJsyDxDluF +rGvhnqXONiqRUyKNorAaFHJtETEUWRqh6nFLo6FXphDO9O9Ly0Ho+BqNx9lE0EJRaOi eb+tmmPn7f5Le0a/hlHgElC4G1L+ehgVuh3aM17x+9My5wW5cHvcwfAdoANoSJ4ewF4Y 2qEQk1EyQrRpSy8RvFdj/G5zftZjhO/sBt0063IPhnlk26p04+KtX/MR4W9cDBQ4vxu4 dLgsRKSA5eE3vcuAW4Fy9CyIPQgTnov7ieIOQab9H6A1CsJgz4NAtNvo/M5xgJN9ps/s PViw== X-Forwarded-Encrypted: i=1; AJvYcCWoq+D71hZYdtj0OHeuOgHkeSsNXMlRk+MRRaTuVP0fiX65XqrWVQEJDjq983aQhDoOBdrB6RF8/7rBcmQH855Bih9f@freebsd.org X-Gm-Message-State: AOJu0YzoMcwHQODbXc6fI7PI8ssnv77mN3xalc8SHfevVySQ672dsHgg gEQ+/m1bEpf+6npIBSgByfsCHhPcm72JyqLQT81H2r5VD6u6G0cLMFgL9TMYu5bLwNPAHONkqyL K X-Gm-Gg: ASbGncukZ5STPcfPXRkH2mVFcRZPBC891TJdcMnYVBzdiroIfsZebAadSjePCAtXi8m 0p6u4NwCJEL4JE0Q5kXI/SbQk7kWkRgAnScaorNl+8KYBm7MA4s8y0DCxy5spFctYea9xORmotL 10c3dR0z1C+pKDUnSbY4bquiVVNSK/N++M25b1zrgPr8DDZeS9eIrmRWyj/Y7kc+hx7oGAIxJ0P 4EKLJDjbpD1EaBL515x8f9aj1rx0+rlf8FUkTufSNRqVTXWcuoCRe2gyLuOKeWYyl/W1JnSdgyf SpSY5Gdv3ylg7nmwOHA= X-Google-Smtp-Source: AGHT+IFKo5XZvDuY1BN8ykcl4MlrE8vID70XlTgRLh6KSIX1DtmNeatvZ4Db3Y8TGzLwkYsVg1yiKw== X-Received: by 2002:a05:600c:4c86:b0:436:6ddf:7a27 with SMTP id 5b1f17b1804b1-4389141c412mr297158285e9.23.1737829946970; Sat, 25 Jan 2025 10:32:26 -0800 (PST) Received: from smtpclient.apple ([131.111.5.201]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd54bfa5sm68415115e9.25.2025.01.25.10.32.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 Jan 2025 10:32:25 -0800 (PST) Content-Type: text/plain; charset=utf-8 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.300.87.4.3\)) Subject: Re: git: f934e629dc22 - main - Add stack clash protection to the WITH_SSP flag From: Jessica Clarke In-Reply-To: <202501251308.50PD8Qsg042260@gitrepo.freebsd.org> Date: Sat, 25 Jan 2025 18:32:15 +0000 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <81A8E695-5034-4945-8D07-DF95E76904D0@freebsd.org> References: <202501251308.50PD8Qsg042260@gitrepo.freebsd.org> To: Alexander Leidinger X-Mailer: Apple Mail (2.3826.300.87.4.3) X-Rspamd-Queue-Id: 4YgNZh52qQz3K7P X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US] On 25 Jan 2025, at 13:08, Alexander Leidinger = wrote: >=20 > The branch main has been updated by netchild: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3Df934e629dc22b859efabd3cdebc23b63= b04fa2bb >=20 > commit f934e629dc22b859efabd3cdebc23b63b04fa2bb > Author: Alexander Leidinger > AuthorDate: 2025-01-25 12:43:39 +0000 > Commit: Alexander Leidinger > CommitDate: 2025-01-25 12:45:53 +0000 >=20 > Add stack clash protection to the WITH_SSP flag >=20 > Some background info availabe in: > = https://best.openssf.org/Compiler-Hardening-Guides/Compiler-Options-Harden= ing-Guide-for-C-and-C++.html > = https://developers.redhat.com/blog/2020/05/22/stack-clash-mitigation-in-gc= c-part-3 > https://blog.llvm.org/posts/2021-01-05-stack-clash-protection/ >=20 > Reviewed by: emaste > Differential Revision: https://reviews.freebsd.org/D48651 Uh, it does require architecture-specific compiler support, which = isn=E2=80=99t implemented for all architectures in LLVM at least. RISC-V has only recently (as in 1.5 months ago so not even released yet) gained support, for example. So this is just going to spew out -Wunused-command-line-argument warnings, and errors with -Werror, no? Jess > --- > share/man/man7/mitigations.7 | 14 ++++++++++---- > share/mk/bsd.sys.mk | 2 +- > 2 files changed, 11 insertions(+), 5 deletions(-) >=20 > diff --git a/share/man/man7/mitigations.7 = b/share/man/man7/mitigations.7 > index c487e4e1000b..4db6589cdcf1 100644 > --- a/share/man/man7/mitigations.7 > +++ b/share/man/man7/mitigations.7 > @@ -28,7 +28,7 @@ > .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE = POSSIBILITY OF > .\" SUCH DAMAGE. > .\" > -.Dd July 23, 2024 > +.Dd January 25, 2025 > .Dt MITIGATIONS 7 > .Os > .Sh NAME > @@ -244,9 +244,13 @@ and it is possible that some applications may not = function correctly. > .Fx > supports stack overflow protection using the Stack Smashing Protector > .Pq SSP > -compiler feature. > +compiler feature, > +and stack clash protection. > In userland, SSP adds a per-process randomized canary at the end of = every stack > -frame which is checked for corruption upon return from the function. > +frame which is checked for corruption upon return from the function, > +and stack probing in > +.Dv PAGE_SIZE > +chunks. > In the kernel, a single randomized canary is used globally except on = aarch64, > which has a > .Dv PERTHREAD_SSP > @@ -264,7 +268,9 @@ When > .Va WITH_SSP > is enabled, which is the default, world is built with the > .Fl fstack-protector-strong > -compiler option. > +and > +.Fl fstack-clash-protection > +compiler options. > The kernel is built with the > .Fl fstack-protector > option. > diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk > index 63774e857167..06f8e6e9fe78 100644 > --- a/share/mk/bsd.sys.mk > +++ b/share/mk/bsd.sys.mk > @@ -304,7 +304,7 @@ CXXFLAGS.clang+=3D -Wno-c++11-extensions > FORTIFY_SOURCE?=3D 0 > .if ${MK_SSP} !=3D "no" > # Don't use -Wstack-protector as it breaks world with -Werror. > -SSP_CFLAGS?=3D -fstack-protector-strong > +SSP_CFLAGS?=3D -fstack-protector-strong -fstack-clash-protection > CFLAGS+=3D ${SSP_CFLAGS} > .endif # SSP > .if ${FORTIFY_SOURCE} > 0