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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180716120915.09d35dc0@epycfail>
Date:   Mon, 16 Jul 2018 12:09:15 +0200
From:   Stefano Brivio <sbrivio@...hat.com>
To:     Ursula Braun <ubraun@...ux.ibm.com>
Cc:     davem@...emloft.net, netdev@...r.kernel.org,
        linux-s390@...r.kernel.org, schwidefsky@...ibm.com,
        heiko.carstens@...ibm.com, raspl@...ux.ibm.com,
        linux-kernel@...r.kernel.org, eric.dumazet@...il.com,
        lifeasageek@...il.com
Subject: Re: [PATCH net 1/4] net/smc: take sock lock in smc_ioctl()

On Mon, 16 Jul 2018 12:01:01 +0200
Ursula Braun <ubraun@...ux.ibm.com> wrote:

> From: Ursula Braun <ursula.braun@...ux.ibm.com>
> 
> SMC ioctl processing requires the sock lock to work properly in
> all thinkable scenarios.
> Problem has been found with RaceFuzzer and fixes:
>    KASAN: null-ptr-deref Read in smc_ioctl
> 
> Reported-by: Byoungyoung Lee <lifeasageek@...il.com>
> Reported-by: syzbot+35b2c5aa76fd398b9fd4@...kaller.appspotmail.com
> Signed-off-by: Ursula Braun <ubraun@...ux.ibm.com>
> ---
>  net/smc/af_smc.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
> index 5334157f5065..a4381b38a521 100644
> --- a/net/smc/af_smc.c
> +++ b/net/smc/af_smc.c
> @@ -1524,6 +1524,7 @@ static int smc_ioctl(struct socket *sock, unsigned int cmd,
>  			return -EBADF;
>  		return smc->clcsock->ops->ioctl(smc->clcsock, cmd, arg);
>  	}
> +	lock_sock(&smc->sk);
>  	switch (cmd) {
>  	case SIOCINQ: /* same as FIONREAD */
>  		if (smc->sk.sk_state == SMC_LISTEN)

                        return -EINVAL;

you should also unlock here, and:

        case SIOCOUTQ:
                /* output queue size (not send + not acked) */
                if (smc->sk.sk_state == SMC_LISTEN)
                        return -EINVAL;

here, and:

        case SIOCOUTQNSD:
                /* output queue size (not send only) */
                if (smc->sk.sk_state == SMC_LISTEN)
                        return -EINVAL;

here, and:

        case SIOCATMARK:
                if (smc->sk.sk_state == SMC_LISTEN)
                        return -EINVAL;

here.

-- 
Stefano

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ