From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BBB06C0044C for ; Thu, 1 Nov 2018 23:38:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 576212251D for ; Thu, 1 Nov 2018 23:38:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 576212251D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728215AbeKBInV (ORCPT ); Fri, 2 Nov 2018 04:43:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44546 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728058AbeKBInV (ORCPT ); Fri, 2 Nov 2018 04:43:21 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 70C47C0495B7; Thu, 1 Nov 2018 23:38:16 +0000 (UTC) Received: from redhat.com (ovpn-124-238.rdu2.redhat.com [10.10.124.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8FD225D9D6; Thu, 1 Nov 2018 23:38:12 +0000 (UTC) Date: Thu, 1 Nov 2018 19:38:12 -0400 From: "Michael S. Tsirkin" To: Kees Cook Cc: Linus Torvalds , KVM , virtualization@lists.linux-foundation.org, Network Development , LKML , Andrew Morton , bijan.mottahedeh@oracle.com, gedwards@ddn.com, Joe Perches , lenaic@lhuard.fr, liang.z.li@intel.com, Michal Hocko , Michal Hocko , Stefan Hajnoczi , wei.w.wang@intel.com Subject: Re: [PULL] vhost: cleanups and fixes Message-ID: <20181101193516-mutt-send-email-mst@kernel.org> References: <20181101171938-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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 01 Nov 2018 23:38:16 +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:00:23PM -0700, Kees Cook wrote: > On Thu, Nov 1, 2018 at 2:19 PM, Michael S. Tsirkin wrote: > > The following changes since commit 84df9525b0c27f3ebc2ebb1864fa62a97fdedb7d: > > > > Linux 4.19 (2018-10-22 07:37:37 +0100) > > > > are available in the Git repository at: > > > > git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git tags/for_linus > > > > for you to fetch changes up to 79f800b2e76923cd8ce0aa659cb5c019d9643bc9: > > > > MAINTAINERS: remove reference to bogus vsock file (2018-10-24 21:16:14 -0400) > > > > ---------------------------------------------------------------- > > virtio, vhost: fixes, tweaks > > > > virtio balloon page hinting support > > vhost scsi control queue > > > > misc fixes. > > > > Signed-off-by: Michael S. Tsirkin > > > > ---------------------------------------------------------------- > > Bijan Mottahedeh (3): > > vhost/scsi: Respond to control queue operations > > +static void > +vhost_scsi_send_tmf_resp(struct vhost_scsi *vs, > + struct vhost_virtqueue *vq, > + int head, unsigned int out) > +{ > + struct virtio_scsi_ctrl_tmf_resp __user *resp; > + struct virtio_scsi_ctrl_tmf_resp rsp; > + int ret; > + > + pr_debug("%s\n", __func__); > + 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? > > -Kees I am not sure copy_to_user will do the right thing here, because all this runs in context of a kernel thread. We do need access_ok which takes place way earlier in context of the task. Another reason it is safe is because the address is not coming from userspace at all. > > vhost/scsi: Extract common handling code from control queue handler > > vhost/scsi: Use common handling code in request queue handler > > > > Greg Edwards (1): > > vhost/scsi: truncate T10 PI iov_iter to prot_bytes > > > > Lénaïc Huard (1): > > kvm_config: add CONFIG_VIRTIO_MENU > > > > Stefan Hajnoczi (1): > > MAINTAINERS: remove reference to bogus vsock file > > > > Wei Wang (3): > > virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT > > mm/page_poison: expose page_poisoning_enabled to kernel modules > > virtio-balloon: VIRTIO_BALLOON_F_PAGE_POISON > > > > MAINTAINERS | 1 - > > drivers/vhost/scsi.c | 426 ++++++++++++++++++++++++++++-------- > > drivers/virtio/virtio_balloon.c | 380 +++++++++++++++++++++++++++++--- > > include/uapi/linux/virtio_balloon.h | 8 + > > kernel/configs/kvm_guest.config | 1 + > > mm/page_poison.c | 6 + > > 6 files changed, 688 insertions(+), 134 deletions(-) > > > > -- > Kees Cook