[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 6 Jun 2019 13:52:49 +0200
From: Nicolas Dichtel <nicolas.dichtel@...nd.com>
To: Olivier Matz <olivier.matz@...nd.com>, netdev@...r.kernel.org,
"David S . Miller" <davem@...emloft.net>
Cc: Hannes Frederic Sowa <hannes@...essinduktion.org>
Subject: Re: [PATCH net 2/2] ipv6: fix EFAULT on sendto with icmpv6 and
hdrincl
Le 06/06/2019 à 09:15, Olivier Matz a écrit :
> The following code returns EFAULT (Bad address):
>
> s = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6);
> setsockopt(s, SOL_IPV6, IPV6_HDRINCL, 1);
> sendto(ipv6_icmp6_packet, addr); /* returns -1, errno = EFAULT */
>
> The IPv4 equivalent code works. A workaround is to use IPPROTO_RAW
> instead of IPPROTO_ICMPV6.
>
> The failure happens because 2 bytes are eaten from the msghdr by
> rawv6_probe_proto_opt() starting from commit 19e3c66b52ca ("ipv6
> equivalent of "ipv4: Avoid reading user iov twice after
> raw_probe_proto_opt""), but at that time it was not a problem because
> IPV6_HDRINCL was not yet introduced.
>
> Only eat these 2 bytes if hdrincl == 0.
>
> Fixes: 715f504b1189 ("ipv6: add IPV6_HDRINCL option for raw sockets")
> Signed-off-by: Olivier Matz <olivier.matz@...nd.com>
Acked-by: Nicolas Dichtel <nicolas.dichtel@...nd.com>
Powered by blists - more mailing lists