Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1028455pxj; Fri, 4 Jun 2021 04:28:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbwCNFlHWdL9CrH7HYssyU8KyAQalX/C4Q4nojreGWZ8pbR24TbNRgxFH8GaxpYN0foS7W X-Received: by 2002:a05:6402:4256:: with SMTP id g22mr4088527edb.214.1622806086353; Fri, 04 Jun 2021 04:28:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622806086; cv=none; d=google.com; s=arc-20160816; b=ljpDP5ZbfRIfHSn4q4PmuWqAqnkPQQ8+cpUeR5pApFAo8v5xaz3Ec4JCSxbL0059oR V2xvlPllfNVoXmqS9x1rHBb+EwtSN+gegf0Qf4emYyLe6DgO3/AljJ1wd0fyq8HTlzif j39ok2iN1fZzhLY/R43inzD9Bw8InU2ld/RZ26rfimG4qNSsN099434Tgd/bZAGFYfn9 tHKbC4dlBEG7ZSoQ7FFi74qCpApNwzBjb5IOpyibRzaX3BiqhPwUGvmDa4KFzqkAzlZk osYwk+7wRzi4irOlZzbnxsz8dt8osLEXqafAUj33DH+UpMzcdC60U21VXYelqZWauZNN TTUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version:date:cc :to:from:subject:message-id:dkim-signature; bh=JKLhmQWnEKJ21xa8F2vcLR1FUuusP4GhUfA4vUdj76c=; b=hTBU2eVcENEVgVEG5TAOMeR6bGny8KU8dCYkao5WLKI18fM45L85IK0IdhKz0H5Uve tuKCWbBgjXMOvMjiIFUtpR7aiW330vDo/WHY4DNFM/xdxgOUtet2tLscaPF1Lks/D9Tj fknCjb2D42GSUBY5wmL9BTgbwvfJs06P3z4QDh01afDW24pGq+qPSIf8P+Hm2fKZPyCF IzKycPNpFkMnoRRdhfIolMh+NDjut/6Rwl2qlqUWQLs4Nllg3wiyCAEynMasUqORNwxY nZ794jqD1W5+gd8EsyYCoKrJr1ZX4io2m8eqg0d7KsS06mntgMUrrAam/bBVSX5xOpra 0iWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yandex.ru header.s=mail header.b=FMc6eluF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j7si4397119ejc.247.2021.06.04.04.27.43; Fri, 04 Jun 2021 04:28:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@yandex.ru header.s=mail header.b=FMc6eluF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230026AbhFDL2k (ORCPT + 99 others); Fri, 4 Jun 2021 07:28:40 -0400 Received: from forward102p.mail.yandex.net ([77.88.28.102]:58921 "EHLO forward102p.mail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229980AbhFDL2j (ORCPT ); Fri, 4 Jun 2021 07:28:39 -0400 X-Greylist: delayed 315 seconds by postgrey-1.27 at vger.kernel.org; Fri, 04 Jun 2021 07:28:39 EDT Received: from myt6-22bd3499f8ff.qloud-c.yandex.net (myt6-22bd3499f8ff.qloud-c.yandex.net [IPv6:2a02:6b8:c12:239b:0:640:22bd:3499]) by forward102p.mail.yandex.net (Yandex) with ESMTP id 96D4554C137D; Fri, 4 Jun 2021 14:21:33 +0300 (MSK) Received: from myt5-aad1beefab42.qloud-c.yandex.net (myt5-aad1beefab42.qloud-c.yandex.net [2a02:6b8:c12:128:0:640:aad1:beef]) by myt6-22bd3499f8ff.qloud-c.yandex.net (mxback/Yandex) with ESMTP id 6XSKJc0Nae-LXJCQrR4; Fri, 04 Jun 2021 14:21:33 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1622805693; bh=JKLhmQWnEKJ21xa8F2vcLR1FUuusP4GhUfA4vUdj76c=; h=Cc:To:From:Subject:Message-ID:Date; b=FMc6eluFgH/cRue3AMeBsLZ2Y69kqjZjyQ7jGY0TaqpQtfTEh/Jw/ahYhmkrvovJx g+ZbBr4aX+Cv8sJpDsWlSoFBrqA2wdH+8wh119+XK9RI4CD++/mvpj8CRZWGmcZhRU AGNBRZJDqn3SVU8FD+BvHnSpqGeU6fIAT1uy1Z8I= Authentication-Results: myt6-22bd3499f8ff.qloud-c.yandex.net; dkim=pass header.i=@yandex.ru Received: by myt5-aad1beefab42.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id APF8DOimYe-LWK8wb5l; Fri, 04 Jun 2021 14:21:32 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) Message-ID: Subject: [PATCH] audit: Rename enum audit_state constants to avoid AUDIT_DISABLED redefinition From: Sergey Nazarov To: linux-kernel@vger.kernel.org Cc: linux-audit@redhat.com, eparis@redhat.com, paul@paul-moore.com Date: Fri, 04 Jun 2021 14:21:33 +0300 Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 (3.28.5-10.el7) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org AUDIT_DISABLED defined in kernel/audit.h as element of enum audit_state and redefined in kernel/audit.c. This produces a warning when kernel builds with syscalls audit disabled and brokes kernel build if -Werror used. enum audit_state used in syscall audit code only. This patch changes enum audit_state constants prefix AUDIT to AUDITSC to avoid AUDIT_DISABLED redefinition. Signed-off-by: Sergey Nazarov --- kernel/audit.h | 8 ++++---- kernel/auditsc.c | 34 +++++++++++++++++----------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/kernel/audit.h b/kernel/audit.h index 1522e10..ee81f20 100644 --- a/kernel/audit.h +++ b/kernel/audit.h @@ -21,16 +21,16 @@ a per-task filter. At syscall entry, the audit_state is augmented by the syscall filter. */ enum audit_state { - AUDIT_DISABLED, /* Do not create per-task audit_context. + AUDITSC_DISABLED, /* Do not create per-task audit_context. * No syscall-specific audit records can * be generated. */ - AUDIT_BUILD_CONTEXT, /* Create the per-task audit_context, + AUDITSC_BUILD_CONTEXT, /* Create the per-task audit_context, * and fill it in at syscall * entry time. This makes a full * syscall record available if some * other part of the kernel decides it * should be recorded. */ - AUDIT_RECORD_CONTEXT /* Create the per-task audit_context, + AUDITSC_RECORD_CONTEXT /* Create the per-task audit_context, * always fill it in at syscall entry * time, and always write out the audit * record at syscall exit time. */ @@ -322,7 +322,7 @@ static inline int audit_signal_info_syscall(struct task_struct *t) return 0; } -#define audit_filter_inodes(t, c) AUDIT_DISABLED +#define audit_filter_inodes(t, c) AUDITSC_DISABLED #endif /* CONFIG_AUDITSYSCALL */ extern char *audit_unpack_string(void **bufp, size_t *remain, size_t len); diff --git a/kernel/auditsc.c b/kernel/auditsc.c index 175ef6f..ae6e305 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c @@ -231,7 +231,7 @@ static void audit_set_auditable(struct audit_context *ctx) { if (!ctx->prio) { ctx->prio = 1; - ctx->current_state = AUDIT_RECORD_CONTEXT; + ctx->current_state = AUDITSC_RECORD_CONTEXT; } } @@ -751,10 +751,10 @@ static int audit_filter_rules(struct task_struct *tsk, } switch (rule->action) { case AUDIT_NEVER: - *state = AUDIT_DISABLED; + *state = AUDITSC_DISABLED; break; case AUDIT_ALWAYS: - *state = AUDIT_RECORD_CONTEXT; + *state = AUDITSC_RECORD_CONTEXT; break; } return 1; @@ -773,14 +773,14 @@ static enum audit_state audit_filter_task(struct task_struct *tsk, char **key) list_for_each_entry_rcu(e, &audit_filter_list[AUDIT_FILTER_TASK], list) { if (audit_filter_rules(tsk, &e->rule, NULL, NULL, &state, true)) { - if (state == AUDIT_RECORD_CONTEXT) + if (state == AUDITSC_RECORD_CONTEXT) *key = kstrdup(e->rule.filterkey, GFP_ATOMIC); rcu_read_unlock(); return state; } } rcu_read_unlock(); - return AUDIT_BUILD_CONTEXT; + return AUDITSC_BUILD_CONTEXT; } static int audit_in_mask(const struct audit_krule *rule, unsigned long val) @@ -802,7 +802,7 @@ static int audit_in_mask(const struct audit_krule *rule, unsigned long val) /* At syscall exit time, this filter is called if the audit_state is * not low enough that auditing cannot take place, but is also not * high enough that we already know we have to write an audit record - * (i.e., the state is AUDIT_SETUP_CONTEXT or AUDIT_BUILD_CONTEXT). + * (i.e., the state is AUDIT_SETUP_CONTEXT or AUDITSC_BUILD_CONTEXT). */ static void audit_filter_syscall(struct task_struct *tsk, struct audit_context *ctx) @@ -923,7 +923,7 @@ static inline struct audit_context *audit_alloc_context(enum audit_state state) if (!context) return NULL; context->state = state; - context->prio = state == AUDIT_RECORD_CONTEXT ? ~0ULL : 0; + context->prio = state == AUDITSC_RECORD_CONTEXT ? ~0ULL : 0; INIT_LIST_HEAD(&context->killed_trees); INIT_LIST_HEAD(&context->names_list); context->fds[0] = -1; @@ -950,7 +950,7 @@ int audit_alloc(struct task_struct *tsk) return 0; /* Return if not auditing. */ state = audit_filter_task(tsk, &key); - if (state == AUDIT_DISABLED) { + if (state == AUDITSC_DISABLED) { clear_task_syscall_work(tsk, SYSCALL_AUDIT); return 0; } @@ -1628,7 +1628,7 @@ void __audit_free(struct task_struct *tsk) audit_filter_syscall(tsk, context); audit_filter_inodes(tsk, context); - if (context->current_state == AUDIT_RECORD_CONTEXT) + if (context->current_state == AUDITSC_RECORD_CONTEXT) audit_log_exit(); } @@ -1647,7 +1647,7 @@ void __audit_free(struct task_struct *tsk) * Fill in audit context at syscall entry. This only happens if the * audit context was created when the task was created and the state or * filters demand the audit context be built. If the state from the - * per-task filter or from the per-syscall filter is AUDIT_RECORD_CONTEXT, + * per-task filter or from the per-syscall filter is AUDITSC_RECORD_CONTEXT, * then the record will be written at syscall exit time (otherwise, it * will only be written if another part of the kernel requests that it * be written). @@ -1664,11 +1664,11 @@ void __audit_syscall_entry(int major, unsigned long a1, unsigned long a2, BUG_ON(context->in_syscall || context->name_count); state = context->state; - if (state == AUDIT_DISABLED) + if (state == AUDITSC_DISABLED) return; context->dummy = !audit_n_rules; - if (!context->dummy && state == AUDIT_BUILD_CONTEXT) { + if (!context->dummy && state == AUDITSC_BUILD_CONTEXT) { context->prio = 0; if (auditd_test_task(current)) return; @@ -1693,7 +1693,7 @@ void __audit_syscall_entry(int major, unsigned long a1, unsigned long a2, * @return_code: return value of the syscall * * Tear down after system call. If the audit context has been marked as - * auditable (either because of the AUDIT_RECORD_CONTEXT state from + * auditable (either because of the AUDITSC_RECORD_CONTEXT state from * filtering, or because some other part of the kernel wrote an audit * message), then write out the syscall information. In call cases, * free the names stored from getname(). @@ -1735,12 +1735,12 @@ void __audit_syscall_exit(int success, long return_code) audit_filter_syscall(current, context); audit_filter_inodes(current, context); - if (context->current_state == AUDIT_RECORD_CONTEXT) + if (context->current_state == AUDITSC_RECORD_CONTEXT) audit_log_exit(); } context->in_syscall = 0; - context->prio = context->state == AUDIT_RECORD_CONTEXT ? ~0ULL : 0; + context->prio = context->state == AUDITSC_RECORD_CONTEXT ? ~0ULL : 0; audit_free_module(context); audit_free_names(context); @@ -1753,7 +1753,7 @@ void __audit_syscall_exit(int success, long return_code) context->sockaddr_len = 0; context->type = 0; context->fds[0] = -1; - if (context->state != AUDIT_RECORD_CONTEXT) { + if (context->state != AUDITSC_RECORD_CONTEXT) { kfree(context->filterkey); context->filterkey = NULL; } @@ -2203,7 +2203,7 @@ int auditsc_get_stamp(struct audit_context *ctx, *serial = ctx->serial; if (!ctx->prio) { ctx->prio = 1; - ctx->current_state = AUDIT_RECORD_CONTEXT; + ctx->current_state = AUDITSC_RECORD_CONTEXT; } return 1; } -- 1.8.3.1