lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5543735.DvuYhMxLoT@x2>
Date:   Tue, 19 Oct 2021 10:51:00 -0400
From:   Steve Grubb <sgrubb@...hat.com>
To:     paul@...l-moore.com, eparis@...hat.com, rgb@...hat.com,
        linux-audit@...hat.com
Cc:     wangweiyang2@...wei.com, linux-audit@...hat.com,
        linux-kernel@...r.kernel.org,
        Gaosheng Cui <cuigaosheng1@...wei.com>
Subject: Re: [PATCH -next, v3 2/2] audit: return early if the rule has a lower priority

Hello,

On Saturday, October 16, 2021 3:23:51 AM EDT Gaosheng Cui wrote:
> It is not necessary for audit_filter_rules() functions to check
> audit fileds of the rule with a lower priority, and if we did,
> there might be some unintended effects, such as the ctx->ppid
> may be changed unexpectedly, so return early if the rule has
> a lower priority.
> 
> Signed-off-by: Gaosheng Cui <cuigaosheng1@...wei.com>
> ---
>  kernel/auditsc.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/auditsc.c b/kernel/auditsc.c
> index 42d4a4320526..b517947bfa48 100644
> --- a/kernel/auditsc.c
> +++ b/kernel/auditsc.c
> @@ -470,6 +470,9 @@ static int audit_filter_rules(struct task_struct *tsk,
>  	u32 sid;
>  	unsigned int sessionid;
> 
> +	if (ctx && rule->prio <= ctx->prio)
> +		return 0;
> +

Just wondering something... If the first thing we do is to decide to return, 
should we have called the function in the first place? I wonder if this test 
should be used to break out of the rule iteration loops so that we don't keep 
calling only to return ?

-Steve

>  	cred = rcu_dereference_check(tsk->cred, tsk == current || 
task_creation);
> 
>  	for (i = 0; i < rule->field_count; i++) {
> @@ -737,8 +740,6 @@ static int audit_filter_rules(struct task_struct *tsk,
>  	}
> 
>  	if (ctx) {
> -		if (rule->prio <= ctx->prio)
> -			return 0;
>  		if (rule->filterkey) {
>  			kfree(ctx->filterkey);
>  			ctx->filterkey = kstrdup(rule->filterkey, GFP_ATOMIC);




Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ