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: <BN3PR07MB25781AF1049545F0555D3E83F8F60@BN3PR07MB2578.namprd07.prod.outlook.com>
Date:   Thu, 1 Jun 2017 08:11:12 +0000
From:   "Amrani, Ram" <Ram.Amrani@...ium.com>
To:     Jia-Ju Bai <baijiaju1990@....com>,
        "monis@...lanox.com" <monis@...lanox.com>,
        "sean.hefty@...el.com" <sean.hefty@...el.com>,
        "dledford@...hat.com" <dledford@...hat.com>,
        "hal.rosenstock@...il.com" <hal.rosenstock@...il.com>,
        "leon@...nel.org" <leon@...nel.org>
CC:     "linux-rdma@...r.kernel.org" <linux-rdma@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH V2] rxe: Fix a sleep-in-atomic bug in post_one_send

> The driver may sleep under a spin lock, and the function call path is:
> post_one_send (acquire the lock by spin_lock_irqsave)
>   init_send_wqe
>     copy_from_user --> may sleep
> 
> To fix it, the lock is released before copy_from_user, and the lock is
> acquired again after this function. The parameter "flags" is used to
> restore and save the irq status.
> Thank Leon for good advice.
> 

...

>  	init_send_wr(qp, &wqe->wr, ibwr);
> @@ -742,7 +742,12 @@ static int init_send_wqe(struct rxe_qp *qp, struct ib_send_wr *ibwr,
>  		for (i = 0; i < num_sge; i++, sge++) {
>  			if (qp->is_user && copy_from_user(p, (__user void *)
>  					    (uintptr_t)sge->addr, sge->length))
> -				return -EFAULT;
> +				spin_unlock_irqrestore(&qp->sq.sq_lock, *flags);
> +				err = copy_from_user(p, (__user void *)
> +					    (uintptr_t)sge->addr, sge->length);
> +				spin_lock_irqsave(&qp->sq.sq_lock, *flags);
> +				if (qp->is_user && err)
> +					return -EFAULT;
> 
>  			else if (!qp->is_user)
>  				memcpy(p, (void *)(uintptr_t)sge->addr,

This isn't my area of expertise. Still something seems weird.
You are still calling 'copy_from_user' unprotected in the 'if'.
Also, did you mean to use curly brackets on the indented part after the first if?!

Ram

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ