From patchwork Fri Jun 16 19:17:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 109324 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1565536vqr; Fri, 16 Jun 2023 12:23:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5+OGYJUcWOW6vbpyawozKzJFd4bLi64CkFAVDzbenCNx0i2HvkTRumuDaJBL1TtjDCoc7W X-Received: by 2002:a54:4785:0:b0:39e:ab8a:752d with SMTP id o5-20020a544785000000b0039eab8a752dmr1770950oic.40.1686943418500; Fri, 16 Jun 2023 12:23:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686943418; cv=none; d=google.com; s=arc-20160816; b=RXehpphmpg7kIWBPhm5lTEUYGXtrwILs0D6f62Iol5ePhJbwbVrRNxtsnvPhSvoryH /QadtsG4hIzYPHk7fizXpg87GkmnXfZM9fZlZWn9YCfHHIvq9zC9CEHxUzMzx8PWqn/d I+IWS/64R15zkYkpkAfCQ7YhZps2QRxwsXTk8xaQ7c/qzRwF1I/sKghJ55XtfxeNCgCu EgQwLQBrlZoMxS41ewR055f1RfcYqJB3MaO19HvslXmlZR51umcqf0vyAj0xKbkZN6Mp jsU69JJ3jUVIGb4TEAtjWJoomwQWRIofeASAIhdDvtH+NQg15JZTfFPdv0g2+HM9ITep ialw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:cc:subject:to:reply-to:sender:from :dkim-signature:dkim-signature:date; bh=lEavE7KzI6HFgILgkppc2+zKlgu3cU9oGtjf05hXZiI=; b=Ls0q+EAW9p16OXqKJvtP8Hr7L1L+cMW9SUrPLjuXbGFfLwMKq4E/VGw7KbSVEpdlvY UIp8FwFaKDenHWEIZQ+2BagXm/1BMsyYLbYAE9GxINvp4/VGWl3ua1te6lFnvklzM3Bj M7sW13ka1Ip41pb/tyTLmmssLEY5dICtLkwirO0RWZUSDHLGcQVR+Dny9mqeriMipesJ 53QqeHrRzyYD5SLFrLd6kflZGwUo9II4P0u2sjNSfs6z8yQpNoCgPjJs5VNHZ/0/ubQe /dyTDmc5nyT6nFOY2sZnrEr8pITrbW+OoxIweM8lLADOBpSDG7V/coqnEfgDsiFf+aTO MpWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="T/wl2Kxq"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o17-20020a637e51000000b005139edd3958si15485825pgn.6.2023.06.16.12.23.26; Fri, 16 Jun 2023 12:23:38 -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=@linutronix.de header.s=2020 header.b="T/wl2Kxq"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231865AbjFPTSZ (ORCPT + 99 others); Fri, 16 Jun 2023 15:18:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345949AbjFPTRE (ORCPT ); Fri, 16 Jun 2023 15:17:04 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 149863AA4; Fri, 16 Jun 2023 12:17:02 -0700 (PDT) Date: Fri, 16 Jun 2023 19:17:00 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1686943020; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lEavE7KzI6HFgILgkppc2+zKlgu3cU9oGtjf05hXZiI=; b=T/wl2KxqdGaA9sp6tQSlUzgVPtt58NZMGYSW2KlPg0RgldgtqfWqResDNeFMfaxJXiypyR +9LDA9n0nvZNDXcidXo4Xnw9KstyIEhykg80AQVmjzwDDK8qKpuIoAzXV43u589WHLe4aH 6nC9x4evSBVywLIUfKSYaOgkwfvbwv2SicwdgGNCPEDU1PQKIP7rqMj6xdd0+dSNxwk9ad zyknQ4V4pzV5Q/B0BP6ld3GO7Lnw2jz5nQd5fJZ8JRamBPKU4Lavg0zgfUVvPhQgsu9E01 snwUlOiIDSuXCma6BQtv7KefEYN0lMtGy1Efo7C+p9nMWK6wIWJvNnl6GCWvQg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1686943020; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lEavE7KzI6HFgILgkppc2+zKlgu3cU9oGtjf05hXZiI=; b=NvKB0d/aVj7dCLxSUY8eliIwz8diaGzzEexKcdvXQ/rBKFR5RPj1khLHv39NfKW2sOnfoJ Y7Y6HmUX7O7XwvBg== From: "tip-bot2 for Rick Edgecombe" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/shstk] mm/mmap: Add shadow stack pages to memory accounting Cc: "Yu-cheng Yu" , Rick Edgecombe , Dave Hansen , "Borislav Petkov (AMD)" , Kees Cook , "Mike Rapoport (IBM)" , David Hildenbrand , Pengfei Xu , John Allen , x86@kernel.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Message-ID: <168694302024.404.10992834029172607426.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768888382068863191?= X-GMAIL-MSGID: =?utf-8?q?1768888382068863191?= The following commit has been merged into the x86/shstk branch of tip: Commit-ID: 6538963ccabd17c61265a8fb497c76727f6bc638 Gitweb: https://git.kernel.org/tip/6538963ccabd17c61265a8fb497c76727f6bc638 Author: Rick Edgecombe AuthorDate: Mon, 12 Jun 2023 17:10:45 -07:00 Committer: Dave Hansen CommitterDate: Thu, 15 Jun 2023 16:31:33 -07:00 mm/mmap: Add shadow stack pages to memory accounting 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 Signed-off-by: Yu-cheng Yu Signed-off-by: Rick Edgecombe Signed-off-by: Dave Hansen Reviewed-by: Borislav Petkov (AMD) Reviewed-by: Kees Cook Acked-by: Mike Rapoport (IBM) Acked-by: David Hildenbrand Tested-by: Pengfei Xu Tested-by: John Allen Tested-by: Kees Cook Link: https://lore.kernel.org/all/20230613001108.3040476-20-rick.p.edgecombe%40intel.com --- mm/internal.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/internal.h b/mm/internal.h index 68410c6..dd2ded3 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); } /*