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=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 AAD4EC433ED for ; Mon, 26 Apr 2021 17:10:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7EF5E61103 for ; Mon, 26 Apr 2021 17:10:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233736AbhDZRKs (ORCPT ); Mon, 26 Apr 2021 13:10:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:53208 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235341AbhDZRJD (ORCPT ); Mon, 26 Apr 2021 13:09:03 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CB85961077; Mon, 26 Apr 2021 17:08:19 +0000 (UTC) Date: Mon, 26 Apr 2021 19:08:17 +0200 From: Greg KH To: Al Viro Cc: Tavis Ormandy , linux-kernel@vger.kernel.org Subject: Re: [PATCH 186/190] Revert "virt: vbox: Only copy_from_user the request-header once" Message-ID: References: <20210421130105.1226686-1-gregkh@linuxfoundation.org> <20210421130105.1226686-187-gregkh@linuxfoundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 22, 2021 at 01:16:01AM +0000, Al Viro wrote: > On Wed, Apr 21, 2021 at 03:14:29PM -0000, Tavis Ormandy wrote: > > On 2021-04-21, Greg Kroah-Hartman wrote: > > > This reverts commit bd23a7269834dc7c1f93e83535d16ebc44b75eba. > > > > > > - *((struct vbg_ioctl_hdr *)buf) = hdr; > > > - if (copy_from_user(buf + sizeof(hdr), (void *)arg + sizeof(hdr), > > > - hdr.size_in - sizeof(hdr))) { > > > + if (copy_from_user(buf, (void *)arg, hdr.size_in)) { > > > ret = -EFAULT; > > > goto out; > > > } > > > > This one seems like a real bugfix, otherwise there's a double-fetch from > > userspace, and a TOCTOU with the hdr fields that could cause a OOB read. > > ACK, except that typecasts in there are messy as hell. But that's, > alas, consistent with the rest of the function... > > Patch itself is correct, and AFAICS Wenwen Wang > might be an innocent collateral damage from that mess - commits from that > source appear to be fairly well-written. I've dropped it from my tree now, thanks for the review. greg k-h