[Devel] [PATCH rh9 08/11] ve: Use ve_printk() for often kernel messages about user actions

Konstantin Khorenko khorenko at virtuozzo.com
Wed Sep 29 22:24:44 MSK 2021


From: Kirill Tkhai <ktkhai at virtuozzo.com>

Move messages such as program segfault etc out of system dmesg.

Extracted from "Initial patch".

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>

(cherry picked from vz8 commit 8d73ec829805acacb51d2657253808d4c85742d1)
Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 arch/x86/mm/fault.c | 2 +-
 lib/nlattr.c        | 5 +++--
 net/core/dev.c      | 9 +++++++--
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index dc2490833faa..47e7a2e55e7c 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -771,7 +771,7 @@ show_signal_msg(struct pt_regs *regs, unsigned long error_code,
 	if (!printk_ratelimit())
 		return;
 
-	printk("%s%s[%d]: segfault at %lx ip %px sp %px error %lx",
+	ve_printk(VE_LOG, "%s%s[%d]: segfault at %lx ip %px sp %px error %lx",
 		loglvl, tsk->comm, task_pid_nr(tsk), address,
 		(void *)regs->ip, (void *)regs->sp, error_code);
 
diff --git a/lib/nlattr.c b/lib/nlattr.c
index 86029ad5ead4..84d4e9cd1fa6 100644
--- a/lib/nlattr.c
+++ b/lib/nlattr.c
@@ -597,8 +597,9 @@ static int __nla_validate_parse(const struct nlattr *head, int len, int maxtype,
 	}
 
 	if (unlikely(rem > 0)) {
-		pr_warn_ratelimited("netlink: %d bytes leftover after parsing attributes in process `%s'.\n",
-				    rem, current->comm);
+		ve_pr_warn_ratelimited(VE_LOG,
+			"netlink: %d bytes leftover after parsing attributes in process `%s'.\n",
+			rem, current->comm);
 		NL_SET_ERR_MSG(extack, "bytes leftover after parsing attributes");
 		if (validate & NL_VALIDATE_TRAILING)
 			return -EINVAL;
diff --git a/net/core/dev.c b/net/core/dev.c
index 3500c9544d27..f7b30590cd75 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -8610,8 +8610,13 @@ static int __dev_set_promiscuity(struct net_device *dev, int inc, bool notify)
 			return -EOVERFLOW;
 		}
 	}
-	if (dev->flags != old_flags) {
-		pr_info("device %s %s promiscuous mode\n",
+	/*
+	 * Promiscous mode on LOOPBACK/POINTTOPOINT devices does
+	 * not mean anything
+	 */
+	if ((dev->flags != old_flags) &&
+			!(dev->flags & (IFF_LOOPBACK | IFF_POINTOPOINT))) {
+		ve_printk(VE_LOG, KERN_INFO "device %s %s promiscuous mode\n",
 			dev->name,
 			dev->flags & IFF_PROMISC ? "entered" : "left");
 		if (audit_enabled) {
-- 
2.28.0



More information about the Devel mailing list