netlink: downgrade warning about leftover bytes to debug level
Subsystems (3)
PATCH 1/1 netlink: downgrade warning about leftover bytes to debug level
Any process is able to send netlink messages with leftover bytes, so downgrade the warning message to pr_debug in order to avoid possible kernel log spam.
--- lib/nlattr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/nlattr.c +2 -2
@@ -201,8 +201,8 @@ int nla_parse(struct nlattr **tb, int maxtype, const struct nlattr *head, }if (unlikely (rem >0 )) -printk (KERN_WARNING "netlink: %d bytes leftover after parsing " -"attributes.\n" , rem); +pr_debug ("netlink: %d bytes leftover after parsing attributes.\n" , + rem); err =0 ; errout:
Signature · 1 line
1.9.3
Quoted 3 lines · Michal Schmidt
Any process is able to send netlink messages with leftover bytes, so downgrade the warning message to
pr_debugin order to avoid possible kernel log spam.
Yes, but that's not a normal case. I think that the level warning is good, there is something wrong with this kind of messages.
Quoted 6 lines · Nicolas Dichtel
Quoted 3 lines · Michal Schmidt
Any process is able to send netlink messages with leftover bytes, so downgrade the warning message to
pr_debugin order to avoid possible kernel log spam.Yes, but that's not a normal case. I think that the level warning is good, there is something wrong with this kind of messages.
As an alternative we could at least guard it with net_ratelimit().
But still, the message indicates a userspace bug. It can be useful for a developer of a netlink library, but not for many more. I think it's odd to let unprivileged userspace spam the dmesg, even if rate-limited. The kernel does not emit warning messages when userspace is buggy in other ways, like calling syscalls with invalid arguments.
Regards,
Michal
Quoted 9 lines · Michal Schmidt
Quoted 6 lines · Nicolas Dichtel
Quoted 3 lines · Michal Schmidt
Any process is able to send netlink messages with leftover bytes, so downgrade the warning message to
pr_debugin order to avoid possible kernel log spam.Yes, but that's not a normal case. I think that the level warning is good, there is something wrong with this kind of messages.
As an alternative we could at least guard it with
net_ratelimit().
I would prefer this solution.
Quoted 3 lines
But still, the message indicates a userspace bug. It can be useful for a developer of a netlink library, but not for many more.
Or to let you know why a userspace tool does not work ;-)
Quoted 4 lines
I think it's odd to let unprivileged userspace spam the dmesg, even if rate-limited. The kernel does not emit warning messages when userspace is buggy in other ways, like calling syscalls with invalid arguments.
If it's really a problem (this message is here since 2.6.15 and nobody complains), maybe a level between warning and debug may be acceptable.
Regards,
Nicolas
PATCH 1/1 netlink: rate-limit leftover bytes warning and print process name
Any process is able to send netlink messages with leftover bytes. Make the warning rate-limited to prevent too much log spam.
The warning is supposed to help find userspace bugs, so print the triggering command name to implicate the buggy program.
--- lib/nlattr.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
lib/nlattr.c +3 -2
@@ -201,8 +201,9 @@ int nla_parse(struct nlattr **tb, int maxtype, const struct nlattr *head, }if (unlikely (rem >0 )) -printk (KERN_WARNING "netlink: %d bytes leftover after parsing " -"attributes.\n" , rem); +printk_ratelimited (KERN_WARNING +"netlink: %d bytes leftover after parsing attributes in process `%s'.\n" , + rem, current->comm); err =0 ; errout:
Signature · 1 line
1.9.3
Re: [PATCH] netlink: rate-limit leftover bytes warning and print process name
Hello.
Quoted 16 lines · Michal Schmidt
Any process is able to send netlink messages with leftover bytes. Make the warning rate-limited to prevent too much log spam.
The warning is supposed to help find userspace bugs, so print the triggering command name to implicate the buggy program.
Signed-off-by Michal Schmidt <[email protected]>--- lib/nlattr.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)lib/nlattr.c +0
-0
lib/nlattr.c int nla_parse(struct nlattr **tb, int maxtype, const struct nlattr *head, · line 204
Quoted 6 lines
lib/nlattr.c +1
-2@@ -201,8 +201,9 @@ int nla_parse(struct nlattr **tb, int maxtype, const struct nlattr *head, }if (unlikely (rem >0 )) -printk (KERN_WARNING "netlink: %d bytes leftover after parsing " -"attributes.\n" , rem); + printk_ratelimited(KERN_WARNING
Better pr_warn_ratelimited().
lib/nlattr.c int nla_parse(struct nlattr **tb, int maxtype, const struct nlattr *head, · line 206
Quoted 2 lines
lib/nlattr.c +2
-0+"netlink: %d bytes leftover after parsing attributes in process `%s'.\n" , + rem, current->comm);
WBR, Sergei
David Miller
maintainerRe: [PATCH] netlink: rate-limit leftover bytes warning and print process name
In reply to Michal SchmidtFrom: Michal Schmidt <[email protected]>
Date: Fri, 30 May 2014 14:57:27 +0200
Quoted 7 lines
Any process is able to send netlink messages with leftover bytes. Make the warning rate-limited to prevent too much log spam.
The warning is supposed to help find userspace bugs, so print the triggering command name to implicate the buggy program.
Signed-off-by Michal Schmidt <[email protected]>
Please use pr_warn_ratelimited() as suggested by Sergei.
Thanks.
PATCH v2 1/1 netlink: rate-limit leftover bytes warning and print process name
In reply to Sergei ShtylyovAny process is able to send netlink messages with leftover bytes. Make the warning rate-limited to prevent too much log spam.
The warning is supposed to help find userspace bugs, so print the triggering command name to implicate the buggy program.
[v2: Use pr_warn_ratelimited instead of printk_ratelimited.]
--- lib/nlattr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/nlattr.c +2 -2
@@ -201,8 +201,8 @@ int nla_parse(struct nlattr **tb, int maxtype, const struct nlattr *head, }if (unlikely (rem >0 )) -printk (KERN_WARNING "netlink: %d bytes leftover after parsing " -"attributes.\n" , rem); +pr_warn_ratelimited ("netlink: %d bytes leftover after parsing attributes in process `%s'.\n" , + rem, current->comm); err =0 ; errout:
Signature · 1 line
1.9.3
Re: [PATCH v2] netlink: rate-limit leftover bytes warning and print process name
From: Michal Schmidt <[email protected]>
Date: Mon, 2 Jun 2014 18:25:02 +0200
Quoted 9 lines
Any process is able to send netlink messages with leftover bytes. Make the warning rate-limited to prevent too much log spam.
The warning is supposed to help find userspace bugs, so print the triggering command name to implicate the buggy program.
[v2: Use
pr_warn_ratelimitedinstead ofprintk_ratelimited.]Signed-off-by Michal Schmidt <[email protected]>
Applied, thanks Michal.