FAILED: patch "[PATCH] printk: fix possible reuse of va_list variable" failed to apply to 4.9-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 4.9-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
Quoted 1 line
From
988a35f8da1dec5a8cd2788054d1e717be61bf25Mon Sep 17 00:00:00 2001
From: Tetsuo Handa <[email protected]>
Date: Fri, 11 May 2018 19:54:19 +0900
Subject: [PATCH] printk: fix possible reuse of va_list variable
I noticed that there is a possibility that printk_safe_log_store() causes kernel oops because "args" parameter is passed to vsnprintf() again when atomic_cmpxchg() detected that we raced. Fix this by using va_copy().
kernel/printk/printk_safe.c +4 -1
@@ -82,6 +82,7 @@ static __printf(2, 0) int printk_safe_log_store(struct printk_safe_seq_buf *s, {int add;size_t len; +va_list ap; again: len =atomic_read (&s->len);
@@ -100,7 +101,9 @@ static __printf(2, 0) int printk_safe_log_store(struct printk_safe_seq_buf *s,if (!len)smp_rmb (); - add =vscnprintf (s->buffer + len,sizeof (s->buffer) - len, fmt, args); +va_copy (ap, args); + add =vscnprintf (s->buffer + len,sizeof (s->buffer) - len, fmt, ap); +va_end (ap);if (!add)return 0 ;
Tetsuo Handa
Reviewed-by Sergey SenozhatskyQuoted 6 lines · On 2018/07/01 18:19, [email protected] wrote:
The patch below does not apply to the 4.9-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
OK. Filename and function name are different as of 4.9. Updated patch for 4.9-stable is attached below.
Quoted 1 line
From
030b03ee5602e045398d8452afdcd136f3f5272cMon Sep 17 00:00:00 2001
From: Tetsuo Handa <[email protected]>
Date: Sun, 1 Jul 2018 19:34:37 +0900
Subject: [PATCH] printk: fix possible reuse of va_list variable
commit 988a35f8da1dec5a8cd2788054d1e717be61bf25 upstream.
I noticed that there is a possibility that printk_safe_log_store() causes kernel oops because "args" parameter is passed to vsnprintf() again when atomic_cmpxchg() detected that we raced. Fix this by using va_copy().
--- kernel/printk/nmi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
kernel/printk/nmi.c +4 -1
@@ -63,6 +63,7 @@ static int vprintk_nmi(const char *fmt, va_list args)struct nmi_seq_buf *s =this_cpu_ptr (&nmi_print_seq);int add =0 ;size_t len; +va_list ap; again: len =atomic_read (&s->len);
@@ -79,7 +80,9 @@ static int vprintk_nmi(const char *fmt, va_list args)if (!len)smp_rmb (); - add =vsnprintf (s->buffer + len,sizeof (s->buffer) - len, fmt, args); +va_copy (ap, args); + add =vsnprintf (s->buffer + len,sizeof (s->buffer) - len, fmt, ap); +va_end (ap);/* * Do it once again if the buffer has been flushed in the meantime.
Signature · 1 line
1.8.3.1
Quoted 10 lines · Tetsuo Handa
Quoted 6 lines · On 2018/07/01 18:19, [email protected] wrote:
The patch below does not apply to the 4.9-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.OK. Filename and function name are different as of 4.9. Updated patch for 4.9-stable is attached below.
Thanks!
-ss
Greg KH
maintainerQuoted 10 lines · Tetsuo Handa
Quoted 6 lines · On 2018/07/01 18:19, [email protected] wrote:
The patch below does not apply to the 4.9-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.OK. Filename and function name are different as of 4.9. Updated patch for 4.9-stable is attached below.
Thanks, now queued up.
greg k-h