Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2463160rdb; Sun, 3 Dec 2023 19:02:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IFjHPGVG35GGP5TW3Hc8KfkXiTgrpEYc0mZ5c0gsiBdBH5PiH0ebVAXNQpDdMfWbLDoJj+1 X-Received: by 2002:a17:90b:3c83:b0:286:6cc1:27b with SMTP id pv3-20020a17090b3c8300b002866cc1027bmr696930pjb.70.1701658932881; Sun, 03 Dec 2023 19:02:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701658932; cv=none; d=google.com; s=arc-20160816; b=kqMPB3zXbU1U3B0gl4jFGMgwscxNYEk0h9B96X+U4uHIUjDXCVjlWI2m7A8H9mWr/7 48L4Z9HqtMXniCzM778GAzXWtGI3D4Oei+bsG06f9II/CLAfhnPs6OceETeDszIXNzRs xkgrewH5Hs4ZwotQNj8TYMkTmXwFz8P5GS3t6xpmWcmqPu4iZBIMrrl2IdyqMBjG69x3 Ri89kI1PWylWtZSS/GvqAGSOoh82SBNoTX0KXsjpNMMWf6duWtDq3xOfKRnWoKQgQzET 3Tn4xs01pNH+skP9ZPbFgGQNG9dQCJMHFNnq+SRk4hRHir+N1o/8UON1yq41BblJbc+D +W+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:in-reply-to:subject :cc:to:from:user-agent:references:dkim-signature; bh=CQYiiiRLontcDI44whmeD/LoEJVxuqfkBiryqv/zBTg=; fh=2nPFT/KTslTQ686WgFSojEEZau7G7tqoQ5Zr2uSyW1U=; b=hVIxSzst2hTIKwNQrrqkBUbtZNCUQJGxKQ1iejdGRDq8PHfnNnVf3hDkYhuzb3WTHT n2iAyP1q8YhXU7Iq0vmkw8r4I09Nl4b//qISmrjhaGbeZApeE8o6xA6FnEgGEQJin/TQ rKH8wG9CkVkqisGWCohxz6YoaKPhp98xxJH4tmkWyLXsQ/rKPOyYCw9s2QgATjQ778ML LfhS56bAzipGtowXoOGu6ggP8zs+84mTYiCixVsbBEbzO7WXLe9WYmLh6aMPUFi3MCmq NqaEWvc6Fr+kO7Sp5JZQFH40UZaysDYtGvrQ94t8C1ea1Sy/rLH2OIgUTS5Cd7fMgWHi 0hlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=q3DwEmB4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id k6-20020a17090a3cc600b002868d3e1ab4si2001588pjd.170.2023.12.03.19.02.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Dec 2023 19:02:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=q3DwEmB4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 6FA8E80984B8; Sun, 3 Dec 2023 19:02:11 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230421AbjLDDBt (ORCPT + 99 others); Sun, 3 Dec 2023 22:01:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229510AbjLDDBr (ORCPT ); Sun, 3 Dec 2023 22:01:47 -0500 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A992E5 for ; Sun, 3 Dec 2023 19:01:52 -0800 (PST) Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-6ce403523e5so162597b3a.3 for ; Sun, 03 Dec 2023 19:01:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701658912; x=1702263712; darn=vger.kernel.org; h=mime-version:message-id:date:in-reply-to:subject:cc:to:from :user-agent:references:from:to:cc:subject:date:message-id:reply-to; bh=CQYiiiRLontcDI44whmeD/LoEJVxuqfkBiryqv/zBTg=; b=q3DwEmB4PoXI90W8n4dpmreCIn3QymFrI+vnck8BQ4dZsXgYzdXpJMmLdCZsaQ6W/D cCuK7B29+4/j/SkY/E+9CTj9nzcV0g2DJ5jYfDlkyQ+Ovvj1Am9zG3tQH0rtpapkcr1h jAwkf0pAEEkKC8bGb4InCLPTPtxTR1y+i7Uc/7KHnIieKwTm64vsRpjyd3APhjoiBaBO ULZjb7JIafyeidTMh58sJPA/6HZysYsXrcLxEPfmTZpWPDzC7cgpN60Zn/w/U9YJQf3Z ktGaDBSOto0r54hhNHk1gVGqZgPEcQcsRm/RNwTMI6xA6LplPnjn9zVvxD5/pB65rjb3 9eXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701658912; x=1702263712; h=mime-version:message-id:date:in-reply-to:subject:cc:to:from :user-agent:references:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=CQYiiiRLontcDI44whmeD/LoEJVxuqfkBiryqv/zBTg=; b=fbxfFpPkIueJxoOz7lnXKyzgaEQGuP7SMIgsmLoSP+xTHqTgcusiDjkgBYr35gAI58 ZvF9/v/h3mnK+dqC2gSUUgX/39+od3V3KaDeaxSgjvZRjdNF7nei/T6DuJPjl7LiVCxN RLpYLJtXzqMmDTnTRX16OkQc/dtD91QPALwOrRvh2baDyiMLcF2yZIMn3+6sP4vBw2kt 9Gf5Tbhq+XN8qqk5j6p5ytE8NCsmMtpeLuVOpWtfpgxE4uOhCIWHTzMaWjxOQl6ZjFP+ OS6iwyhq7qgoH7pubU21zz3AmtQvjt0uxeluIl6gn+Hfa7gxQnIlf/m8XNUd0t77w3Jk HmYw== X-Gm-Message-State: AOJu0Ywz6PcWyOSdmtQXYt4Z3Om8Q23J89PIXBb8BostKHQq6B81ZSRJ YCJPLrYHENwyUUBH0Ceqc4vFFA== X-Received: by 2002:a05:6a20:748f:b0:18c:8fef:22cc with SMTP id p15-20020a056a20748f00b0018c8fef22ccmr1035248pzd.24.1701658911982; Sun, 03 Dec 2023 19:01:51 -0800 (PST) Received: from localhost ([2804:14d:7e39:8470:979a:226c:de55:73de]) by smtp.gmail.com with ESMTPSA id c24-20020aa78818000000b006cd88728572sm6562301pfo.211.2023.12.03.19.01.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Dec 2023 19:01:51 -0800 (PST) References: <20231122-arm64-gcs-v7-0-201c483bd775@kernel.org> <20231122-arm64-gcs-v7-13-201c483bd775@kernel.org> User-agent: mu4e 1.10.8; emacs 29.1 From: Thiago Jung Bauermann To: Mark Brown 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" , Deepak Gupta , Ard Biesheuvel , Szabolcs Nagy , "H.J. Lu" , Paul Walmsley , Palmer Dabbelt , Albert Ou , Florian Weimer , Christian Brauner , 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 13/39] arm64/mm: Map pages for guarded control stack In-reply-to: <20231122-arm64-gcs-v7-13-201c483bd775@kernel.org> Date: Mon, 04 Dec 2023 00:01:49 -0300 Message-ID: <87a5qqisbm.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, 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 lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Sun, 03 Dec 2023 19:02:11 -0800 (PST) Hello, Mark Brown writes: > diff --git a/arch/arm64/mm/mmap.c b/arch/arm64/mm/mmap.c > index 645fe60d000f..605d4e6edc1d 100644 > --- a/arch/arm64/mm/mmap.c > +++ b/arch/arm64/mm/mmap.c > @@ -79,9 +79,20 @@ arch_initcall(adjust_protection_map); > > pgprot_t vm_get_page_prot(unsigned long vm_flags) > { > - pteval_t prot = pgprot_val(protection_map[vm_flags & > + pteval_t prot; > + > + /* If this is a GCS then only interpret VM_WRITE. */ > + if (system_supports_gcs() && (vm_flags & VM_SHADOW_STACK)) { > + if (vm_flags & VM_WRITE) > + prot = _PAGE_GCS; > + else > + prot = _PAGE_GCS_RO; > + } else { > + prot = pgprot_val(protection_map[vm_flags & > (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]); > + } > > + /* VM_ARM64_BTI on a GCS is rejected in arch_valdiate_flags() */ s/valdiate/validate/ > if (vm_flags & VM_ARM64_BTI) > prot |= PTE_GP; -- Thiago