[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACT4Y+YSHC-fUxiymRDTOGivK6OXp6JO1XsVqbLStJs9iaH_Cw@mail.gmail.com>
Date: Mon, 22 Jan 2018 16:04:12 +0100
From: Dmitry Vyukov <dvyukov@...gle.com>
To: Greg KH <gregkh@...uxfoundation.org>
Cc: syzbot
<bot+1fdad4e2731bf0c1bc19953ccc5061237ec92783@...kaller.appspotmail.com>,
LKML <linux-kernel@...r.kernel.org>,
syzkaller-bugs@...glegroups.com,
David Miller <davem@...emloft.net>,
Daniel Borkmann <daniel@...earbox.net>,
Eric Dumazet <edumazet@...gle.com>,
jakub.kicinski@...ronome.com,
Willem de Bruijn <willemb@...gle.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
John Fastabend <john.fastabend@...il.com>,
"Tobin C. Harding" <me@...in.cc>, netdev <netdev@...r.kernel.org>,
linux-wireless@...r.kernel.org
Subject: Re: [PATCH] sysfs: turn WARN() into pr_warn()
On Mon, Jan 22, 2018 at 3:57 PM, Greg KH <gregkh@...uxfoundation.org> wrote:
> From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
>
> It's not good to crash the machine if panic_on_warn() is set just
> because someone made a stupid mistake of trying to create a sysfs file
> with the same name of an existing one. This makes the automated testing
> tools a lot harder to find the real bugs in the kernel.
>
> So just print a warning out and dump the stack to get the attention of
> the developer that they did something foolish. Then keep on trucking,
> as this should not be a fatal error at all.
>
> Reported-by: Dmitry Vyukov <dvyukov@...gle.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> ---
>
> Dmitry, does this look good to you? If so, I'll queue it up for
> 4.16-rc1.
Perfect! Looks good. syzbot reacts on "WARNING:" string (+ if kernel
panic due to panic_on_warn that's also obviously a problem).
> diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
> index 2b67bda2021b..3a36a48a4b3f 100644
> --- a/fs/sysfs/dir.c
> +++ b/fs/sysfs/dir.c
> @@ -10,6 +10,7 @@
> * Please see Documentation/filesystems/sysfs.txt for more information.
> */
>
> +#define pr_fmt(fmt) "sysfs: " fmt
> #undef DEBUG
>
> #include <linux/fs.h>
> @@ -27,8 +28,8 @@ void sysfs_warn_dup(struct kernfs_node *parent, const char *name)
> if (buf)
> kernfs_path(parent, buf, PATH_MAX);
>
> - WARN(1, KERN_WARNING "sysfs: cannot create duplicate filename '%s/%s'\n",
> - buf, name);
> + pr_warn("cannot create duplicate filename '%s/%s'\n", buf, name);
> + dump_stack();
>
> kfree(buf);
> }
Powered by blists - more mailing lists