Re: [PATCH v4 00/10] Function Granular KASLR

From: Joe Lawrence
Date: Mon Aug 03 2020 - 14:17:54 EST


On 8/3/20 1:45 PM, Kees Cook wrote:
On Mon, Aug 03, 2020 at 02:39:32PM +0300, Evgenii Shatokhin wrote:
There are at least 2 places where high-order memory allocations might happen
during module loading. Such allocations may fail if memory is fragmented,
while physically contiguous memory areas are not really needed there. I
suggest to switch to kvmalloc/kvfree there.

While this does seem to be the right solution for the extant problem, I
do want to take a moment and ask if the function sections need to be
exposed at all? What tools use this information, and do they just want
to see the bounds of the code region? (i.e. the start/end of all the
.text* sections) Perhaps .text.* could be excluded from the sysfs
section list?


[[cc += FChE, see [0] for Evgenii's full mail ]]

It looks like debugging tools like systemtap [1], gdb [2] and its add-symbol-file cmd, etc. peek at the /sys/module/<MOD>/section/ info.

But yeah, it would be preferable if we didn't export a long sysfs representation if nobody actually needs it.


[0] https://lore.kernel.org/lkml/e9c4d88b-86db-47e9-4299-3fac45a7e3fd@xxxxxxxxxxxxx/
[1] https://fossies.org/linux/systemtap/staprun/staprun.c
[2] https://www.oreilly.com/library/view/linux-device-drivers/0596005903/ch04.html#linuxdrive3-CHP-4-SECT-6.1

-- Joe