[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a2612f24-00b7-7e9e-5a9e-d0d82b22ea8e@i-love.sakura.ne.jp>
Date: Mon, 6 Jan 2020 20:04:42 +0900
From: Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>
To: David Ahern <dsahern@...il.com>
Cc: Casey Schaufler <casey@...aufler-ca.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: commit b9ef5513c99b breaks ping to ipv6 linklocal addresses on
debian buster
On 2020/01/06 13:20, David Ahern wrote:
> Hi:
>
> The failure is the connect function, not the bind.
Oops, I missed it.
>
> This change seems more appropriate to me (and fixes the failure):
>
> diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
> index ecea41ce919b..ce5e3be7c111 100644
> --- a/security/smack/smack_lsm.c
> +++ b/security/smack/smack_lsm.c
> @@ -2854,7 +2854,7 @@ static int smack_socket_connect(struct socket
> *sock, struct sockaddr *sap,
> rc = smack_netlabel_send(sock->sk, (struct sockaddr_in
> *)sap);
> break;
> case PF_INET6:
> - if (addrlen < SIN6_LEN_RFC2133 || sap->sa_family !=
> AF_INET6)
> + if (addrlen < SIN6_LEN_RFC2133)
> return -EINVAL;
This is called upon connect(), isn't it? Then, it is possible that a socket's
protocol family is PF_INET6 but address given is AF_INET, isn't it? For example,
__ip6_datagram_connect() checks for AF_INET before checking addrlen is at least
SIN6_LEN_RFC2133 bytes. Thus, I think that we need to return 0 if address given
is AF_INET even if socket is PF_INET6.
> #ifdef SMACK_IPV6_SECMARK_LABELING
> rsp = smack_ipv6host_label(sip);
>
>
> ie., if the socket family is AF_INET6 the address length should be an
> IPv6 address. The family in the sockaddr is not as important.
>
Commit b9ef5513c99b was wrong, but we need to also fix commit c673944347ed ?
Powered by blists - more mailing lists