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: <YgsE30gfoQkruTYS@pop-os.localdomain>
Date:   Mon, 14 Feb 2022 17:41:51 -0800
From:   Cong Wang <xiyou.wangcong@...il.com>
To:     Eric Dumazet <eric.dumazet@...il.com>
Cc:     "David S . Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        netdev <netdev@...r.kernel.org>,
        Eric Dumazet <edumazet@...gle.com>,
        Jamal Hadi Salim <jhs@...atatu.com>,
        Jiri Pirko <jiri@...nulli.us>,
        syzbot <syzkaller@...glegroups.com>
Subject: Re: [PATCH net] net: sched: limit TC_ACT_REPEAT loops

On Mon, Feb 14, 2022 at 12:34:34PM -0800, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@...gle.com>
> diff --git a/net/sched/act_api.c b/net/sched/act_api.c
> index 32563cef85bfa29679f3790599b9d34ebd504b5c..b1fb395ca7c1e12945dc70219608eb166e661203 100644
> --- a/net/sched/act_api.c
> +++ b/net/sched/act_api.c
> @@ -1037,6 +1037,7 @@ int tcf_action_exec(struct sk_buff *skb, struct tc_action **actions,
>  restart_act_graph:
>  	for (i = 0; i < nr_actions; i++) {
>  		const struct tc_action *a = actions[i];
> +		int repeat_ttl;
>  
>  		if (jmp_prgcnt > 0) {
>  			jmp_prgcnt -= 1;
> @@ -1045,11 +1046,17 @@ int tcf_action_exec(struct sk_buff *skb, struct tc_action **actions,
>  
>  		if (tc_act_skip_sw(a->tcfa_flags))
>  			continue;
> +
> +		repeat_ttl = 10;

Not sure if there is any use case of repeat action with 10+ repeats...
Use a sufficiently larger one to be 100% safe?

>  repeat:
>  		ret = a->ops->act(skb, a, res);
> -		if (ret == TC_ACT_REPEAT)
> -			goto repeat;	/* we need a ttl - JHS */
> -
> +		if (unlikely(ret == TC_ACT_REPEAT)) {
> +			if (--repeat_ttl != 0)
> +				goto repeat;
> +			/* suspicious opcode, stop pipeline */

This comment looks not match and unnecessary?

> +			pr_err_once("TC_ACT_REPEAT abuse ?\n");

Usually we use net_warn_ratelimited().

Thanks.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ