forked from luck/tmp_suning_uos_patched
x86/brk: make the brk reservation symbols inaccessible from C
Impact: bulletproofing, clarification The brk reservation symbols are just there to document the amount of space reserved by brk users in the final vmlinux file. Their addresses are irrelevent, and using their addresses will cause certain havok. Name them ".brk.NAME", which is a valid asm symbol but C can't reference it; it also highlights their special role in the symbol table. Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
This commit is contained in:
parent
60ac982139
commit
0b1c723d0b
@ -116,13 +116,13 @@ void *extend_brk(size_t size, size_t align);
|
|||||||
* executable.)
|
* executable.)
|
||||||
*/
|
*/
|
||||||
#define RESERVE_BRK(name,sz) \
|
#define RESERVE_BRK(name,sz) \
|
||||||
static void __section(.discard) __used \
|
static void __section(.discard) __used \
|
||||||
__brk_reservation_fn_##name##__(void) { \
|
__brk_reservation_fn_##name##__(void) { \
|
||||||
asm volatile ( \
|
asm volatile ( \
|
||||||
".pushsection .brk_reservation,\"aw\",@nobits;" \
|
".pushsection .brk_reservation,\"aw\",@nobits;" \
|
||||||
"__brk_reservation_" #name "__:" \
|
".brk." #name ":" \
|
||||||
" 1:.skip %c0;" \
|
" 1:.skip %c0;" \
|
||||||
" .size __brk_reservation_" #name "__, . - 1b;" \
|
" .size .brk." #name ", . - 1b;" \
|
||||||
" .popsection" \
|
" .popsection" \
|
||||||
: : "i" (sz)); \
|
: : "i" (sz)); \
|
||||||
}
|
}
|
||||||
@ -141,9 +141,9 @@ void __init x86_64_start_reservations(char *real_mode_data);
|
|||||||
#else
|
#else
|
||||||
#define RESERVE_BRK(name,sz) \
|
#define RESERVE_BRK(name,sz) \
|
||||||
.pushsection .brk_reservation,"aw",@nobits; \
|
.pushsection .brk_reservation,"aw",@nobits; \
|
||||||
__brk_reservation_##name##__: \
|
.brk.name: \
|
||||||
1: .skip sz; \
|
1: .skip sz; \
|
||||||
.size __brk_reservation_##name##__,.-1b; \
|
.size .brk.name,.-1b; \
|
||||||
.popsection
|
.popsection
|
||||||
#endif /* __ASSEMBLY__ */
|
#endif /* __ASSEMBLY__ */
|
||||||
#endif /* __KERNEL__ */
|
#endif /* __KERNEL__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user