Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp216136ybg; Tue, 28 Jul 2020 04:16:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9cVp039jNf4exVKPSqJqOByOlcf6W5qYnX02je1x2byvHqDhmW8gaBtkpSQQ+XQDS19cU X-Received: by 2002:a17:906:7f90:: with SMTP id f16mr24776295ejr.507.1595934997028; Tue, 28 Jul 2020 04:16:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595934997; cv=none; d=google.com; s=arc-20160816; b=WmnjS26ozdYVSCXyXKrpIv3vQam0ah03KtxG3zV0MHjUnfb0pcOo0uoS7LPPSCuy/y B9p44Z+AXYif84OW6vtI9b3vE9FkClD4gP2Q69NSK6A/8jCgNxmKXcbXP1jikU/46gD9 N8Dd3yFJCJxn7qJy06UoYA89PiH9QL4kQb0gQX0oSgPwOP07w799UxhS03heutqENVrD M3RhbafRT3ULlSJRJP6coiUgVOSvtxff6Nt7vI6IpGifWkv/JaTs+kFhdsAvPDnGDzJX i3hNCW4VP0pLUn5us+4XGNrTyybuzVJ/BcLTXwko8kNukKEKHWLzzMvyYEk8vG3nQ44u 9bSA== 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 :dkim-signature; bh=QIWDEkYc8mxAlKuadsKFH4VbD1YSAM7HFnbpBmNVSO8=; b=pXNfLNqmMuCmyPTuINIahqSQhShRleq+PQ8hfEfLhVVG7fpuJz9An9sneIdZbaVVze FPSd8fTB+0ngbKhe06gc5eweHPuNzlBYBgKFPkZ5EF0qyPcPfUW7s9YFzPccyOrYEGxV oWt3G4uIplEB1zufkbk8AYQ6cryEi+OirYv2DnSnNvMDCj1uf/nXv1RtwpTrH5ZetBkW 482Vr8uBVpf40G0rm1GdS7PPj3/aXvci9mhaX4Z1bScagcgTlKrjrC+unNds/PnlV17h ebQUIuV0l5hWExxRQXS7yPPN3b5KifQa6HPMvYck6z8W0MnUEowmvnnv7jHxSYswigzE QaVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ig4tkCGz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y19si7878829eje.247.2020.07.28.04.16.14; Tue, 28 Jul 2020 04:16:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ig4tkCGz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728994AbgG1LPb (ORCPT + 99 others); Tue, 28 Jul 2020 07:15:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728866AbgG1LPa (ORCPT ); Tue, 28 Jul 2020 07:15:30 -0400 Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE9DCC061794 for ; Tue, 28 Jul 2020 04:15:30 -0700 (PDT) Received: by mail-qk1-x743.google.com with SMTP id l64so11394076qkb.8 for ; Tue, 28 Jul 2020 04:15:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=QIWDEkYc8mxAlKuadsKFH4VbD1YSAM7HFnbpBmNVSO8=; b=ig4tkCGz3vBobXOMO7BoapRzWs6lWMRevLLAhF4HMFvFHk51aV5q+u29L0ciq0z5Bw 9heErKQGzKLJu5Sw+Tw8VfRTOpDfyoBOqwfy2SZT/dmbgSiqBwmyZDc5LBGtDvPp23+u ofAVBqom40t6XY+Ryc4eHoYhp7jof7gqfisCiwstRZMWzsipSyHPeAlmGRCltZqByuur l5qxWpuYjXF5o+VAXFK8pnsE41kEu8Ku+gq4KJ+NjXqKFmQyHyT29aBk3fOpJmkdk56z gTlNgo1uRetcwRU0yFDtYZBt1QJi9/sa5lS94DXH4cgYhPvvM969UBD0TUp9jO4NsJC8 Z2Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=QIWDEkYc8mxAlKuadsKFH4VbD1YSAM7HFnbpBmNVSO8=; b=LLDY5dTHxrfjWflX/17QJOSx++VtWjycWxZZMAiVNPl6KS4YAnn+m9/nfpmCpPvcZo vBWAWrMRa6JmE5BHJDSF1Xr7AJl4+yt28khgzjr6gaPtRNfIUFwsufGM+TSds1B+mi2R SiSrq8/+SVLFjs5HFIvHl2tXn8qhAkQvfbWUc5wBzm7FMWj6LigDHtbFd7jcV1Xhfj1W RPTFFvMPM6eJsYGFvHjQt7O6vpyCkHphkfwBJ7oVOxuPIaXH/wsDzNRoTvBiq9hbxhjq y/gjyY+NBHc7yv3ehkBbSPOMdU72F/OGsd7ceCiGR9+48EfbSy9iWF8cuAzvd1IFnzYs J+rQ== X-Gm-Message-State: AOAM533kfz4gqTNHtuBc5j+MtHdNxIKbjJMVC1kJM/3w03HzKoOK6IkG d9Qx7UsQiE+4sfWRDK4U2A== X-Received: by 2002:a05:620a:151:: with SMTP id e17mr27492002qkn.173.1595934929870; Tue, 28 Jul 2020 04:15:29 -0700 (PDT) Received: from PWN (c-76-119-149-155.hsd1.ma.comcast.net. [76.119.149.155]) by smtp.gmail.com with ESMTPSA id w27sm17261967qtv.68.2020.07.28.04.15.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jul 2020 04:15:29 -0700 (PDT) Date: Tue, 28 Jul 2020 07:15:27 -0400 From: Peilin Ye To: Arnd Bergmann Cc: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Dan Carpenter , Greg Kroah-Hartman , linux-kernel-mentees@lists.linuxfoundation.org, dri-devel , "linux-kernel@vger.kernel.org" Subject: Re: [Linux-kernel-mentees] [PATCH] drm/bufs: Prevent kernel-infoleak in copy_one_buf() Message-ID: <20200728111527.GA407693@PWN> References: <20200728014343.341303-1-yepeilin.cs@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 28, 2020 at 10:11:09AM +0200, Arnd Bergmann wrote: > On Tue, Jul 28, 2020 at 3:45 AM Peilin Ye wrote: > > > > copy_one_buf() is copying uninitialized stack memory to userspace due to > > the compiler not initializing holes in statically allocated structures. > > Fix it by initializing `v` with memset(). > > I would add 'potentially' somewhere in that description: it is architecture > dependent whether there are holes in this structure as 'enum' types > and 'long' are both dependent on the ABI, and even if there is a hole, > it is undefined behavior whether the hold gets initialized. I see. I will fix that up. Thank you for the advice! Peilin Ye > Other than that, the patch looks good. > > > Cc: stable@vger.kernel.org > > Fixes: 5c7640ab6258 ("switch compat_drm_infobufs() to drm_ioctl_kernel()") > > Suggested-by: Dan Carpenter > > Signed-off-by: Peilin Ye > > Acked-by: Arnd Bergmann