[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220814080005.2c071546@hermes.local>
Date: Sun, 14 Aug 2022 08:00:05 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: Jamal Hadi Salim <jhs@...atatu.com>
Cc: davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, netdev@...r.kernel.org,
xiyou.wangcong@...il.com, jiri@...nulli.us, kuznet@....inr.ac.ru,
cascardo@...onical.com, linux-distros@...openwall.org,
security@...nel.org, dsahern@...il.com, gregkh@...uxfoundation.org
Subject: Re: [PATCH net 1/1] net_sched: cls_route: disallow handle of 0
On Sun, 14 Aug 2022 11:27:58 +0000
Jamal Hadi Salim <jhs@...atatu.com> wrote:
> Follows up on:
> https://lore.kernel.org/all/20220809170518.164662-1-cascardo@canonical.com/
>
> handle of 0 implies from/to of universe realm which is not very
> sensible.
>
> Lets see what this patch will do:
> $sudo tc qdisc add dev $DEV root handle 1:0 prio
>
> //lets manufacture a way to insert handle of 0
> $sudo tc filter add dev $DEV parent 1:0 protocol ip prio 100 \
> route to 0 from 0 classid 1:10 action ok
>
> //gets rejected...
> Error: handle of 0 is not valid.
> We have an error talking to the kernel, -1
>
> //lets create a legit entry..
> sudo tc filter add dev $DEV parent 1:0 protocol ip prio 100 route from 10 \
> classid 1:10 action ok
>
> //what did the kernel insert?
> $sudo tc filter ls dev $DEV parent 1:0
> filter protocol ip pref 100 route chain 0
> filter protocol ip pref 100 route chain 0 fh 0x000a8000 flowid 1:10 from 10
> action order 1: gact action pass
> random type none pass val 0
> index 1 ref 1 bind 1
>
> //Lets try to replace that legit entry with a handle of 0
> $ sudo tc filter replace dev $DEV parent 1:0 protocol ip prio 100 \
> handle 0x000a8000 route to 0 from 0 classid 1:10 action drop
>
> Error: Replacing with handle of 0 is invalid.
> We have an error talking to the kernel, -1
>
> And last, lets run Cascardo's POC:
> $ ./poc
> 0
> 0
> -22
> -22
> -22
>
> Signed-off-by: Jamal Hadi Salim <jhs@...atatu.com>
Acked-by: Stephen Hemminger <stephen@...workplumber.org>
Powered by blists - more mailing lists