Re: 30514effc9 ("x86/mm/pti: Don't clear permissions in .."): WARNING: CPU: 0 PID: 1 at arch/x86/mm/dump_pagetables.c:283 note_page

From: Joerg Roedel
Date: Wed Aug 08 2018 - 05:47:06 EST


Hi,

thanks for the report!

On Wed, Aug 08, 2018 at 05:26:53PM +0800, kernel test robot wrote:
> [ 16.937839] Freeing unused kernel image memory: 556K
> [ 16.954368] x86/mm: Checked W+X mappings: passed, no W+X pages found.
> [ 16.956696] x86/mm: Checking user space page tables
> [ 16.973108] ------------[ cut here ]------------
> [ 16.975052] x86/mm: Found insecure W+X mapping at address (____ptrval____)/native_usergs_sysret64+0x0/0x10
> [ 16.978787] WARNING: CPU: 0 PID: 1 at arch/x86/mm/dump_pagetables.c:283 note_page+0xdd/0x890

I think this is caused by debug_checkrwx() running before
pti_finalize(). The check runs on the user page-tables before they are
finished. I prepare a patch to move the check for the user page-table to
pti_finilize() after the page-tables are updated. That should fix the
warning.


Thanks,

Joerg