Message ID | 20230613001108.3040476-20-rick.p.edgecombe@intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp212338vqr; Mon, 12 Jun 2023 17:17:35 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6u++RKM8fuL+b4tVWHi/p8RlqlA2YPKkrW9r7mCHP61EcCnhKka2itESsYUuL8qC9OglK2 X-Received: by 2002:a17:907:7d8f:b0:97d:2bcc:47d5 with SMTP id oz15-20020a1709077d8f00b0097d2bcc47d5mr9409971ejc.49.1686615455352; Mon, 12 Jun 2023 17:17:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686615455; cv=none; d=google.com; s=arc-20160816; b=qpsIZZ2I0X3Ziao1Tu6nvfHAHLntougkllrXDSyZWRVeRa2QIJVFBYTmggQRryuGQ9 x8s43dn81RA1HC90guT/hk/30Cmaj2lDlh9uDs903qbTmeOHR8+IeKVBp6dpwYZPihtV ojnMOBTIeYP30KL46gmqUZ5YTxu/wK6sWDl9aKlnURI+x/DUcYLA6FpdWiBhBIZODBqK lcSy5R6nhvGPgS4BnYzjqaffHCXyVBHaapha58IFrCu0RvOcAq49EwqoCftANdhurkcc /+j9IGCVAMG5QH+TzwcVvyxRVLxrsc0/O00l0vtmeWO4ty1B2ka2w4IVVfLUD7Jd/Erp 1uvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=JK9+ERy4F36GfmVdpqghccuIPuJ16HTtI5Wly0MCYFI=; b=UN2nliY+kEjaycF3NLFNuJX04ZDthoIIuLDwRHjjhRnNkRKI6VZ7Wm9nfxZLSzWZNz hicJXqATvENklowjDQBr4/kW799otfUddBx0t5mFhJzNea30idXfrgYwsnP71FUTpY4E H8IJLGFOpiZmySf9sJ6pFDwf+eGyPKipDbQXhAmD2byD1m528lCGP89s8de+VhMg6Zor 5wY+rICznHRix0Xl4AaIlf44EJN7yxua+TZpLAOrNfwGcefeclP++KGOWwT0Q1m9tSp8 VA0LxxNn7JWCiN5BU+CrcJKONP7Bn3SYDN1CA0DF7AdSHeIFpn0vqv6RlB2A/nQvnGwY c5WQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ReZ5iDxt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qh1-20020a170906eca100b00965bb773354si5172848ejb.261.2023.06.12.17.17.05; Mon, 12 Jun 2023 17:17:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ReZ5iDxt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239066AbjFMAPX (ORCPT <rfc822;rust.linux@gmail.com> + 99 others); Mon, 12 Jun 2023 20:15:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239064AbjFMAOF (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 12 Jun 2023 20:14:05 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 747A01BE5; Mon, 12 Jun 2023 17:12:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686615157; x=1718151157; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0w0eM3eQB07Ass1qJGPwxV0mmwv4IZmjBMBIbi82ENo=; b=ReZ5iDxtnRq/j9yOwTVVm8jfsnwBm5XBzlh2zJrrkvlhQ4Sw4nW3aQ0x FZQtGGk3lOA9NIbXbS7iz6esqfttDuhVz05nhygtkjTnQDYBEsSYcVrla gO/7pVN5RpeiK1tH42ldhPb3FBiDpz8gBe8WonZbzFy1fBUC8jf+tIn9G 9nTbtQo4hC4p+VZjDST0dKlQ3OJKzQo7ZwDcCyLkJzrtZ+wxV3Frhn0v+ OKhtfCOhz0i32BNjTL1smFYtrCD/KE+yjLF8BifgWD5xZabAkZ1W7+LIS 9FOX/bOIDh90mmht5l41dCvjRxos7UlYE4QqUfiNQql7zYHZGYmmenc+K w==; X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="361557093" X-IronPort-AV: E=Sophos;i="6.00,238,1681196400"; d="scan'208";a="361557093" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2023 17:12:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="835671045" X-IronPort-AV: E=Sophos;i="6.00,238,1681196400"; d="scan'208";a="835671045" Received: from almeisch-mobl1.amr.corp.intel.com (HELO rpedgeco-desk4.amr.corp.intel.com) ([10.209.42.242]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2023 17:12:23 -0700 From: Rick Edgecombe <rick.p.edgecombe@intel.com> To: x86@kernel.org, "H . Peter Anvin" <hpa@zytor.com>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>, Andy Lutomirski <luto@kernel.org>, Balbir Singh <bsingharora@gmail.com>, Borislav Petkov <bp@alien8.de>, Cyrill Gorcunov <gorcunov@gmail.com>, Dave Hansen <dave.hansen@linux.intel.com>, Eugene Syromiatnikov <esyr@redhat.com>, Florian Weimer <fweimer@redhat.com>, "H . J . Lu" <hjl.tools@gmail.com>, Jann Horn <jannh@google.com>, Jonathan Corbet <corbet@lwn.net>, Kees Cook <keescook@chromium.org>, Mike Kravetz <mike.kravetz@oracle.com>, Nadav Amit <nadav.amit@gmail.com>, Oleg Nesterov <oleg@redhat.com>, Pavel Machek <pavel@ucw.cz>, Peter Zijlstra <peterz@infradead.org>, Randy Dunlap <rdunlap@infradead.org>, Weijiang Yang <weijiang.yang@intel.com>, "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>, John Allen <john.allen@amd.com>, kcc@google.com, eranian@google.com, rppt@kernel.org, jamorris@linux.microsoft.com, dethoma@microsoft.com, akpm@linux-foundation.org, Andrew.Cooper3@citrix.com, christina.schimpe@intel.com, david@redhat.com, debug@rivosinc.com, szabolcs.nagy@arm.com, torvalds@linux-foundation.org, broonie@kernel.org Cc: rick.p.edgecombe@intel.com, Yu-cheng Yu <yu-cheng.yu@intel.com>, Pengfei Xu <pengfei.xu@intel.com> Subject: [PATCH v9 19/42] mm/mmap: Add shadow stack pages to memory accounting Date: Mon, 12 Jun 2023 17:10:45 -0700 Message-Id: <20230613001108.3040476-20-rick.p.edgecombe@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230613001108.3040476-1-rick.p.edgecombe@intel.com> References: <20230613001108.3040476-1-rick.p.edgecombe@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768544488110434225?= X-GMAIL-MSGID: =?utf-8?q?1768544488110434225?= |
Series |
Shadow stacks for userspace
|
|
Commit Message
Edgecombe, Rick P
June 13, 2023, 12:10 a.m. UTC
The x86 Control-flow Enforcement Technology (CET) feature includes a new type of memory called shadow stack. This shadow stack memory has some unusual properties, which requires some core mm changes to function properly. Co-developed-by: Yu-cheng Yu <yu-cheng.yu@intel.com> Signed-off-by: Yu-cheng Yu <yu-cheng.yu@intel.com> Signed-off-by: Rick Edgecombe <rick.p.edgecombe@intel.com> Reviewed-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Kees Cook <keescook@chromium.org> Acked-by: Mike Rapoport (IBM) <rppt@kernel.org> Acked-by: David Hildenbrand <david@redhat.com> Tested-by: Pengfei Xu <pengfei.xu@intel.com> Tested-by: John Allen <john.allen@amd.com> Tested-by: Kees Cook <keescook@chromium.org> --- mm/internal.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/internal.h b/mm/internal.h index 68410c6d97ac..dd2ded32d3d5 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -535,14 +535,14 @@ static inline bool is_exec_mapping(vm_flags_t flags) } /* - * Stack area - automatically grows in one direction + * Stack area (including shadow stacks) * * VM_GROWSUP / VM_GROWSDOWN VMAs are always private anonymous: * do_mmap() forbids all other combinations. */ static inline bool is_stack_mapping(vm_flags_t flags) { - return (flags & VM_STACK) == VM_STACK; + return ((flags & VM_STACK) == VM_STACK) || (flags & VM_SHADOW_STACK); } /*