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-next>] [day] [month] [year] [list]
Message-ID: <trinity-80ad84c3-456a-4f51-a3e9-afee4e8ae504-1446759288452@3capp-1and1-bs03>
Date:	Thu, 5 Nov 2015 22:34:48 +0100
From:	"ronny.hegewald@...ine.de" <ronny.hegewald@...ine.de>
To:	netdev@...r.kernel.org
Subject: question about checksumming and tcp_sendpage

While reading through net-code i came across some code in tcp_sendpage which i think 
it is not working in the intended way all tie time. But as this code is at that a 
central place and pretty old, im suspicious if my analysis is really right.

The code in question is this

(from net/ipv4/tcp.c)

       if (!(sk->sk_route_caps & NETIF_F_SG) ||
           !(sk->sk_route_caps & NETIF_F_ALL_CSUM))
                 return sock_no_sendpage(sk->sk_socket, page, offset, size,
                                         flags);
 

especially this part.

      !(sk->sk_route_caps & NETIF_F_ALL_CSUM)

The problem occurs if a device only supports checksumming for ipv4 or ipv6. In 
this cases only NETIF_F_IP_CSUM or NETIF_F_IPV6_CSUM is set.

Lets assume a device is only supporting checksumming in ipv6 via NETIF_F_IPV6_CSUM,
and we are calling tcp_sendpage for a ipv4 connection. From my understanding the intend
of the above code is that in this case sock_no_sendpage should be called. But the bit-check 
against NETIF_F_ALL_CSUM will be always > 0, as it is defined as

(from include/linux/netdev_features.h)

#define NETIF_F_V4_CSUM         (NETIF_F_GEN_CSUM | NETIF_F_IP_CSUM)
#define NETIF_F_V6_CSUM         (NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM)
#define NETIF_F_ALL_CSUM        (NETIF_F_V4_CSUM | NETIF_F_V6_CSUM)

so it will never get in that branch.

So imo the code should be something like this (in pseudocode) 

      (!(sk->sk_route_caps & NETIF_F_V4_CSUM) && proto == IPV4) ||
      (!(sk->sk_route_caps & NETIF_F_V6_CSUM) && proto == IPV6)

So what am i missing?
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ