mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-29 13:23:23 +01:00
livepatch: Simplify stack trace retrieval
Replace the indirection through struct stack_trace by using the storage array based interfaces. Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Josh Poimboeuf <[email protected]> Acked-by: Miroslav Benes <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: Alexander Potapenko <[email protected]> Cc: Alexey Dobriyan <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Christoph Lameter <[email protected]> Cc: Pekka Enberg <[email protected]> Cc: [email protected] Cc: David Rientjes <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Dmitry Vyukov <[email protected]> Cc: Andrey Ryabinin <[email protected]> Cc: [email protected] Cc: Mike Rapoport <[email protected]> Cc: Akinobu Mita <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: [email protected] Cc: Robin Murphy <[email protected]> Cc: Marek Szyprowski <[email protected]> Cc: Johannes Thumshirn <[email protected]> Cc: David Sterba <[email protected]> Cc: Chris Mason <[email protected]> Cc: Josef Bacik <[email protected]> Cc: [email protected] Cc: [email protected] Cc: Mike Snitzer <[email protected]> Cc: Alasdair Kergon <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: [email protected] Cc: Joonas Lahtinen <[email protected]> Cc: Maarten Lankhorst <[email protected]> Cc: [email protected] Cc: David Airlie <[email protected]> Cc: Jani Nikula <[email protected]> Cc: Rodrigo Vivi <[email protected]> Cc: Tom Zanussi <[email protected]> Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected]
This commit is contained in:
1 parent
9f50c91b11
commit
25e39e32b0
1 file changed
+9
-13
@@ -202,15 +202,15 @@ void klp_update_patch_state(struct task_struct *task)
|
||||
* Determine whether the given stack trace includes any references to a
|
||||
* to-be-patched or to-be-unpatched function.
|
||||
*/
|
||||
static int klp_check_stack_func(struct klp_func *func,
|
||||
struct stack_trace *trace)
|
||||
static int klp_check_stack_func(struct klp_func *func, unsigned long *entries,
|
||||
unsigned int nr_entries)
|
||||
{
|
||||
unsigned long func_addr, func_size, address;
|
||||
struct klp_ops *ops;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < trace->nr_entries; i++) {
|
||||
address = trace->entries[i];
|
||||
for (i = 0; i < nr_entries; i++) {
|
||||
address = entries[i];
|
||||
|
||||
if (klp_target_state == KLP_UNPATCHED) {
|
||||
/*
|
||||
@@ -254,29 +254,25 @@ static int klp_check_stack_func(struct klp_func *func,
|
||||
static int klp_check_stack(struct task_struct *task, char *err_buf)
|
||||
{
|
||||
static unsigned long entries[MAX_STACK_ENTRIES];
|
||||
struct stack_trace trace;
|
||||
struct klp_object *obj;
|
||||
struct klp_func *func;
|
||||
int ret;
|
||||
int ret, nr_entries;
|
||||
|
||||
trace.skip = 0;
|
||||
trace.nr_entries = 0;
|
||||
trace.max_entries = MAX_STACK_ENTRIES;
|
||||
trace.entries = entries;
|
||||
ret = save_stack_trace_tsk_reliable(task, &trace);
|
||||
ret = stack_trace_save_tsk_reliable(task, entries, ARRAY_SIZE(entries));
|
||||
WARN_ON_ONCE(ret == -ENOSYS);
|
||||
if (ret) {
|
||||
if (ret < 0) {
|
||||
snprintf(err_buf, STACK_ERR_BUF_SIZE,
|
||||
"%s: %s:%d has an unreliable stack\n",
|
||||
__func__, task->comm, task->pid);
|
||||
return ret;
|
||||
}
|
||||
nr_entries = ret;
|
||||
|
||||
klp_for_each_object(klp_transition_patch, obj) {
|
||||
if (!obj->patched)
|
||||
continue;
|
||||
klp_for_each_func(obj, func) {
|
||||
ret = klp_check_stack_func(func, &trace);
|
||||
ret = klp_check_stack_func(func, entries, nr_entries);
|
||||
if (ret) {
|
||||
snprintf(err_buf, STACK_ERR_BUF_SIZE,
|
||||
"%s: %s:%d is sleeping on function %s\n",
|
||||
|
||||
Reference in new issue
Block a user