]> www.infradead.org Git - users/jedix/linux-maple.git/commit
uprobes: sanitiize xol_free_insn_slot()
authorOleg Nesterov <oleg@redhat.com>
Sun, 29 Sep 2024 14:42:35 +0000 (16:42 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Mon, 7 Oct 2024 07:28:44 +0000 (09:28 +0200)
commitc7b4133c48445dde789ed30b19ccb0448c7593f7
tree6f1607568e089309bc692cd46dca226ab748e183
parentb302d5a6fff5dd7ddb1e4752d60c0eaa4cc4f7f3
uprobes: sanitiize xol_free_insn_slot()

1. Clear utask->xol_vaddr unconditionally, even if this addr is not valid,
   xol_free_insn_slot() should never return with utask->xol_vaddr != NULL.

2. Add a comment to explain why do we need to validate slot_addr.

3. Simplify the validation above. We can simply check offset < PAGE_SIZE,
   unsigned underflows are fine, it should work if slot_addr < area->vaddr.

4. Kill the unnecessary "slot_nr >= UINSNS_PER_PAGE" check, slot_nr must
   be valid if offset < PAGE_SIZE.

The next patches will cleanup this function even more.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20240929144235.GA9471@redhat.com
kernel/events/uprobes.c