[PATCH] riscv: Fix W+X mapping warning
Kefeng Wang
wangkefeng.wang at huawei.com
Thu Nov 12 02:29:27 EST 2020
On 2020/11/12 15:10, Atish Patra wrote:
> On Wed, Nov 11, 2020 at 10:44 PM Kefeng Wang <wangkefeng.wang at huawei.com> wrote:
>> When boot with DEBUG_WX triggers the WX warning,
>> riscv/mm: Found insecure W+X mapping at address ffffffe000000000/0xffffffe000000000
>> WARNING: CPU: 1 PID: 1 at arch/riscv/mm/ptdump.c:236 note_page+0x248/0x25a
>> ...
>> Checked W+X mappings: failed, 512 W+X pages found
>>
>> The kernel_page_tables shows first 2M(kernel image) is with W attribute,
>> Use _start instead of text_start in mark_rodata_ro().
>>
>> Before,
>> 0xffffffe000000000-0xffffffe000200000 0x0000000080200000 2M PMD D A . . X W R V
>> 0xffffffe000200000-0xffffffe000a00000 0x0000000080400000 8M PMD D A . . X . R V
>> 0xffffffe000a00000-0xffffffe001000000 0x0000000080c00000 6M PMD D A . . . . R V
>> 0xffffffe001000000-0xffffffe17fe00000 0x0000000081200000 6126M PMD D A . . . W R V
>>
>> After,
>> 0xffffffe000000000-0xffffffe000a00000 0x0000000080200000 10M PMD D A . . X . R V
>> 0xffffffe000a00000-0xffffffe001000000 0x0000000080c00000 6M PMD D A . . . . R V
>> 0xffffffe001000000-0xffffffe17fe00000 0x0000000081200000 6126M PMD D A . . . W R V
>>
> This is already fixed by the following series.
> https://patchwork.kernel.org/project/linux-riscv/list/?series=377843
Got it.
>
More information about the linux-riscv
mailing list