From patchwork Wed Jul 19 22:47:35 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: 122874 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp2753900vqt; Wed, 19 Jul 2023 15:50:06 -0700 (PDT) X-Google-Smtp-Source: APBJJlFhQE+w/Fdj8wqIMtZi5O7LsCVRj2EbRY8N9y6I3jtiM0Q1emhJ5EisrY3PGE3MvokmXi72 X-Received: by 2002:a05:6a20:7286:b0:137:93d7:6ab7 with SMTP id o6-20020a056a20728600b0013793d76ab7mr1072328pzk.30.1689807005932; Wed, 19 Jul 2023 15:50:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689807005; cv=none; d=google.com; s=arc-20160816; b=LJOkpPn15nHgLSXWFYaQqvG94zlGJuzI9NnlPFgppGPyIQGYvZ5SSo1RJeeJkdUKKe onyG1erwwRLSWHHRoir6YJeEZTqJraLY2H/cKr1vJ7hWz8TT8Cd1hbGWJ974tLJKsjeZ 3d00v7Tctxsu42FNaVHKYPVOAA+MhVrKVX/TMpqMjvvTr0vFLPm6BnKo/gAsVxwX8JAt XXKHRVvjilSBFOHZwKHgqnYH6T/pnn0Sjr1bSYpEUvZyBCJ0eaEYsC4KRIlbz3wHuDes hZiuuqbexRTK3vNvmZHORUlspD9zGQec/OVPrrc0BL5h4LXWu+N4j3nbAOIs8XgwdQCF 8zEA== 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=om13jL7O3l4YcuKziXRHIegrg+cbxJkA71mYNJPzON4=; fh=wapDtr5MPVilyW/Edc4eVPTKI4XJCflxD+KiNw3jn+I=; b=qrtePHie+yVYyRL0PfJQUAbfVgoDSfT6kOA3Vb73IYkNZvyuze9ia7Xd9wpZoWKWfi IRmvvgIkvrk5/GPoJofMHjk7QPh/vPUn/7hIdTppsOLBD0yEdS4v0tqqpkaiXnuqXK7e PcQKN+IjnZIqoZrjFxLQTv84WKBLuLsZ+fuqK50zLpb7hBalmJTCvrlZRle17aCmwBvo +ZGGdx5M/ZIxBmK8kW8yEb2xx0kkAhmXj8EV/JYMQ7PmTEaZhdFua+8uBipy3FTwy3tt yVZKOh3LXPd+QJPGruS5oIPtzGDH2NqiQNPUp/dZZiCic00BZICKC9/qS6zdjFRMaZSP rH+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=t9bVuNO9; dkim=neutral (no key) header.i=@linutronix.de; 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 y3-20020a056a00180300b0067f9d269213si4464390pfa.171.2023.07.19.15.49.53; Wed, 19 Jul 2023 15:50:05 -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=t9bVuNO9; dkim=neutral (no key) header.i=@linutronix.de; 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 S231336AbjGSWtM (ORCPT + 99 others); Wed, 19 Jul 2023 18:49:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231151AbjGSWrv (ORCPT ); Wed, 19 Jul 2023 18:47:51 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56CB22135; Wed, 19 Jul 2023 15:47:38 -0700 (PDT) Date: Wed, 19 Jul 2023 22:47:35 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1689806856; 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=om13jL7O3l4YcuKziXRHIegrg+cbxJkA71mYNJPzON4=; b=t9bVuNO9bZzacbOkHO2yZm1GLciWDX5vkiomGwK9NpvP30y0hydDFsRG2pV3gqeKc9R3GS mXTFDj3udXwEhEAc+fbuEbpwY3IYa4ltgA6QvLxHuM1MWaW1/hbA+zdwgJ6Bt4J//9QImr IDhG+WcVwknujkR+Dcvxp+zzQ4Dsv1z4fO3BHdwz2g2U0HF+9K+MCUacTHfquA1M2H98Xe xq/diKFA8hyfvs6CbDA90T7B1fqU17MC3ENXKI41Qeb+adP+0OvoZLvxFehjH3WLvCHuv4 fKkmmuFrmDDy3n5h0urG/FOX9htwlnRTfShQGBUUZGgAY3Tgm5H0vwTH4TalQg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1689806856; 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=om13jL7O3l4YcuKziXRHIegrg+cbxJkA71mYNJPzON4=; b=AQy3D+cCKZr/dZuaP4GDR2HDNNDCkUBeXeBlviuDvNapa8yJZIeQvsaiTBBy7ZrzNZc8+T 6AN1lbzmLLsJsUCw== 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: <168980685594.28540.7546277412646689186.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails 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,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: INBOX X-GMAIL-THRID: 1771891071216204968 X-GMAIL-MSGID: 1771891071216204968 The following commit has been merged into the x86/shstk branch of tip: Commit-ID: 00547ef73ff282eea59cd33b8952f1dcbb4bd4b8 Gitweb: https://git.kernel.org/tip/00547ef73ff282eea59cd33b8952f1dcbb4bd4b8 Author: Rick Edgecombe AuthorDate: Mon, 12 Jun 2023 17:10:45 -07:00 Committer: Rick Edgecombe CommitterDate: Tue, 11 Jul 2023 14:12:19 -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 a7d9e98..018f5c3 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -538,14 +538,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); } /*