Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4103781imu; Fri, 30 Nov 2018 11:03:04 -0800 (PST) X-Google-Smtp-Source: AFSGD/UJxyJK3xx0MPpW/Dnw7gaXdNyv9D4N8HPCXz4USdQ703Vo7GMM6MTBdVdlXieRXTtaO2ai X-Received: by 2002:a63:7219:: with SMTP id n25mr5865370pgc.324.1543604583936; Fri, 30 Nov 2018 11:03:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543604583; cv=none; d=google.com; s=arc-20160816; b=zCfO76P1j2ntwuen8HytiCzXDzo5MfwhSDxAgrVqu1F/NlRGf6tjBaxR/d4VjPp8g8 WXjgBx8uZEaro6iiK0kGT71YARMz8yZeIckrdSpSd9zM89e1JJWjOwZNPQYJw2mnOoWK F+p8JBRXj6Tv/dC/N5xG7+OSZZEGrj6VJxjA1ECdokS01UijEaXKjYgGYyT8JNkB9BXm RM8rnqw3V4UPiAb8My2VEvTza7jzeVoBmBjrHiiF3dB8sf+VtdOUGg0SGBf+etbYXjl4 dZ/cFkEeb/Gic3aVG+TZdFZ1KHeQQWUctySnCe1PM3wLitx2IRGVRX4pj0b5iMUtxGFz 8YvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=PxwZbLjKgQoXunc74PUvQscm47Sj4mPW9TZmUlQzteU=; b=gSVG13ispKayxVe0lP3pqzXySRqST5e1VhtYcsFe1mMA2qKXkQroxEx1WKAeLykKzk wr4urbbGcJ2ddwEjw3ohGfkoAZKz4jvqasGSzYn5rl5cr6y/oilxNKm3v16PGCoqjfRd MLp0sv+KM5dq2IDcoWgqDAui+CJVBuhaWwdBI9eenomQ99A64h49IaOvOI+/vf5Sx8yF GDbv2hy+AmzNgg2AXPC83ddaxbUca1CAdH/I/UISUKkGaw5lSRm9tEMKz24SNLmJg2Pv rmm0UEG0alL+OZz1rsI2fS5UEz+HXfv3lv0xo4q0TOqMmeGXjdhCx/oge2TJp7MykG5q 9VbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=Sch7T17C; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bh5si5637551plb.42.2018.11.30.11.02.48; Fri, 30 Nov 2018 11:03:03 -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; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=Sch7T17C; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726915AbeLAGLq (ORCPT + 99 others); Sat, 1 Dec 2018 01:11:46 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:58962 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725993AbeLAGLp (ORCPT ); Sat, 1 Dec 2018 01:11:45 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wAUIwe4t011951; Fri, 30 Nov 2018 19:01:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=PxwZbLjKgQoXunc74PUvQscm47Sj4mPW9TZmUlQzteU=; b=Sch7T17Ci0sOQCQiW0m5jg99oAe7Tv1/RzF2rnuoGMKmc5Etf+R98+3Q19pnnoy0VEiT GpqQ1w59hKMOiyfZKHEhhZq39OaURll5s6UcSXAZGx6iHGdnjlkGcr7dv1cTjwjp+SLe Wz3stMaB2ZleeCJBDxHYdYBxS6XxEgufrjdD5OTCA3/QND57ygXOObiL/nM5uRUsjSVL 36jguYBqso/cFMBwxIFS7EJAUh4am3HgwpM0ckkmPNXvA3lbDuMuvX3ZLmdiS0Q5HlN0 jHQIcrUeBq8l9d9dwl8GoQStzWqBx83AfBtlvo2ZyXPunxTi1TW1IkrlPTwBvK83Wbzt dw== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2120.oracle.com with ESMTP id 2nxxkqywk9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 30 Nov 2018 19:01:12 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id wAUJ1BwI007307 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 30 Nov 2018 19:01:11 GMT Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id wAUJ17Is016204; Fri, 30 Nov 2018 19:01:08 GMT Received: from [10.154.136.200] (/10.154.136.200) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 30 Nov 2018 11:01:07 -0800 Subject: Re: [PULL] vhost: cleanups and fixes To: "Michael S. Tsirkin" , Linus Torvalds Cc: 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 References: <20181101171938-mutt-send-email-mst@kernel.org> <20181130084227-mutt-send-email-mst@kernel.org> From: Bijan Mottahedeh Message-ID: Date: Fri, 30 Nov 2018 11:01:03 -0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20181130084227-mutt-send-email-mst@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Antivirus: Avast (VPS 181130-2, 11/30/2018), Outbound message X-Antivirus-Status: Clean X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9093 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=975 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1811300161 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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