[PATCH v2] audit: do not panic kernel on invalid audit parameter

Greg Edwards gedwards at ddn.com
Wed Feb 21 16:18:19 UTC 2018


If you pass in an invalid audit kernel boot parameter, e.g. 'audit=off',
the kernel panics very early in boot with no output on the console
indicating the problem.

Instead, print the error indicating an invalid audit parameter value,
but leave auditing enabled.

Fixes: 80ab4df62706 ("audit: don't use simple_strtol() anymore")
Signed-off-by: Greg Edwards <gedwards at ddn.com>
---
Changes v1 -> v2:
  - default to auditing enabled for the error case

 kernel/audit.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/audit.c b/kernel/audit.c
index 227db99b0f19..9b80e9895107 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -1572,8 +1572,10 @@ static int __init audit_enable(char *str)
 {
 	long val;
 
-	if (kstrtol(str, 0, &val))
-		panic("audit: invalid 'audit' parameter value (%s)\n", str);
+	if (kstrtol(str, 0, &val)) {
+		pr_err("invalid 'audit' parameter value (%s)\n", str);
+		val = AUDIT_ON;
+	}
 	audit_default = (val ? AUDIT_ON : AUDIT_OFF);
 
 	if (audit_default == AUDIT_OFF)
-- 
2.14.3




More information about the Linux-audit mailing list