* [PATCH] netlink: downgrade warning about leftover bytes to debug level
@ 2014-05-27 13:16 Michal Schmidt
2014-05-28 7:42 ` Nicolas Dichtel
0 siblings, 1 reply; 9+ messages in thread
From: Michal Schmidt @ 2014-05-27 13:16 UTC (permalink / raw)
To: David Miller; +Cc: netdev
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.
Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
---
lib/nlattr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/nlattr.c b/lib/nlattr.c
index fc67547..fbadde6 100644
--- a/lib/nlattr.c
+++ b/lib/nlattr.c
@@ -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:
--
1.9.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] netlink: downgrade warning about leftover bytes to debug level
2014-05-27 13:16 [PATCH] netlink: downgrade warning about leftover bytes to debug level Michal Schmidt
@ 2014-05-28 7:42 ` Nicolas Dichtel
2014-05-28 9:18 ` Michal Schmidt
0 siblings, 1 reply; 9+ messages in thread
From: Nicolas Dichtel @ 2014-05-28 7:42 UTC (permalink / raw)
To: Michal Schmidt, David Miller; +Cc: netdev
Le 27/05/2014 15:16, Michal Schmidt a écrit :
> 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.
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.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] netlink: downgrade warning about leftover bytes to debug level
2014-05-28 7:42 ` Nicolas Dichtel
@ 2014-05-28 9:18 ` Michal Schmidt
2014-05-28 12:47 ` Nicolas Dichtel
0 siblings, 1 reply; 9+ messages in thread
From: Michal Schmidt @ 2014-05-28 9:18 UTC (permalink / raw)
To: nicolas.dichtel, David Miller; +Cc: netdev
On 05/28/2014 09:42 AM, Nicolas Dichtel wrote:
> Le 27/05/2014 15:16, Michal Schmidt a écrit :
>> 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.
> 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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] netlink: downgrade warning about leftover bytes to debug level
2014-05-28 9:18 ` Michal Schmidt
@ 2014-05-28 12:47 ` Nicolas Dichtel
2014-05-30 12:57 ` [PATCH] netlink: rate-limit leftover bytes warning and print process name Michal Schmidt
0 siblings, 1 reply; 9+ messages in thread
From: Nicolas Dichtel @ 2014-05-28 12:47 UTC (permalink / raw)
To: Michal Schmidt, David Miller; +Cc: netdev
Le 28/05/2014 11:18, Michal Schmidt a écrit :
> On 05/28/2014 09:42 AM, Nicolas Dichtel wrote:
>> Le 27/05/2014 15:16, Michal Schmidt a écrit :
>>> 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.
>> 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.
>
> 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 ;-)
> 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
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH] netlink: rate-limit leftover bytes warning and print process name
2014-05-28 12:47 ` Nicolas Dichtel
@ 2014-05-30 12:57 ` Michal Schmidt
2014-05-30 14:26 ` Sergei Shtylyov
2014-05-31 0:16 ` [PATCH] " David Miller
0 siblings, 2 replies; 9+ messages in thread
From: Michal Schmidt @ 2014-05-30 12:57 UTC (permalink / raw)
To: netdev; +Cc: Nicolas Dichtel, David Miller
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 <mschmidt@redhat.com>
---
lib/nlattr.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/nlattr.c b/lib/nlattr.c
index fc67547..31047c4 100644
--- a/lib/nlattr.c
+++ b/lib/nlattr.c
@@ -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:
--
1.9.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] netlink: rate-limit leftover bytes warning and print process name
2014-05-30 12:57 ` [PATCH] netlink: rate-limit leftover bytes warning and print process name Michal Schmidt
@ 2014-05-30 14:26 ` Sergei Shtylyov
2014-06-02 16:25 ` [PATCH v2] " Michal Schmidt
2014-05-31 0:16 ` [PATCH] " David Miller
1 sibling, 1 reply; 9+ messages in thread
From: Sergei Shtylyov @ 2014-05-30 14:26 UTC (permalink / raw)
To: Michal Schmidt, netdev; +Cc: Nicolas Dichtel, David Miller
Hello.
On 05/30/2014 04:57 PM, Michal Schmidt wrote:
> 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 <mschmidt@redhat.com>
> ---
> lib/nlattr.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
> diff --git a/lib/nlattr.c b/lib/nlattr.c
> index fc67547..31047c4 100644
> --- a/lib/nlattr.c
> +++ b/lib/nlattr.c
> @@ -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().
> + "netlink: %d bytes leftover after parsing attributes in process `%s'.\n",
> + rem, current->comm);
WBR, Sergei
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] netlink: rate-limit leftover bytes warning and print process name
2014-05-30 12:57 ` [PATCH] netlink: rate-limit leftover bytes warning and print process name Michal Schmidt
2014-05-30 14:26 ` Sergei Shtylyov
@ 2014-05-31 0:16 ` David Miller
1 sibling, 0 replies; 9+ messages in thread
From: David Miller @ 2014-05-31 0:16 UTC (permalink / raw)
To: mschmidt; +Cc: netdev, nicolas.dichtel
From: Michal Schmidt <mschmidt@redhat.com>
Date: Fri, 30 May 2014 14:57:27 +0200
> 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 <mschmidt@redhat.com>
Please use pr_warn_ratelimited() as suggested by Sergei.
Thanks.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2] netlink: rate-limit leftover bytes warning and print process name
2014-05-30 14:26 ` Sergei Shtylyov
@ 2014-06-02 16:25 ` Michal Schmidt
2014-06-02 18:16 ` David Miller
0 siblings, 1 reply; 9+ messages in thread
From: Michal Schmidt @ 2014-06-02 16:25 UTC (permalink / raw)
To: netdev; +Cc: Sergei Shtylyov, Nicolas Dichtel, David Miller
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_ratelimited instead of printk_ratelimited.]
Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
---
lib/nlattr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/nlattr.c b/lib/nlattr.c
index fc67547..10ad042 100644
--- a/lib/nlattr.c
+++ b/lib/nlattr.c
@@ -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:
--
1.9.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2] netlink: rate-limit leftover bytes warning and print process name
2014-06-02 16:25 ` [PATCH v2] " Michal Schmidt
@ 2014-06-02 18:16 ` David Miller
0 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2014-06-02 18:16 UTC (permalink / raw)
To: mschmidt; +Cc: netdev, sergei.shtylyov, nicolas.dichtel
From: Michal Schmidt <mschmidt@redhat.com>
Date: Mon, 2 Jun 2014 18:25:02 +0200
> 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_ratelimited instead of printk_ratelimited.]
>
> Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
Applied, thanks Michal.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2014-06-02 18:16 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-27 13:16 [PATCH] netlink: downgrade warning about leftover bytes to debug level Michal Schmidt
2014-05-28 7:42 ` Nicolas Dichtel
2014-05-28 9:18 ` Michal Schmidt
2014-05-28 12:47 ` Nicolas Dichtel
2014-05-30 12:57 ` [PATCH] netlink: rate-limit leftover bytes warning and print process name Michal Schmidt
2014-05-30 14:26 ` Sergei Shtylyov
2014-06-02 16:25 ` [PATCH v2] " Michal Schmidt
2014-06-02 18:16 ` David Miller
2014-05-31 0:16 ` [PATCH] " David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).