Re: [PATCH 3/5] x86/dumpstack: Improve opcodes dumping in the Code: section

From: Josh Poimboeuf
Date: Mon Feb 19 2018 - 17:02:25 EST


On Mon, Feb 19, 2018 at 09:28:24PM +0100, Borislav Petkov wrote:
> bool in_task_stack(unsigned long *stack, struct task_struct *task,
> @@ -358,8 +362,8 @@ void die(const char *str, struct pt_regs *regs, long err)
>
> static int __init code_bytes_setup(char *s)
> {
> - ssize_t ret;
> unsigned long val;
> + ssize_t ret;
>
> if (!s)
> return -EINVAL;
> @@ -372,35 +376,37 @@ static int __init code_bytes_setup(char *s)
> if (code_bytes > 8192)
> code_bytes = 8192;
>
> + if (code_bytes > OPCODE_BUFSIZE) {
> + u8 *new_buf = kzalloc(code_bytes, GFP_KERNEL);
> + if (!new_buf)
> + return -EINVAL;

S/EINVAL/ENOMEM/ ?

Otherwise the code looks good to me, and I like the new feature.

--
Josh