From patchwork Thu Aug 18 14:47:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Garnier X-Patchwork-Id: 9288355 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 36CA6607FF for ; Thu, 18 Aug 2016 14:47:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 282F82876E for ; Thu, 18 Aug 2016 14:47:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1C7E9287B7; Thu, 18 Aug 2016 14:47:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id 4A0BC2876E for ; Thu, 18 Aug 2016 14:47:31 +0000 (UTC) Received: (qmail 15578 invoked by uid 550); 18 Aug 2016 14:47:29 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: kernel-hardening@lists.openwall.com Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 15560 invoked from network); 18 Aug 2016 14:47:29 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=iyqr7iuNz4N6E61+qzU31zau38nwr1pmINRVRRVSboU=; b=nJhIKBqJjrnGpozH25CRSSMH+aA/V5ILDpRoUroDB5hGmHhISIs8CEl5SRfjzFmA2w nYtRtfRZOYvks012l2BTOzx33LiDy0y5MrhnTcSjS2E9bLPtBOgr3sqNVYgqxgKwWcnB zR3sq4Zb8PRRXRZ9x1yxKnEQLiYDv72aFetKiwNsngSxdARfejlHn53fyMUS4qaHoScb 630akBQEk+fOY4WpkK+aac8VjEGddX3UtKXmVRUuNGloO6tPPTY6M9MKj66oKQBY5FaU GxGWDdsgs48EEp0oW7KaCmlfFbQnH51/lE5Yeiz42xKLuEWp/EN4vAVJynbZLpVVNl/X rtCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=iyqr7iuNz4N6E61+qzU31zau38nwr1pmINRVRRVSboU=; b=G+PZjo9yK6Ge8ZEMCgv/N3Z7XTE6vHwLyvT/juAHV3GO4o339Se8oO0M+yH5WvJm9r YjIXLhg3sMEgeTOeom3e1PRBng/y8RgYbJzQ5jt/IYa9+SJjurlXAP/nd7ri296eA39a auDRALiy4DZrGnwSAqEqtnfu60t7Am01o0f7J3Q0SQ4WnllHYA0ZW9Jr8zBWqig/bKAT JjaKjH1XHJKwh6cTgw2Te/4RtPRKBezMJmf5be10BYNmxjCHZJGdRjJ40+TrqPSBLEsR jNxR1RNyYa6af+OOvrc2ZJw75fPNSilD4VSKHNjmRM9wP6TZpO2mHQx+hV57EWkEYYKY VwYA== X-Gm-Message-State: AEkoousVt8xnQGghpTU7+W7DCk0tiFRhSD1XGJk/gP2QP19Mme7FbCczrpQA3Ut//ZVPygvV X-Received: by 10.98.135.13 with SMTP id i13mr4809644pfe.44.1471531636802; Thu, 18 Aug 2016 07:47:16 -0700 (PDT) From: Thomas Garnier To: Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , Eric Biederman , Andrew Morton , Xunlei Pang , Thomas Garnier , HATAYAMA Daisuke Cc: x86@kernel.org, linux-kernel@vger.kernel.org, kexec@lists.infradead.org, keescook@chromium.org, kernel-hardening@lists.openwall.com, surovegin@google.com Date: Thu, 18 Aug 2016 07:47:12 -0700 Message-Id: <1471531632-23003-1-git-send-email-thgarnie@google.com> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 Subject: [kernel-hardening] [PATCH v1] kdump, vmcoreinfo: report memory sections virtual addresses X-Virus-Scanned: ClamAV using ClamSMTP KASLR memory randomization can randomize the base of the physical memory mapping (PAGE_OFFSET), vmalloc (VMALLOC_START) and vmemmap (VMEMMAP_START). Adding these variables on VMCOREINFO so tools can easily identify the base of each memory section. Signed-off-by: Thomas Garnier Acked-by: Baoquan He Acked-by: Kees Cook --- Based on next-20160817 --- arch/x86/kernel/machine_kexec_64.c | 3 +++ include/linux/kexec.h | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c index fc3389f..b1f15a2 100644 --- a/arch/x86/kernel/machine_kexec_64.c +++ b/arch/x86/kernel/machine_kexec_64.c @@ -338,6 +338,9 @@ void arch_crash_save_vmcoreinfo(void) vmcoreinfo_append_str("KERNELOFFSET=%lx\n", kaslr_offset()); VMCOREINFO_PHYS_BASE(phys_base); + VMCOREINFO_PAGE_OFFSET(PAGE_OFFSET); + VMCOREINFO_VMALLOC_START(VMALLOC_START); + VMCOREINFO_VMEMMAP_START(VMEMMAP_START); } /* arch-dependent functionality related to kexec file-based syscall */ diff --git a/include/linux/kexec.h b/include/linux/kexec.h index d3ae429..cd3874c 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h @@ -261,6 +261,12 @@ phys_addr_t paddr_vmcoreinfo_note(void); vmcoreinfo_append_str("CONFIG_%s=y\n", #name) #define VMCOREINFO_PHYS_BASE(value) \ vmcoreinfo_append_str("PHYS_BASE=%lx\n", (unsigned long)value) +#define VMCOREINFO_PAGE_OFFSET(value) \ + vmcoreinfo_append_str("PAGE_OFFSET=%lx\n", (unsigned long)value) +#define VMCOREINFO_VMALLOC_START(value) \ + vmcoreinfo_append_str("VMALLOC_START=%lx\n", (unsigned long)value) +#define VMCOREINFO_VMEMMAP_START(value) \ + vmcoreinfo_append_str("VMEMMAP_START=%lx\n", (unsigned long)value) extern struct kimage *kexec_image; extern struct kimage *kexec_crash_image;