diff mbox

netlink: downgrade warning about leftover bytes to debug level

Message ID 1401196563-6999-1-git-send-email-mschmidt@redhat.com
State Superseded, archived
Delegated to: David Miller
Headers show

Commit Message

Michal Schmidt May 27, 2014, 1:16 p.m. UTC
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(-)

Comments

Nicolas Dichtel May 28, 2014, 7:42 a.m. UTC | #1
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.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Michal Schmidt May 28, 2014, 9:18 a.m. UTC | #2
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
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Nicolas Dichtel May 28, 2014, 12:47 p.m. UTC | #3
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
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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: