Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1278977

[PATCH v4 1/6] x86: Page align _end to avoid pfn conversion bugs

Path csiph.com!news.mixmin.net!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod
From Matt Fleming <matt@codeblueprint.co.uk>
Newsgroups linux.kernel
Subject [PATCH v4 1/6] x86: Page align _end to avoid pfn conversion bugs
Date Fri, 27 Nov 2015 22:20:01 +0100
Message-ID <qzyAV-85W-15@gated-at.bofh.it> (permalink)
References <qzyrf-82O-3@gated-at.bofh.it>
X-Original-To Ingo Molnar <mingo@kernel.org>, Thomas Gleixner <tglx@linutronix.de>, "H . Peter Anvin" <hpa@zytor.com>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=codeblueprint-co-uk.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=pRVdzyuxR/FqrOyOZF/ybWhmD06hPw/NoWVf35sal2Q=; b=t2EnAL9C/a4LoQtXzh0CVTHn5BOQos6nHtU8opqL7YJhwr1LksKkWD/KQZFKVwO6Lv NOP2koXnnzIdbi4Kv05TmrYu4v+526Ia6FuyINFTGWsZqeBEJsdWqyTKseKiQIWb/ysz YrppLFnd6K75yJJZ4pGQqCBll5ZsAgotMa96ojTvfHkAu07dC5NwqZzfk+IfcBa0LWOb 6EfMyhA1Z7oiynO0CqqAT23hYhU6iIUyGJc16Rej+jLm/pdKpozi6oyztxeMdDKjmHik gTcTjEjq24x2Fv6iBRcCzIJDMh+LnF5KJMJgB2/zJuOgOwD73JCLeeDwwUwxjOMaXwuG edEw==
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:in-reply-to :references; bh=pRVdzyuxR/FqrOyOZF/ybWhmD06hPw/NoWVf35sal2Q=; b=jrw1c/bZvpP5LRQX6OdG0WrjRqmvFIK7mVQYuZ7ft8VjeXXy6yWl/6yRxKg0WdzZKk MKph4M0osR0ZOw5/y3MyYRDLTmGTvPCpHG3uaUO2KYKoO5wOVLgRJxToE55r7yYUKpKX VD/9qG4p4Yl8QmSk0ebskgwC/4UqM1aOfZmj+kq7qEVnis1TXfchj1TkQWbl3Yn6KpwM SJL0txyiRnAVu1KslrftUt0bGIgO1asLZH+gtL8EcU98DAt3aeCrX0bu+yxjAvHshMfB 4nEc3bmAocn46D2QKuxemfkshGd39drtzVt58veY17dtLRCmQPU06Hp3Hp3wv551f4sv cwLw==
X-Gm-Message-State ALoCoQm91416acPLe4zEliRMNKBKD3Fa2zGZmStDvQkgRO/SGCrgkTWyqqeaQXT6t+XlxX5Yku8F
X-Received by 10.28.4.7 with SMTP id 7mr12501034wme.85.1448658578588; Fri, 27 Nov 2015 13:09:38 -0800 (PST)
X-Mailer git-send-email 2.6.2
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 45
Organization linux.* mail to news gateway
X-Original-Cc Toshi Kani <toshi.kani@hp.com>, Matt Fleming <matt@codeblueprint.co.uk>, linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org, Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>, Dave Hansen <dave.hansen@intel.com>, Borislav Petkov <bp@alien8.de>
X-Original-Date Fri, 27 Nov 2015 21:09:30 +0000
X-Original-Message-ID <1448658575-17029-2-git-send-email-matt@codeblueprint.co.uk>
X-Original-References <1448658575-17029-1-git-send-email-matt@codeblueprint.co.uk>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1278977

Show key headers only | View raw


Ingo noted that if we can guarantee _end is aligned to PAGE_SIZE we
can automatically avoid bugs along the lines of,

	size = _end - _text >> PAGE_SHIFT

which is missing a call to PFN_ALIGN(). The EFI mixed mode contains
this bug, for example.

_text is already aligned to PAGE_SIZE through the use of
LOAD_PHYSICAL_ADDR, and the BSS and BRK sections are explicitly
aligned in the linker script, so it makes sense to align _end to
match.

Reported-by: Ingo Molnar <mingo@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "H . Peter Anvin" <hpa@zytor.com>
Cc: Toshi Kani <toshi.kani@hp.com>
Cc: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Borislav Petkov <bp@alien8.de>
Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
---
 arch/x86/kernel/vmlinux.lds.S | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index 74e4bf11f562..4f1994257a18 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -325,6 +325,7 @@ SECTIONS
 		__brk_limit = .;
 	}
 
+	. = ALIGN(PAGE_SIZE);
 	_end = .;
 
         STABS_DEBUG
-- 
2.6.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[GIT PULL v4 0/6] EFI page table isolation Matt Fleming <matt@codeblueprint.co.uk> - 2015-11-27 22:10 +0100
  [PATCH v4 3/6] x86/efi: Map RAM into the identity page table for mixed mode Matt Fleming <matt@codeblueprint.co.uk> - 2015-11-27 22:10 +0100
    [tip:x86/efi] x86/efi:   Map RAM into the identity page table for mixed mode tip-bot for Matt Fleming <tipbot@zytor.com> - 2015-11-29 10:10 +0100
  [PATCH v4 2/6] x86/mm/pageattr: Ensure cpa->pfn only contains page frame numbers Matt Fleming <matt@codeblueprint.co.uk> - 2015-11-27 22:20 +0100
    [tip:x86/efi] x86/mm/pat: Ensure cpa->  pfn only contains page frame numbers tip-bot for Matt Fleming <tipbot@zytor.com> - 2015-11-29 10:10 +0100
  [PATCH v4 4/6] x86/efi: Hoist page table switching code into efi_call_virt() Matt Fleming <matt@codeblueprint.co.uk> - 2015-11-27 22:20 +0100
    [tip:x86/efi] x86/efi:   Hoist page table switching code into efi_call_virt() tip-bot for Matt Fleming <tipbot@zytor.com> - 2015-11-29 10:10 +0100
  [PATCH v4 6/6] Documentation/x86: Update EFI memory region description Matt Fleming <matt@codeblueprint.co.uk> - 2015-11-27 22:20 +0100
    [tip:x86/efi] Documentation/x86:   Update EFI memory region description tip-bot for Matt Fleming <tipbot@zytor.com> - 2015-11-29 10:10 +0100
  [PATCH v4 1/6] x86: Page align _end to avoid pfn conversion bugs Matt Fleming <matt@codeblueprint.co.uk> - 2015-11-27 22:20 +0100
    [tip:x86/efi] x86/mm: Page align the '_end'   symbol to avoid pfn conversion bugs tip-bot for Matt Fleming <tipbot@zytor.com> - 2015-11-29 10:10 +0100
  [PATCH v4 5/6] x86/efi: Build our own page table structures Matt Fleming <matt@codeblueprint.co.uk> - 2015-11-27 22:20 +0100
    [tip:x86/efi] x86/efi: Build our own page table structures tip-bot for Matt Fleming <tipbot@zytor.com> - 2015-11-29 10:10 +0100
  Re: [GIT PULL v4 0/6] EFI page table isolation Ingo Molnar <mingo@kernel.org> - 2015-11-29 09:20 +0100

csiph-web