Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3763362imu; Fri, 30 Nov 2018 05:45:35 -0800 (PST) X-Google-Smtp-Source: AFSGD/V8W4UCTpqUa3VQDAiZdSuTR3c3C5jHfuqt6nG4H0PK+C6A7BRydApyCYBRfrM6vsc5Wi2/ X-Received: by 2002:a17:902:b595:: with SMTP id a21mr5541630pls.120.1543585535577; Fri, 30 Nov 2018 05:45:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543585535; cv=none; d=google.com; s=arc-20160816; b=LfdScjUCNn8Muh6dvV9nOxkD1UZLm2aaIa5i9cRDbIoIGDsIr9yy+/blURDsHFS5ui D8dPAZd+gVC3A0U7wmYDS7QaIqU6wlZPW4W/ZeYIEfHe71Mh/Ep+s96ADIs4GlBQdFMo 42U8IZqInt0/dQ0cTCKD/saX8QkagkYEGHuwEdY/jNzH4kjv/Tt1YM7y5I324Fqbixau Pp409CfhCMhSeE8doKrxU02lOiVQ2nkNzk31dGQ94bzcHZ1bGxI/4ktrvDmQ7ffSR/tB dD0Z6KzGjc4yJ24EvrFWzewOROxx2blpw3cxWI+QeMwsrQrqG4eQEsTcXnjTWjkXI5CM rJ9A== 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-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=CnEXkmeLwEh2dXFXaLVELzunN5sXoHmwnfXE24LdsK0=; b=YGwzkjcv2kIDUq2xzKgrbv5+N1mLBkutXhWVDDfA7aC/NO3gyDxS6YEjt8tCNrRH/4 8C0P+cTRJ1gZobr7opX7snXk1+B90MTMSCPhlu/8dH0wQdJp6uWAi2SOODf1IPDew2hr 8Ro+B/4YJzNC/1v1zChbwYOwtva1z2C+VHagT6FgiF9KFDiG6vOMAdOT2qFbGhfG4EgX fCwdUk8Of9XEXuUO53m6EV7/l8jbIyU7xJHkgI/YiF0BM+kMDb/7nbcH9cnRekGoyxDs 0ZNVI1O/F9rgZdZnfXUK7bmTBs6h++iB+5Y7iiBQQXW2FwUjdvPQK3Qtm5u4b9jrWpRM qZfQ== 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 d9si4743785pgv.123.2018.11.30.05.45.20; Fri, 30 Nov 2018 05:45:35 -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 S1727190AbeLAAxo (ORCPT + 99 others); Fri, 30 Nov 2018 19:53:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36182 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726070AbeLAAxo (ORCPT ); Fri, 30 Nov 2018 19:53:44 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 69C543164669; Fri, 30 Nov 2018 13:44:22 +0000 (UTC) Received: from redhat.com (ovpn-120-67.rdu2.redhat.com [10.10.120.67]) by smtp.corp.redhat.com (Postfix) with SMTP id CECBE1057075; Fri, 30 Nov 2018 13:44:16 +0000 (UTC) Date: Fri, 30 Nov 2018 08:44:16 -0500 From: "Michael S. Tsirkin" To: Linus Torvalds Cc: Kees Cook , kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, Linux Kernel Mailing List , Andrew Morton , bijan.mottahedeh@oracle.com, 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: <20181130084227-mutt-send-email-mst@kernel.org> References: <20181101171938-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Fri, 30 Nov 2018 13:44:23 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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, -- MST