[Devel] [PATCH RHEL COMMIT] ve: Use ve_printk() for often kernel messages about user actions

Konstantin Khorenko khorenko at virtuozzo.com
Fri Oct 1 18:25:17 MSK 2021


The commit is pushed to "branch-rh9-5.14.vz9.1.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after ark-5.14
------>
commit ff318bc404b87505c920bffb847a40c174c23f2e
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Mon Nov 27 20:10:46 2017 +0300

    ve: Use ve_printk() for often kernel messages about user actions
    
    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 21b0e5ff5eaf..e66ccebe190a 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -8623,8 +8623,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) {


More information about the Devel mailing list