From: alexander.levin@verizon.com
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"stable@vger.kernel.org" <stable@vger.kernel.org>
Cc: Paul Moore <paul@paul-moore.com>, alexander.levin@verizon.com
Subject: [PATCH AUTOSEL for 3.18 15/15] audit: ensure that 'audit=1' actually enables audit for PID 1
Date: Sat, 2 Dec 2017 15:53:37 +0000 [thread overview]
Message-ID: <20171202155324.7846-15-alexander.levin@verizon.com> (raw)
In-Reply-To: <20171202155324.7846-1-alexander.levin@verizon.com>
From: Paul Moore <paul@paul-moore.com>
[ Upstream commit 173743dd99a49c956b124a74c8aacb0384739a4c ]
Prior to this patch we enabled audit in audit_init(), which is too
late for PID 1 as the standard initcalls are run after the PID 1 task
is forked. This means that we never allocate an audit_context (see
audit_alloc()) for PID 1 and therefore miss a lot of audit events
generated by PID 1.
This patch enables audit as early as possible to help ensure that when
PID 1 is forked it can allocate an audit_context if required.
Reviewed-by: Richard Guy Briggs <rgb@redhat.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
---
kernel/audit.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/kernel/audit.c b/kernel/audit.c
index c6df9905f1c6..e02218c18a81 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -79,13 +79,13 @@ static int audit_initialized;
#define AUDIT_OFF 0
#define AUDIT_ON 1
#define AUDIT_LOCKED 2
-u32 audit_enabled;
-u32 audit_ever_enabled;
+u32 audit_enabled = AUDIT_OFF;
+u32 audit_ever_enabled = !!AUDIT_OFF;
EXPORT_SYMBOL_GPL(audit_enabled);
/* Default state when kernel boots without any parameters. */
-static u32 audit_default;
+static u32 audit_default = AUDIT_OFF;
/* If auditing cannot proceed, audit_failure selects what happens. */
static u32 audit_failure = AUDIT_FAIL_PRINTK;
@@ -1173,8 +1173,6 @@ static int __init audit_init(void)
skb_queue_head_init(&audit_skb_queue);
skb_queue_head_init(&audit_skb_hold_queue);
audit_initialized = AUDIT_INITIALIZED;
- audit_enabled = audit_default;
- audit_ever_enabled |= !!audit_default;
audit_log(NULL, GFP_KERNEL, AUDIT_KERNEL, "initialized");
@@ -1191,6 +1189,8 @@ static int __init audit_enable(char *str)
audit_default = !!simple_strtol(str, NULL, 0);
if (!audit_default)
audit_initialized = AUDIT_DISABLED;
+ audit_enabled = audit_default;
+ audit_ever_enabled = !!audit_enabled;
pr_info("%s\n", audit_default ?
"enabled (after initialization)" : "disabled (until reboot)");
--
2.11.0
next prev parent reply other threads:[~2017-12-02 15:54 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-02 15:53 [PATCH AUTOSEL for 3.18 01/15] route: also update fnhe_genid when updating a route cache alexander.levin
2017-12-02 15:53 ` [PATCH AUTOSEL for 3.18 02/15] route: update fnhe_expires for redirect when the fnhe exists alexander.levin
2017-12-02 15:53 ` [PATCH AUTOSEL for 3.18 05/15] NFS: Fix a typo in nfs_rename() alexander.levin
2017-12-02 15:53 ` [PATCH AUTOSEL for 3.18 04/15] dynamic-debug-howto: fix optional/omitted ending line number to be LARGE instead of 0 alexander.levin
2017-12-02 15:53 ` [PATCH AUTOSEL for 3.18 03/15] lib/genalloc.c: make the avail variable an atomic_long_t alexander.levin
2017-12-02 15:53 ` [PATCH AUTOSEL for 3.18 06/15] sunrpc: Fix rpc_task_begin trace point alexander.levin
2017-12-02 15:53 ` [PATCH AUTOSEL for 3.18 07/15] sparc64/mm: set fields in deferred pages alexander.levin
2017-12-02 15:53 ` [PATCH AUTOSEL for 3.18 08/15] sctp: do not free asoc when it is already dead in sctp_sendmsg alexander.levin
2017-12-02 15:53 ` [PATCH AUTOSEL for 3.18 09/15] sctp: use the right sk after waking up from wait_buf sleep alexander.levin
2017-12-02 15:53 ` [PATCH AUTOSEL for 3.18 12/15] IB/mlx4: Increase maximal message size under UD QP alexander.levin
2017-12-02 15:53 ` [PATCH AUTOSEL for 3.18 10/15] atm: horizon: Fix irq release error alexander.levin
2017-12-02 15:53 ` [PATCH AUTOSEL for 3.18 11/15] xfrm: Copy policy family in clone_policy alexander.levin
2017-12-02 15:53 ` alexander.levin [this message]
2017-12-02 15:53 ` [PATCH AUTOSEL for 3.18 14/15] afs: Connect up the CB.ProbeUuid alexander.levin
2017-12-02 15:53 ` [PATCH AUTOSEL for 3.18 13/15] IB/mlx5: Assign send CQ and recv CQ of UMR QP alexander.levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171202155324.7846-15-alexander.levin@verizon.com \
--to=alexander.levin@verizon.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paul@paul-moore.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®