kaslr should avoid setup_data region
Hello Kees
I'm worrying that setup_data regions could be overwitten by randomize kernel base. Would you like to fix it in kaslr code?
One problem is there could be a lot of setup_data regions but current mem_avoid is an fixed array.
Thanks
Dave
Quoted 7 lines · Dave Young
Hello Kees
I'm worrying that
setup_dataregions could be overwitten by randomize kernel base. Would you like to fix it in kaslr code?One problem is there could be a lot of
setup_dataregions but currentmem_avoidis an fixed array.
Sure, can you give me some examples? Seems like it shouldn't be too hard to have the mem_avoid logic walk additional areas.
-Kees
Signature · 2 lines
Kees Cook Chrome OS Security
Quoted 11 lines · Kees Cook
Quoted 7 lines · Dave Young
Hello Kees
I'm worrying that
setup_dataregions could be overwitten by randomize kernel base. Would you like to fix it in kaslr code?One problem is there could be a lot of
setup_dataregions but currentmem_avoidis an fixed array.Sure, can you give me some examples? Seems like it shouldn't be too hard to have the
mem_avoidlogic walk additional areas.
Great, To walk through the list just like the function parse_setup_data in arch/x86/kernel/setup.c
Thanks
Dave
Ah, it sounds like boot_params.hdr.setup_data contains a series of e820-like entries chained together as a linked list? Which loaders currently populate that? Looks like EFI? Seems like arch/x86/boot/compressed/eboot.c works on setup_data at least.
I won't be in a position to test EFI booting for a while. If someone else took this, that would make it get fixed much faster.
Do you have examples where this is actually causing failures?
-Kees
Quoted 18 lines · Dave Young
Quoted 11 lines · Kees Cook
Quoted 7 lines · Dave Young
Hello Kees
I'm worrying that
setup_dataregions could be overwitten by randomize kernel base. Would you like to fix it in kaslr code?One problem is there could be a lot of
setup_dataregions but currentmem_avoidis an fixed array.Sure, can you give me some examples? Seems like it shouldn't be too hard to have the
mem_avoidlogic walk additional areas.Great, To walk through the list just like the function
parse_setup_datainarch/x86/kernel/setup.cThanks
Dave
Signature · 2 lines
Kees Cook Chrome OS Security
Quoted 11 lines · Kees Cook
Ah, it sounds like boot_params.hdr.setup_data contains a series of e820-like entries chained together as a linked list? Which loaders currently populate that? Looks like EFI? Seems like
arch/x86/boot/compressed/eboot.cworks onsetup_dataat least.I won't be in a position to test EFI booting for a while. If someone else took this, that would make it get fixed much faster.
Do you have examples where this is actually causing failures?
-Kees
Syslinux can populate it with arbitrary data; in particular Syslinux uses it to pass FDT information if requested.
-hpa
Quoted 4 lines · Kees Cook
Ah, it sounds like boot_params.hdr.setup_data contains a series of e820-like entries chained together as a linked list? Which loaders currently populate that? Looks like EFI? Seems like
arch/x86/boot/compressed/eboot.cworks onsetup_dataat least.
AFAIK efi stub, kexec, also as HPA mentioned syslinux use it as well.
kexec use setup_data for passing e820 ext ranges, also use it for efi boot.
Quoted 3 lines
I won't be in a position to test EFI booting for a while. If someone else took this, that would make it get fixed much faster.
Because kaslr is randomizing the base, it's hard to produce the failure.
Quoted 1 line
From the code itself, maybe just iterate the
setup_dataregions and add them
to avoid list, not necessary to care about the setup_data type..
Quoted 2 lines
Do you have examples where this is actually causing failures?
As mentioned above I have no idea how to test. Probably need manually hack the code to create a failure?
Quoted 28 lines
-Kees
Quoted 18 lines · Dave Young
Quoted 11 lines · Kees Cook
Quoted 7 lines · Dave Young
Hello Kees
I'm worrying that
setup_dataregions could be overwitten by randomize kernel base. Would you like to fix it in kaslr code?One problem is there could be a lot of
setup_dataregions but currentmem_avoidis an fixed array.Sure, can you give me some examples? Seems like it shouldn't be too hard to have the
mem_avoidlogic walk additional areas.Great, To walk through the list just like the function
parse_setup_datainarch/x86/kernel/setup.cThanks
DaveSignature · 2 lines
Kees Cook Chrome OS Security
Quoted 2 lines
I won't be in a position to test EFI booting for a while. If someone else took this, that would make it get fixed much faster.
I will hopefully look into it next week. But as I said I can only test with a hacked kernel which set the randomized addr to the setup_data region.
Thanks
Dave
Quoted 5 lines · Kees Cook
Ah, it sounds like boot_params.hdr.setup_data contains a series of e820-like entries chained together as a linked list? Which loaders currently populate that? Looks like EFI? Seems like
arch/x86/boot/compressed/eboot.cworks onsetup_dataat least.
Quoted 23 lines
I won't be in a position to test EFI booting for a while. If someone else took this, that would make it get fixed much faster.
Do you have examples where this is actually causing failures?
-Kees
Quoted 15 lines · Dave Young
Quoted 11 lines · Kees Cook
Quoted 7 lines · Dave Young
Hello Kees
I'm worrying that
setup_dataregions could be overwitten by randomize kernel base. Would you like to fix it in kaslr code?One problem is there could be a lot of
setup_dataregions but currentmem_avoidis an fixed array.Sure, can you give me some examples? Seems like it shouldn't be too hard to have the
mem_avoidlogic walk additional areas.Great, To walk through the list just like the function
parse_setup_datainarch/x86/kernel/setup.c
One problem for me is that I am not sure how to read the setup_data memory and iterate it, I think early_ioremap is not available that early. BTW the setup_data region could be above 4G.
Appreciate for any hints.
Thanks
Dave
Quoted 15 lines · Dave Young
Quoted 14 lines · Kees Cook
Quoted 13 lines · Dave Young
Quoted 11 lines · Kees Cook
Quoted 7 lines · Dave Young
Hello Kees
I'm worrying that
setup_dataregions could be overwitten by randomize kernel base. Would you like to fix it in kaslr code?One problem is there could be a lot of
setup_dataregions but currentmem_avoidis an fixed array.Sure, can you give me some examples? Seems like it shouldn't be too hard to have the
mem_avoidlogic walk additional areas.
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
Great, To walk through the list just like the function
parse_setup_datainarch/x86/kernel/setup.cOne problem for me is that I am not sure how to read the
setup_datamemory and iterate it, I thinkearly_ioremapis not available that early. BTW thesetup_dataregion could be above 4G.Appreciate for any hints.
Hm, I'm not sure. The kASLR code only deals with memory that has been set up during the physical/virtual identity mapping.
-Kees
Signature · 2 lines
Kees Cook Chrome OS Security
Quoted 19 lines · Kees Cook
Quoted 18 lines · Dave Young
Quoted 16 lines · Kees Cook
Quoted 15 lines · Dave Young
Quoted 11 lines · Kees Cook
Quoted 7 lines · Dave Young
Hello Kees
I'm worrying that
setup_dataregions could be overwitten by randomize kernel base. Would you like to fix it in kaslr code?One problem is there could be a lot of
setup_dataregions but currentmem_avoidis an fixed array.Sure, can you give me some examples? Seems like it shouldn't be too hard to have the
mem_avoidlogic walk additional areas.Great, To walk through the list just like the function
parse_setup_datainarch/x86/kernel/setup.c
Quoted 9 lines
Quoted 5 lines
One problem for me is that I am not sure how to read the
setup_datamemory and iterate it, I thinkearly_ioremapis not available that early. BTW thesetup_dataregion could be above 4G.Appreciate for any hints.
Hm, I'm not sure. The kASLR code only deals with memory that has been set up during the physical/virtual identity mapping.
So will dereference them directly and ignore setup_data which is above 4G.
Thanks
Dave