Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5554781rdb; Wed, 13 Dec 2023 12:02:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IHQoUgEeF8hCgjOM82jw7RV4dt+H3o+der2c/jp68wVWH29h1fEXX1eaN5GaHM/pLJGlHGb X-Received: by 2002:a17:903:2ce:b0:1d0:a084:a1e9 with SMTP id s14-20020a17090302ce00b001d0a084a1e9mr6398618plk.1.1702497764478; Wed, 13 Dec 2023 12:02:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702497764; cv=none; d=google.com; s=arc-20160816; b=yvYwczFVM6i3vacm+hpJySsEYUB0yDvEtXJK4x0CPIiyTOd/MRzYFo1GQky07BWnTK YsGlUNXOQMPAktSQ3MFUCfeaHAka4Xhl5wqD7hnUgx/HGZSH2AigzdveUIbKgGLPAi7e R49R55eiVTWwPryYBGJAzGYLPANE+h2d12crpRePqeHNAhK+l/chgILnuqCow/noce6l askX1rxecuYixkdXMw86O8IEgBNihqxPHkhr+bhNJrDBETvLByaUTXGl/hy11C55bbex 69GFtWHPX/r2smKVgadgF+y/PqJapieNnx4umrA59YrJ+s5T4oiKT5A63e1ZlJGkpTAE z3Dg== 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=BQ5+tYFHxOt1ewURu/0CcnD8HgBJdcFUlMz7T/6KZsI=; fh=TqIALBV+Tmb9k/Zsv4pmxeoKpbOidJWOboBFUCRDhig=; b=na2jgbpcek3wU6h8P7CbxhjF4VTiy+miyFivHOqymxcPcbYDM6fwkRH/liZIQCZjqZ b67kSa/lMSecsDRkctMll3OvuT8JCeQWhUPcvEcakSLSXrxgwfGE+dff00L1tNC3+acn E9ed/fdKNk0dg8ZKqvSJyOjQU0n5FHqPdb7Lm93zJEyBWJz8Eu2miGWUJaX3zDvVzllI ZqPAhnCph4GtkT/DxKTKNoWkRD/HKaRmSYNPDXVmcmeCghMhaC3I/2KUSXIEQBfyHn9y 0qm/4vg2Hk/jlo0pBsfoQSzlgNhAH+uyUVlXtt24xmO3RVt9rDcJf4s1CuPr5kQZ7qRp XAlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Rw52Vfty; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id m8-20020a1709026bc800b001cfce833b63si9871775plt.83.2023.12.13.12.02.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 12:02:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Rw52Vfty; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id 1816782B9283; Wed, 13 Dec 2023 12:02:42 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233770AbjLMUC2 (ORCPT + 99 others); Wed, 13 Dec 2023 15:02:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229671AbjLMUC1 (ORCPT ); Wed, 13 Dec 2023 15:02:27 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3276DDC for ; Wed, 13 Dec 2023 12:02:34 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C1AFC433C8; Wed, 13 Dec 2023 20:02:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702497753; bh=TWKx/EtzYbtKFgsobV53zPra9sAQTzvSeeX3jZwDlRo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Rw52VftygnvuTCgOrGI+gXe3TWpHtVdnfgBKILZHSSoQQfWcj4FiDZBF3q0xg/p1U yMyKDh7CfJhMPcfzgFLat+8qbBLeFz+kC6B1tBll2xoDe6ZR+lL4atc7TiTHTaVBXM KlV6aWd7XISTwMfEZMAy3uUu9bt6AO01rkUbbhpNndDZiRNqiRth1R5905LQyKnKba /Gu969kcPjCpd8VYSh4acTvsQvcFLrQg/odEGgysmo+09v0y9yHqoazxNAXt1jERrU 3PEg1LuMx6NGBxtg6PTj1VO7B1PTnSanvAI6Vm8xADmZDlQepBudQj+aTfcAbjr2x0 iLnlO4srSoqvg== Date: Wed, 13 Dec 2023 20:02:24 +0000 From: Mark Brown To: Deepak Gupta Cc: Catalin Marinas , Will Deacon , Jonathan Corbet , Andrew Morton , Marc Zyngier , Oliver Upton , James Morse , Suzuki K Poulose , Arnd Bergmann , Oleg Nesterov , Eric Biederman , Kees Cook , Shuah Khan , "Rick P. Edgecombe" , Ard Biesheuvel , Szabolcs Nagy , "H.J. Lu" , Paul Walmsley , Palmer Dabbelt , Albert Ou , Florian Weimer , Christian Brauner , Thiago Jung Bauermann , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, kvmarm@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: Re: [PATCH v7 20/39] arm64/gcs: Context switch GCS state for EL0 Message-ID: References: <20231122-arm64-gcs-v7-0-201c483bd775@kernel.org> <20231122-arm64-gcs-v7-20-201c483bd775@kernel.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="p5BMo6xEVagOzbFU" Content-Disposition: inline In-Reply-To: X-Cookie: One size fits all. 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 howler.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 (howler.vger.email [0.0.0.0]); Wed, 13 Dec 2023 12:02:42 -0800 (PST) --p5BMo6xEVagOzbFU Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Dec 13, 2023 at 11:59:45AM -0800, Deepak Gupta wrote: > On Wed, Nov 22, 2023 at 1:45=E2=80=AFAM Mark Brown w= rote: > > + if (task->thread.gcs_el0_mode & PR_SHADOW_STACK_ENABLE) > > + gcscre0_el1 |=3D GCSCRE0_EL1_RVCHKEN | GCSCRE0_EL1_PCRS= EL; > If the intent is to disable, is the GCS stack freed or kept around? > I expect if libc is taking the decision to disable, kernel should free it= up. > Is it freed in some other flow? Kept around and freed on thread exit. There is a potential race between for example disabling in a signal handler and something trying to walk the stack so we err on the side of caution. --p5BMo6xEVagOzbFU Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmV6Dc8ACgkQJNaLcl1U h9D/UQf/drLKsAxcIavasAKyvNxy00BF9vIZyHv3vJ+sFZEMcKnnX/8KO6A54p3z Y5Oowl7starF/ef/S94c9GDD6e9ErIIZiUHOIWoegLpSIr9NL3p3q2pzJTSgEigR 7gxmR840FSDV235o0T16ajXu4aj3hg3eSiDmycP9Wh2TY6lNU+Uab1nhCM6mIgzY Spu0s0+naKP+fYEkXZjhn15XHplZNEI2qLOIXhEpNJZHiEt1imkFwLa5GqHbaWUz wqtAF1RUqcDm5hATvxuPbnPA0WsnHFGCniy5C7vyRNlcPGx+FBg2pW0O9Y47ff2a Vt+12qPfZq/CDUunfX/IvKyQ3YO5+Q== =JGbe -----END PGP SIGNATURE----- --p5BMo6xEVagOzbFU--