]> sourceware.org Git - systemtap.git/commit
PR26697: fix NULL pointer deref in get_utrace_lock()
authorSultan Alsawaf <sultan@openresty.com>
Thu, 1 Oct 2020 22:19:47 +0000 (15:19 -0700)
committerYichun Zhang (agentzh) <yichun@openresty.com>
Thu, 1 Oct 2020 22:27:55 +0000 (15:27 -0700)
commit619f6940d8ca36bc2a0845c2b34646f26d30dfb7
tree9744be3ce0f980d67474fb4792d3cfa2da949da5
parent212352420f7504b78d34a60b3e4614329eb29256
PR26697: fix NULL pointer deref in get_utrace_lock()

task_utrace_struct() can return NULL via __task_utrace_struct(). This fixes
the following crash:
BUG: unable to handle kernel NULL pointer dereference at           (null)
 #9 [ffff8843e56ffd20] get_utrace_lock at ffffffffc08258c6 [stap_X_40544]

The reason why it can return NULL is because engine->ops is protected by
utrace->lock, but we don't have the utrace pointer, and the purpose of
get_utrace_lock() is to get the utrace pointer. Therefore, there's no way
to ensure engine->ops remains unchanged inside get_utrace_lock(), so
get_utrace_lock()'s checks on engine->ops can be incorrect/stale, which
leads to the NULL pointer dereference.

Signed-off-by: Yichun Zhang (agentzh) <yichun@openresty.com>
runtime/stp_utrace.c
This page took 0.026781 seconds and 5 git commands to generate.