codegen: stack: allow for inter-tid stack aggregation
User-space stacks are quite special in regards to aggregation (and
comparison) between processes. To a first approximation, each pid has a
different memory mapping and thus pointers should not be compared or
aggregated between pids[*]. With ASLR this becomes even more fun, and
thus it is necessary to do usym()-style packing of the stackid for
ustack (since bpf_get_stackid will give you a hash of the pointers --
even in the ustack case).
However, the kernel address space is the same regardless of current->pid
-- and in many cases you want to aggregate between different processes
(and if not, you can always do the packing yourself with @[tid,stack]).
So, we only apply the packing when dealing with ustack. sym() already
does the right thing.
[*] This is more than slightly untrue -- really this depends on
current->mm and ideally we would aggregate ustack on current->mm.
Unfortunately this is not a luxury we have at the moment.
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
Showing
Please register or sign in to comment