Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4150350imu; Fri, 30 Nov 2018 11:56:38 -0800 (PST) X-Google-Smtp-Source: AFSGD/W2ofcZWegJEnrmeJb9q5qFeiuGBPKhVm68K+co5FK3PICTv84gbVyxmL7zZMGJpx6wEFnK X-Received: by 2002:a63:955a:: with SMTP id t26mr5935855pgn.449.1543607798146; Fri, 30 Nov 2018 11:56:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543607798; cv=none; d=google.com; s=arc-20160816; b=xFSKeYRHWyfwXjBL9hKZfYHbMhq1kBBy0hilL76nIs71MhRs8Zu9UQWqau38HNK8s0 EmH+i3ZF9DSsgyQ7JxUnaWGSDAz7Iy+Jll0ZyYpJG49Xz3TjuGOuVQAhJ17Hk2UcAnG+ BIPDFrz/z6G4gLg5dDLlh1G3L5Tn8Bj8SiqfBhMNdBrE21oInI49Z2/BWpytSoblt/Ye yCfm9zFQK8zvk0N2TEb40NNQ9azZVG8isJfyXaETkoJBr7/k2KmeFf9UHO75H2fyzkAQ m8d0ldHkI5jiKbj2GgKtWYbtSANmqY7lznvsj6eeGpuC9yNJmsqdo90P9JeK73uLmz7T 3+0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=2oIIKhJSyRwjhdNl4zK9oH3NwoF2dH6bFoPcb/8Bxqs=; b=HaHQmxsDHTNOVJPWE0xZVN6La0BXosUm8TVY+6wk9j/+3wySufqOKpKlbRBbtJjtTJ nes7vIhtHmxM+E6YorBocX4M1i27QJN9i1Nb6CT0ag2p0ZSxAo6jAyxCQXYzUSQgSUaa 2bhxp+BfQd6tqDrzSH2hHrKB+GLx4Iy3SaKME2ZxZyaMXDZ/1EIspsTNAswIoAqroqro Y6WIUfIGqU9sbquR0aZltpWeC/ac4F2Rd0ljtRtGjuwaPIKbflGe/Zs31NzaBSOnl+lx o5JByqeuLQLzR+M8qAPgMC/DauLoyDMEpOM4TR4u9EcEuj5qca3Qf8/z+1WnCdWzvwat 5dIA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cd2si7085547plb.39.2018.11.30.11.56.23; Fri, 30 Nov 2018 11:56:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726719AbeLAHGI (ORCPT + 99 others); Sat, 1 Dec 2018 02:06:08 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39136 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725790AbeLAHGH (ORCPT ); Sat, 1 Dec 2018 02:06:07 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E0FD18E3F4; Fri, 30 Nov 2018 19:55:43 +0000 (UTC) Received: from redhat.com (ovpn-126-186.rdu2.redhat.com [10.10.126.186]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6A3975D782; Fri, 30 Nov 2018 19:55:38 +0000 (UTC) Date: Fri, 30 Nov 2018 14:55:38 -0500 From: "Michael S. Tsirkin" To: Bijan Mottahedeh Cc: Linus Torvalds , Kees Cook , kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, Linux Kernel Mailing List , Andrew Morton , gedwards@ddn.com, joe@perches.com, lenaic@lhuard.fr, liang.z.li@intel.com, mhocko@kernel.org, mhocko@suse.com, stefanha@redhat.com, wei.w.wang@intel.com Subject: Re: [PULL] vhost: cleanups and fixes Message-ID: <20181130145527-mutt-send-email-mst@kernel.org> References: <20181101171938-mutt-send-email-mst@kernel.org> <20181130084227-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 30 Nov 2018 19:55:44 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 30, 2018 at 11:01:03AM -0800, Bijan Mottahedeh wrote: > On 11/30/2018 5:44 AM, Michael S. Tsirkin wrote: > > On Thu, Nov 01, 2018 at 04:06:19PM -0700, Linus Torvalds wrote: > > > On Thu, Nov 1, 2018 at 4:00 PM Kees Cook wrote: > > > > + memset(&rsp, 0, sizeof(rsp)); > > > > + rsp.response = VIRTIO_SCSI_S_FUNCTION_REJECTED; > > > > + resp = vq->iov[out].iov_base; > > > > + ret = __copy_to_user(resp, &rsp, sizeof(rsp)); > > > > > > > > Is it actually safe to trust that iov_base has passed an earlier > > > > access_ok() check here? Why not just use copy_to_user() instead? > > > Good point. > > > > > > We really should have removed those double-underscore things ages ago. > > > > > > Also, apart from the address, what about the size? Wouldn't it be > > > better to use copy_to_iter() rather than implement it badly by hand? > > > > > > Linus > > Bijan can you respond please? > > Are you going to look into this and convert code to copy_to_iter? > > I don't think we should release Linux like this, so if you don't > > have the time I'd rather revert for now and you can look > > into reposting for the next release. > > > > Thanks, > > > > Sure, will do.? Can I send an individual patch for the fix to > vhost_scsi_send_tmf_reject()? > > Thanks. > > --bijan Please go ahead. -- MST