Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp5030783rdb; Fri, 15 Sep 2023 23:21:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF704ivx5O9HxkMZ+nw2Z9ASdK8QPzVrw3SAq1U5qkqT4ywz0JEg6q3CMSL9c7YEJiLDjb+ X-Received: by 2002:a05:6870:468a:b0:1d6:1668:db8a with SMTP id a10-20020a056870468a00b001d61668db8amr4526394oap.39.1694845262049; Fri, 15 Sep 2023 23:21:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694845262; cv=none; d=google.com; s=arc-20160816; b=fJw4JaWP9VL8X2LoscvOd90827dKxsNprSE0Gsrq9Y3W1p7gBfyEe95nYVRSr/mV0l wwQBA7OB9Owgn8wRxy8YIqdFWWlhddrjOJx5edC8aoOJMuQWNYPHR5U4LXC0D7+BhewP NwlySF4D0fR+hKvfc073E0PfUSOOLUo0WwL5g434YDekhF+8CLeVsj61dPmJsWj/ph37 /fhCzp8mBnqZD15tqNWBmFI8pYMtFq+R1CxQ0VF6zWOaXnJa/H4Yi5ZQ4IBKMapKZKJH wrnbLy258PUTIvrVwOf96dkjh25N3YtXHxllBzWabSyKyIJqz+lz4i84nXvGUs52EdBB qYUg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=lNAcEM45JnuCfTSJI3E/dx3IgazeK//Dr+dUsENW/9I=; fh=FTiM3T9T418OputrTDREZ9DN7pbk+f6xIJX3dmsYMEc=; b=z/FYl4alx16y0z7P2pjSOF/vskSUXxJRN6exFt/lqeqbDTaYylnRtMH7UxEk+/MPgs OqotKJnH0F2ZND0md+pxm9TZ9l2lsYD0Jv4vMhOxl1c/95Tx6glA0xYuNYSI5fy2LM8V CSMr4bbsxOhqIdAL6VKrw83SwWkLgSqchVK5wfpMtwyRH99n5QWrytBx5k26q1qSn63e tAff+i7XhlHWy/xXli13aeNqZrGbLCg/6XIgAh386tmTdR5tva3PPygudRW3Ub1EvtGO C6zNbIJRhFwkRdg1vF0IpiwGVRDtz5GsHs5Zfr1AN1/MWIj9LWjPZ6Tc09dDQO9zcytj 4YxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=dErwtPH2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id l12-20020a056a00140c00b0068e44a5e7ffsi4551141pfu.90.2023.09.15.23.21.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 23:21:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=dErwtPH2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id E898B8352EF6; Fri, 15 Sep 2023 19:19:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237972AbjIPCTT (ORCPT + 99 others); Fri, 15 Sep 2023 22:19:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231650AbjIPCSs (ORCPT ); Fri, 15 Sep 2023 22:18:48 -0400 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2449EFA for ; Fri, 15 Sep 2023 19:18:43 -0700 (PDT) Received: by mail-pg1-x536.google.com with SMTP id 41be03b00d2f7-565e54cb93aso1728274a12.3 for ; Fri, 15 Sep 2023 19:18:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1694830722; x=1695435522; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=lNAcEM45JnuCfTSJI3E/dx3IgazeK//Dr+dUsENW/9I=; b=dErwtPH2G7abDL5kB5qiGhpulzgA5oK2y0zkfp9GNJk4LH2sASgp46k9IgrS/USCvW o314qKE6fVK4/+0TrC7RogNKAno77k86WiE1r30sveWDMrNlrsYdbWQ7FGvXKTdhJ7pq 9WqeFwo3BBWBE6YLyYcn3/2H4u8e8GWwI9LL8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694830722; x=1695435522; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=lNAcEM45JnuCfTSJI3E/dx3IgazeK//Dr+dUsENW/9I=; b=JhsOuCuFnh2RXbmh+VYsOIca4rVRyBCqWBzjbQUmyNFq3hNey5dDIIOAOQi7B6xy4W y6yNu1HgGwYR9xDWmJ94KTH7uQozW4FNXgcM4guKSfQag5M4h+g7MiNWbSC5rB714Aiq rVGnBhyt8WlTATkYhcMQhHq+JNV7XkdWx69aksXsgF7uty/cESOQDeIMAcvEalGhSzn+ fHz4RrUnIY+//acmPxvYRXDnRFm1OYkyk+mHlUDs+4tR6Khs9g1lZO7kGerDfU4fa1RI v8buE/CrXRpU5NZGNUVyqPLV0BMgY8lxn8rWBgEMweChfTIH9eEls5kyot6SsS6XyLjX ZDLQ== X-Gm-Message-State: AOJu0YwrrVdZkqLPaD76b5tTE+PJeFaFqm8Y3xGPUChCc1h+Fy/otuhc kXQH3pcnHCwu8q8VGQLXF6XX5w== X-Received: by 2002:a05:6a20:3206:b0:15a:58c8:b10f with SMTP id hl6-20020a056a20320600b0015a58c8b10fmr2994151pzc.43.1694830722637; Fri, 15 Sep 2023 19:18:42 -0700 (PDT) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id p4-20020a170902a40400b001b03a1a3151sm4116061plq.70.2023.09.15.19.18.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 19:18:41 -0700 (PDT) From: Kees Cook To: Matteo Rizzo Cc: Kees Cook , Jann Horn , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: [PATCH] x86/mm/dump_pagetables: Add SLAB_VIRTUAL knowledge Date: Fri, 15 Sep 2023 19:18:39 -0700 Message-Id: <20230916021835.never.147-kees@kernel.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1869; i=keescook@chromium.org; h=from:subject:message-id; bh=HmsovkvkpuwppfIJaKsY4lAxAF0+pyYONDwvgfgBOPE=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBlBRB/T8jhFzJbx6o5pyHiafrDVYrG9hl2ENXaj 1vL0IdviLGJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCZQUQfwAKCRCJcvTf3G3A JmvID/9kiQNsFcjzH+6NwX2OKRtQtlFTPX4yZBTLdnCSlSxoiZOn1Um7n4ushYsTSH9QPZ2ddwb ZO0VP2CD4+wb17Lra8vU4oBGVa7Qou3CMDgsmY29UzQAgJMybMY2IA7PK6tsbotWnW9A0fD50ux yzmULaSqemZOWBFAe7ahP5HoWMdrmi45KP/vnhSAJbiTrIYUBueQQectsRg2UEufA3kpMGFpyRc vuRQVGyTzX6c/w7jLd9IP06ww2nvV9deNlrTD0khFfDrR40jbKZ4YkHRuiS7DD9fDvuRKMAU0QX FkOWDs7Mvx/UO44vjmmLT6g9/T/temLWY4ud/DGWD2mZm7FD6wmCKCxFTgzKQSD/P90lhr9o217 rOulVz8VirrktInFxsA3t0ODzZpdyyMk3w48IOt+uXWi/Z3Ql8D3303wxw5XbNpSiFk9AwGhagg vx238fBXuPczyRGAzINKeLr/5u5vt8ErQmw1Tzij2Ph1UOVzGUwyDTTFTd9FP0HMDN+XqFG8T3B kE4REF5HqLOMJLVDOJjHJLpRnDkuO6gOMeLnoX+JEpJByYJex8wltdRkjYGRjh14psEpBsZaAU5 MCc6f8enuWqjL04mNW/SYQfAfq8gqQ/h/i1Pz8/vZB3hAMqTbLsopoZ2D7u1Mx7xr2jlhk/qqJh lchwYnO C2pRB0MQ== X-Developer-Key: i=keescook@chromium.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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]); Fri, 15 Sep 2023 19:19:52 -0700 (PDT) Add the markings for the SLAB_VIRTUAL area. Cc: Matteo Rizzo Cc: Jann Horn Cc: Dave Hansen Cc: Andy Lutomirski Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: x86@kernel.org Cc: "H. Peter Anvin" Signed-off-by: Kees Cook --- This is on top of the SLAB_VIRTUAL series: https://lore.kernel.org/all/20230915105933.495735-11-matteorizzo@google.com/ Feel free to collapse this into the x86 patch from the above series. FYI, as expected, the kernel page table entries get way longer with SLAB_VIRTUAL. :) Without SLAB_VIRTUAL: # wc -l /sys/kernel/debug/page_tables/kernel 1501 /sys/kernel/debug/page_tables/kernel With SLAB_VIRTUAL: # wc -l /sys/kernel/debug/page_tables/kernel 7549 /sys/kernel/debug/page_tables/kernel --- arch/x86/mm/dump_pagetables.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c index e1b599ecbbc2..b1fa68669e61 100644 --- a/arch/x86/mm/dump_pagetables.c +++ b/arch/x86/mm/dump_pagetables.c @@ -64,6 +64,9 @@ enum address_markers_idx { KASAN_SHADOW_END_NR, #endif CPU_ENTRY_AREA_NR, +#ifdef CONFIG_SLAB_VIRTUAL + SLAB_AREA_NR, +#endif #ifdef CONFIG_X86_ESPFIX64 ESPFIX_START_NR, #endif @@ -95,6 +98,9 @@ static struct addr_marker address_markers[] = { [LDT_NR] = { 0UL, "LDT remap" }, #endif [CPU_ENTRY_AREA_NR] = { CPU_ENTRY_AREA_BASE,"CPU entry Area" }, +#ifdef CONFIG_SLAB_VIRTUAL + [SLAB_AREA_NR] = { SLAB_BASE_ADDR, "Slab Area" }, +#endif #ifdef CONFIG_X86_ESPFIX64 [ESPFIX_START_NR] = { ESPFIX_BASE_ADDR, "ESPfix Area", 16 }, #endif -- 2.34.1