From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 14D49C4167B for ; Wed, 29 Nov 2023 11:18:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Message-ID: References:Mime-Version:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=mpdOE88F4X+oEZoFLweSRZgtbt9EBm4vf38NE5eREv4=; b=ABxgdbuWRULmtDv/7GSZtLWqc7 BpMbKQYNHRmPNRIfVHiR6DjsSFhRv0u1b/1yaGZ3AiHdQlCahrbzwp9ueNhWoIw3GbWUzq1mWGoAC /Cjhjxj12DELNoGZrhzWCofJx7Cu1RqfMqhP8pUdgvrrsCO/M+MqtlviYXWtoV5CqxfNyE06SVPRn yhJzbQhM5Fv1k4g/zblIiGWYQFBPGbPEcHm9PCR+tZ8I70YRoij3LUduLkYmtJZMMNIqu09wT6POL M2ZILpMHjntN7sqpW4uCu0jcRZgL6sWZyIPp8QEjsqadtFVFHEsioDZ0nwDEGDlNUlQXbINLisNH4 LBipeQpw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r8IZo-007zPz-0U; Wed, 29 Nov 2023 11:17:56 +0000 Received: from mail-yw1-x1149.google.com ([2607:f8b0:4864:20::1149]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r8IZN-007z0n-1o for linux-arm-kernel@lists.infradead.org; Wed, 29 Nov 2023 11:17:31 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-5cd573c2cccso6154137b3.1 for ; Wed, 29 Nov 2023 03:17:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701256648; x=1701861448; darn=lists.infradead.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=QcyQzQvrhZSKuGh+IrENHro9WhaIhDqkoV92ZoY5+Bs=; b=FRLwj8O2ZmyqkodkDd1Y/omO797qmRq4M/k2R3uyl7Qo5y7yQ5mUuGzrhHRKONLqiJ +pw3J8ewa1bWx8Ddo5CGtpD8Fbjes/h7zdMrYq3pi9qIqbf1bROrUcYgzxdWWoOv+Rb0 mYx03Pr3SX6vVcbR9Oi7NkPTHHyAyIO5MlzT2D++/gahwfMoEZk4l/zBe4Vb9SPmLv80 XsEPlDLrp4IKwUwewo3ago1oaZuLm7fKzbklfVdQvdkDtWkRw45RfgB9mhqo2bwSj/Nj PnxTO4tU9rCORZxpvLiAIARqIHv2TvPeu4Da250lx7OrMsYxfbkecOSMhJtOFa0I3T8B 53iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701256648; x=1701861448; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=QcyQzQvrhZSKuGh+IrENHro9WhaIhDqkoV92ZoY5+Bs=; b=BYv0yqC6CqqfYm1NMpe3JKTbsvt4tt1XhtT8AYDcJA0iRI4nio5E8v+hVftNzttlzg Ta0+3aFsK3Q6SlaP4xTi/HuOOKulofbv/RrFjhmUt1Fz64rZ9v350Wp5aVwKdx9iVHVD CMzplNyRbTJYXXtO+8wXho8lWK86E/fPijuG14xUZPcSGZccgBstpX3FKcUaZyzqdcbU sAbkxWJk29MwITH5UsLBXtfzL5xShdvWtfrVaw9SBUiYKQymHWfDj75iYM5R1SJXt3xd mKlCofVjW3DuNiK2BtxLVysjdFKUjyVnkAzyvbjjYL3u+t1x4yXbIE56FMNKhg0r6BRj 1BGw== X-Gm-Message-State: AOJu0YxMqPdsXXpqeX2NOfMJeB/ep1aNar2NU8jv2fC4OYrh0V/ZtdBX 8ckgAzRecPxpOtKlIB/DuAR9WKcVJtMIhU2PyRGpmUTLAxIcq7zp8YfWTxJF9sWbB4TP5GErxnR bAPuZpRGsmYci6elFoH97HfeH+PcskvbXv9h7NKZaCAf1wdzsFMdvvFphszJ9j8Mgh6yNnEDl/V I= X-Google-Smtp-Source: AGHT+IGPjsjiq14ztj7JhLJsSVeZWPDx58z0zMN2aUGIN6m94aLfwFJx6Qso7HSSnQsorQ5qF5tI+8p4 X-Received: from palermo.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:118a]) (user=ardb job=sendgmr) by 2002:a05:690c:488a:b0:5cc:c836:ac1d with SMTP id hd10-20020a05690c488a00b005ccc836ac1dmr928380ywb.5.1701256648101; Wed, 29 Nov 2023 03:17:28 -0800 (PST) Date: Wed, 29 Nov 2023 12:16:02 +0100 In-Reply-To: <20231129111555.3594833-43-ardb@google.com> Mime-Version: 1.0 References: <20231129111555.3594833-43-ardb@google.com> X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-Developer-Signature: v=1; a=openpgp-sha256; l=3329; i=ardb@kernel.org; h=from:subject; bh=WFd4jQ912fgRJirpPKRfxk61zUoZ4kmCkhvh5bpu8Rc=; b=owGbwMvMwCFmkMcZplerG8N4Wi2JITVdtviI4/rrlxdn9EnHb9FZXsdouEtLdf3b+GM9l/7tN KxSsVrdUcrCIMbBICumyCIw+++7nacnStU6z5KFmcPKBDKEgYtTACbS7cnI8GfZ0W2XHmgUOD2b LX+lZn24NkfJrpOM3gwzNJvLypcZ9jMyPPjFf0Rf+HfSmame9xo6fy7usFhQypxXw7lEtUalfSk zKwA= X-Mailer: git-send-email 2.43.0.rc1.413.gea7ed67945-goog Message-ID: <20231129111555.3594833-49-ardb@google.com> Subject: [PATCH v6 06/41] arm64: ptdump: Allow all region boundaries to be defined at boot time From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Cc: Ard Biesheuvel , Catalin Marinas , Will Deacon , Marc Zyngier , Mark Rutland , Ryan Roberts , Anshuman Khandual , Kees Cook X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231129_031729_620384_518D0CC2 X-CRM114-Status: GOOD ( 14.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Ard Biesheuvel Rework the way the address_markers array is populated so that we can tolerate values that are not compile time constants generally, rather than keeping track manually of the array indexes in question, and poking new values into them manually. This will be needed for VMALLOC_END, which will cease to be a compile time constant after a subsequent patch. Signed-off-by: Ard Biesheuvel --- arch/arm64/mm/ptdump.c | 54 ++++++++------------ 1 file changed, 22 insertions(+), 32 deletions(-) diff --git a/arch/arm64/mm/ptdump.c b/arch/arm64/mm/ptdump.c index 3958b008f908..bfc307890344 100644 --- a/arch/arm64/mm/ptdump.c +++ b/arch/arm64/mm/ptdump.c @@ -26,34 +26,6 @@ #include -enum address_markers_idx { - PAGE_OFFSET_NR = 0, - PAGE_END_NR, -#if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS) - KASAN_START_NR, -#endif -}; - -static struct addr_marker address_markers[] = { - { PAGE_OFFSET, "Linear Mapping start" }, - { 0 /* PAGE_END */, "Linear Mapping end" }, -#if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS) - { 0 /* KASAN_SHADOW_START */, "Kasan shadow start" }, - { KASAN_SHADOW_END, "Kasan shadow end" }, -#endif - { MODULES_VADDR, "Modules start" }, - { MODULES_END, "Modules end" }, - { VMALLOC_START, "vmalloc() area" }, - { VMALLOC_END, "vmalloc() end" }, - { VMEMMAP_START, "vmemmap start" }, - { VMEMMAP_START + VMEMMAP_SIZE, "vmemmap end" }, - { PCI_IO_START, "PCI I/O start" }, - { PCI_IO_END, "PCI I/O end" }, - { FIXADDR_TOT_START, "Fixmap start" }, - { FIXADDR_TOP, "Fixmap end" }, - { -1, NULL }, -}; - #define pt_dump_seq_printf(m, fmt, args...) \ ({ \ if (m) \ @@ -339,9 +311,8 @@ static void __init ptdump_initialize(void) pg_level[i].mask |= pg_level[i].bits[j].mask; } -static struct ptdump_info kernel_ptdump_info = { +static struct ptdump_info kernel_ptdump_info __ro_after_init = { .mm = &init_mm, - .markers = address_markers, .base_addr = PAGE_OFFSET, }; @@ -375,10 +346,29 @@ void ptdump_check_wx(void) static int __init ptdump_init(void) { - address_markers[PAGE_END_NR].start_address = PAGE_END; + struct addr_marker m[] = { + { PAGE_OFFSET, "Linear Mapping start" }, + { PAGE_END, "Linear Mapping end" }, #if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS) - address_markers[KASAN_START_NR].start_address = KASAN_SHADOW_START; + { KASAN_SHADOW_START, "Kasan shadow start" }, + { KASAN_SHADOW_END, "Kasan shadow end" }, #endif + { MODULES_VADDR, "Modules start" }, + { MODULES_END, "Modules end" }, + { VMALLOC_START, "vmalloc() area" }, + { VMALLOC_END, "vmalloc() end" }, + { VMEMMAP_START, "vmemmap start" }, + { VMEMMAP_START + VMEMMAP_SIZE, "vmemmap end" }, + { PCI_IO_START, "PCI I/O start" }, + { PCI_IO_END, "PCI I/O end" }, + { FIXADDR_TOT_START, "Fixmap start" }, + { FIXADDR_TOP, "Fixmap end" }, + { -1, NULL }, + }; + static struct addr_marker address_markers[ARRAY_SIZE(m)] __ro_after_init; + + kernel_ptdump_info.markers = memcpy(address_markers, m, sizeof(m)); + ptdump_initialize(); ptdump_debugfs_register(&kernel_ptdump_info, "kernel_page_tables"); return 0; -- 2.43.0.rc1.413.gea7ed67945-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel