Skip to content

Commit

Permalink
livepatch: Use static buffer for debugging messages under rq lock
Browse files Browse the repository at this point in the history
The err_buf array uses 128 bytes of stack space.  Move it off the stack
by making it static.  It's safe to use a shared buffer because
klp_try_switch_task() is called under klp_mutex.

Acked-by: Miroslav Benes <[email protected]>
Acked-by: Josh Poimboeuf <[email protected]>
Reviewed-by: Kamalesh Babulal <[email protected]>
Signed-off-by: Petr Mladek <[email protected]>
  • Loading branch information
pmladek committed Jun 5, 2019
1 parent 573de2a commit f36e664
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions kernel/livepatch/transition.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,11 +293,11 @@ static int klp_check_stack(struct task_struct *task, char *err_buf)
*/
static bool klp_try_switch_task(struct task_struct *task)
{
static char err_buf[STACK_ERR_BUF_SIZE];
struct rq *rq;
struct rq_flags flags;
int ret;
bool success = false;
char err_buf[STACK_ERR_BUF_SIZE];

err_buf[0] = '\0';

Expand Down Expand Up @@ -340,7 +340,6 @@ static bool klp_try_switch_task(struct task_struct *task)
pr_debug("%s", err_buf);

return success;

}

/*
Expand Down

0 comments on commit f36e664

Please sign in to comment.