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  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]
Date:	Tue, 8 Apr 2014 14:50:09 -0700
From:	Cong Wang <xiyou.wangcong@...il.com>
To:	David Miller <davem@...emloft.net>
Cc:	Linux Kernel Network Developers <netdev@...r.kernel.org>,
	"Eric W. Biederman" <ebiederm@...ssion.com>,
	Julian Anastasov <ja@....bg>,
	Cong Wang <cwang@...pensource.com>
Subject: Re: [Patch net] ipv4: fib: check forwarding before checking send_redirects

On Tue, Apr 8, 2014 at 2:23 PM, David Miller <davem@...emloft.net> wrote:
> From: Cong Wang <xiyou.wangcong@...il.com>
> Date: Tue, 8 Apr 2014 14:17:08 -0700
>
>> We are not supposed even to execute __fib_validate_source() in such
>> case, are we? :)
>
> Yes, we used to, every time we'd make a routing cache entry, we'd
> execute this code.
>
> Check fib_validate_source() from before the routing cache removal if
> you don't believe me.
>
> That check you are editing was added by myself as an optimization
> that was necessary after the routing cache removal since this
> function performs two FIB table lookups every time it is called.

I must miss something here. Looking at the code:

        int r = secpath_exists(skb) ? 0 : IN_DEV_RPFILTER(idev);

        if (!r && !fib_num_tclassid_users(dev_net(dev)) &&
            (dev->ifindex != oif || !IN_DEV_TX_REDIRECTS(idev))) {
                *itag = 0;
                return 0;
        }

r == 0 is true in our case since we disable rp_filter manually.
And fib_num_tclassid_users() == 0 by default too.

Therefore, the only thing takes effect is if dev->ifindex == oif.
Given the fact that disabling send_redirects makes the problem
disappear, dev->ifindex != oif must be false, otherwise it doesn't
even need to check TX_REDIRECTS.

The rx interface is loopback, so skb->dev == lo, and the oif we pass
here must be LOOPBACK_IFINDEX, therefore the following code
in ip_route_input_slow():

        if (res.type == RTN_LOCAL) {
                err = fib_validate_source(skb, saddr, daddr, tos,
                                          LOOPBACK_IFINDEX,
                                          dev, in_dev, &itag);
                if (err < 0)
                        goto martian_source_keep_err;
                goto local_input;
        }

which looks good to me too, since the packet has src addr == dst addr.

Which part am I missing?

Thanks!
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists