Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp345382rdb; Tue, 5 Dec 2023 07:06:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IGGsfLOi1z6CIjnHGzTue/OSkLDLO2p2btVdYEg5EjPHKOWkmIOnZ1bPV2uXP4+AIHYYB/o X-Received: by 2002:a05:6a20:4413:b0:18b:fe45:90cb with SMTP id ce19-20020a056a20441300b0018bfe4590cbmr3643095pzb.54.1701788775598; Tue, 05 Dec 2023 07:06:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701788775; cv=none; d=google.com; s=arc-20160816; b=nOeGhKGn99YDI38OHlRHdjO0dUhIcJJVnHgjBWeXlQtAL7dJjs+Cg+PNashTN/jSs0 6FjiMHlA5eC/osq/uY44pW7moC8VJZzS8yNLcSKUHC6fJHZDCb8RCJGX5HBkS4iJYUtn LixwyotbJklNIMLfOSrV6LepaYAYm2CWYLPjognjK7Lh3BtvpATgiCceAnVRKcfsb1Zp NeKlz5KwoltMcLZu2x5d2oBYztyD0mSsUxhFz3O8Xjt1b49UFFDcqu85WPTeIZwaMZhV CiNH/CYt6QHJQ5gSwBSmSckPZmBKYKlyWXQ5dMpSJJ4M3bHHeFIj7RmdmmnK1C310Jqb 1+lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=eHKOdG1n+V7bNbQhLOJTQtpXq7lLL7yLRvH2Q+cBqj4=; fh=wxIW/wLWPpVspSZM507TUj48YeKu+U+R0TkO2JXe0es=; b=oYrUnuIKvZUpbdMDzTVHTzP3PaxsbXu5+GyK6bFLwKWWRMDk9FW1amqwKkDwpw6sA+ PzET6GU7ereODg+TFRV1EPkmu0cXkZRq5PlbjfCYlwwpW9vJ56mL6wWbeD+zU3SO9cMm HWpXTzt8HDeJ1Cxpw/VVxPei3hL/ogZkFrRZUG1bzzvZ621WXoWbJ99YJT7vyshqzjNy CBYKpBZ2w23+QZeyyyq8VV+NzDhwDw2ahXjGt0Uawfn04AxSRjqH/Cn3rPjeSe8spby3 nSIQLIIbRT9ziU6wvdlTv+0kZsI6RWQmLltKrKDQIqDNU2uaBgCetm7/nfAaM3dTK65a O6Sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KY4z3Vzv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id bg7-20020a056a02010700b005bdfb77e552si9934839pgb.439.2023.12.05.07.06.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 07:06:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KY4z3Vzv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id BF9E280A64D2; Tue, 5 Dec 2023 07:06:12 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442363AbjLEPFu (ORCPT + 99 others); Tue, 5 Dec 2023 10:05:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442362AbjLEPFj (ORCPT ); Tue, 5 Dec 2023 10:05:39 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09634194 for ; Tue, 5 Dec 2023 07:05:46 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 055F1C433C7; Tue, 5 Dec 2023 15:05:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701788745; bh=aap6pmp+k2anpVz8ybOF65zFnWxtExFTvx5xhqmLzhM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KY4z3VzvUuPldDeBw1TVDWWHBlLtm/bPmaaxPgzbCSHLaQYi1u+lCwOb7Us/NjEcx o7sD3S6iAE0kqc55CH1FJRYCDrFhE5JAnh2FSorQL9ENifCtcB2OIGfSLGSXF7VgE/ o8/cza+U878GauzXqR/B12Q4kYa0ZCG/YLvOstc6yG+uoqaW/dRuVIKhEkrjSzhZaX JZuFrrGjzC2DWyMRSXLM0njLcgfRJhjuQfswGV2u1JFM8I7wuJhwyIQtXoneSf/wQL MzPZZnBSiQNxsG7dgobcKlxmI6QUYtjnEhqQZnnA8PKsirpP69JcRC/rx3sMBgHSi6 kxfISKx2P9EAA== Date: Tue, 5 Dec 2023 15:05:36 +0000 From: Mark Brown To: "Edgecombe, Rick P" Cc: "dietmar.eggemann@arm.com" , "Szabolcs.Nagy@arm.com" , "brauner@kernel.org" , "dave.hansen@linux.intel.com" , "debug@rivosinc.com" , "mgorman@suse.de" , "vincent.guittot@linaro.org" , "fweimer@redhat.com" , "mingo@redhat.com" , "rostedt@goodmis.org" , "hjl.tools@gmail.com" , "tglx@linutronix.de" , "vschneid@redhat.com" , "shuah@kernel.org" , "bristot@redhat.com" , "hpa@zytor.com" , "peterz@infradead.org" , "bp@alien8.de" , "bsegall@google.com" , "x86@kernel.org" , "juri.lelli@redhat.com" , "keescook@chromium.org" , "jannh@google.com" , "linux-kselftest@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "catalin.marinas@arm.com" , "linux-api@vger.kernel.org" , "will@kernel.org" Subject: Re: [PATCH RFT v4 5/5] kselftest/clone3: Test shadow stack support Message-ID: <345cf31a-3663-4974-9b2a-54d2433e64a7@sirena.org.uk> References: <20231128-clone3-shadow-stack-v4-0-8b28ffe4f676@kernel.org> <20231128-clone3-shadow-stack-v4-5-8b28ffe4f676@kernel.org> <4898975452179af46f38daa6979b32ba94001419.camel@intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="eEFWtkuzePavFi4c" Content-Disposition: inline In-Reply-To: <4898975452179af46f38daa6979b32ba94001419.camel@intel.com> X-Cookie: I've Been Moved! X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Tue, 05 Dec 2023 07:06:12 -0800 (PST) --eEFWtkuzePavFi4c Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Dec 05, 2023 at 12:10:20AM +0000, Edgecombe, Rick P wrote: > Without this diff, the test crashed for me on a shadow stack system: > -static inline void enable_shadow_stack(void) > +static inline __attribute__((always_inline)) void doh. > But I wonder if the clone3 test should get its shadow stack enabled the > conventional elf bit way. So if it's all there (HW, kernel, glibc) then > the test will run with shadow stack. Otherwise the test will run > without shadow stack. This creates bootstrapping issues if we do it for arm64 where nothing is merged yet except for the model and EL3 support - in order to get any test coverage you need to be using an OS with the libc and toolchain support available and that's not going to be something we can rely on for a while (and even when things are merged a lot of the CI systems use Debian). There is a small risk that the toolchain will generate incompatible code if it doesn't know it's specifically targetting shadow stacks but the toolchain people didn't seem concerned about that risk and we've not been running into problems. It looks x86 is in better shape here with the userspace having run ahead of the kernel support though I'm not 100% clear if everything is fully lined up? -mshstk -fcf-protection appears to build fine with gcc 8 but I'm a bit less clear on glibc and any ABI variations. > The other reason is that the shadow stack test in the x86 selftest > manual enabling is designed to work without a shadow stack enabled > glibc and has to be specially crafted to work around the missing > support. I'm not sure the more generic selftests should have to know > how to do this. So what about something like this instead: What's the issue with working around the missing support? My understanding was that there should be no ill effects from repeated attempts to enable. We could add a check for things already being enabled=20 --eEFWtkuzePavFi4c Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmVvPEAACgkQJNaLcl1U h9BTUAf/XQUhFFRSCwVlzHTp8jJ+VI5Cs+r84ZiyHFlSQtaZvyox4D48jNDyd8kw iXxMa2/lUeW/qiZ2bufzYmM8AKSuObkpZhcCj+TyprXYnvmhqscegfQjQqnqgV+b ctpM6PGCxetylMwYUwMw83v4ZUrLua2oCnU+xdHphkC1ClZt2lH6lZXAAG5q7Qx/ E2t1mv+L/eA7qNnMGddM3PQ35AQu7mHFuPohck0pIKqvxXiQVGDRdYTLuMxlKQDG f43kOxDHV7jSemDeF0K60+t53hVU36kE5yFUH2gqQUaksnZsTzkv1OX8Hdn/VXON 1HI0UnmxFD8fHjkg8vvOvtr3/ncfxw== =1GHB -----END PGP SIGNATURE----- --eEFWtkuzePavFi4c--