linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Fix W+X debug feature on x86
@ 2020-05-21 15:23 Steven Price
  2020-05-21 15:23 ` [PATCH 1/2] x86: mm: ptdump: Calculate effective permissions correctly Steven Price
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Steven Price @ 2020-05-21 15:23 UTC (permalink / raw)
  To: Andrew Morton, Andy Lutomirski, Borislav Petkov, Dave Hansen,
	Ingo Molnar, Peter Zijlstra, Thomas Gleixner, x86, Jan Beulich
  Cc: Steven Price, linux-kernel, linux-mm

Jan alert me[1] that the W+X detection debug feature was broken in x86
by my change[2] to switch x86 to use the generic ptdump infrastructure.

Fundamentally the approach of trying to move the calculation of
effective permissions into note_page() was broken because note_page() is
only called for 'leaf' entries and the effective permissions are passed
down via the internal nodes of the page tree. The solution I've taken
here is to create a new (optional) callback which is called for all
nodes of the page tree and therefore can calculate the effective
permissions.

Secondly on some configurations (32 bit with PAE) "unsigned long" is not
large enough to store the table entries. The fix here is simple - let's
just use a u64.

I'd welcome testing (and other comments), especially if you have a
configuration which previously triggered W+X warnings as I don't have
such a setup.

[1] https://lore.kernel.org/lkml/d573dc7e-e742-84de-473d-f971142fa319@suse.com/
[2] 2ae27137b2db ("x86: mm: convert dump_pagetables to use walk_page_range")

Steven Price (2):
  x86: mm: ptdump: Calculate effective permissions correctly
  mm: ptdump: Expand type of 'val' in note_page()

 arch/arm64/mm/dump.c          |  2 +-
 arch/x86/mm/dump_pagetables.c | 33 ++++++++++++++++++++-------------
 include/linux/ptdump.h        |  3 ++-
 mm/ptdump.c                   | 17 ++++++++++++++++-
 4 files changed, 39 insertions(+), 16 deletions(-)

-- 
2.20.1



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-05-27 16:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-21 15:23 [PATCH 0/2] Fix W+X debug feature on x86 Steven Price
2020-05-21 15:23 ` [PATCH 1/2] x86: mm: ptdump: Calculate effective permissions correctly Steven Price
     [not found]   ` <20200522180741.GB1337@Qians-MacBook-Air.local>
2020-05-26 10:41     ` Steven Price
2020-05-27 15:15   ` Jan Beulich
2020-05-27 15:55     ` Steven Price
2020-05-21 15:23 ` [PATCH 2/2] mm: ptdump: Expand type of 'val' in note_page() Steven Price
2020-05-21 19:08 ` [PATCH 0/2] Fix W+X debug feature on x86 Andrew Morton
2020-05-22 12:50   ` Steven Price

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).