Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp2543048ybg; Fri, 31 Jul 2020 03:01:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+YD3Anbns+12Sktzy4g8d8DTCGeGZllN3SosBgChL17y9URnSBx67fgZwFvKdF/xY40mX X-Received: by 2002:a17:906:a952:: with SMTP id hh18mr173729ejb.272.1596189706300; Fri, 31 Jul 2020 03:01:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596189706; cv=none; d=google.com; s=arc-20160816; b=q0dXbhznkqep55BAVqOd8capkZioOXlNBnhP6XIOAYnT2ThPGsNtkFmTWPKFhJFFjT M4pbIM6YHClNy2HR7kPUR68POCcYtCmtFi4YY1SVdelcGSrPEEjBiwflSP6Kq7Gj4uKX Yqr5T9xalVP6t8cbq1+MrQqhG4n+4y10II6Huq3jylUZqUvlVphYd4PJtlutwN8M1LWc 2r/FdURhvz8JembkOt/sLU5MpPmSSfC9I+6MjtFP2nsMZmgtcua9lq+vYUPMz4gpj/aL pQQ1re499FEwfXYrDwtYyz3zkZXaXAC2sYjh0Ch7s36NuEwp9gsFYLjFRWecxzRbRyDB lE8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=S9ve+QX3l80OyB6k9hGZRrisazhkSN61TPadeW92FAU=; b=J1hRpqeuJknhgSJY5EaomWd5yi/NsGZL2sk7oCpdqa4zGnNUlTsByrIaaXsCZSfyWP 3e0fYIF2aK2q7bWR8TvcgxnUSLHMgtkkU4wngKaVZHdf+TK9bitEsmmCyo+WJL5E6432 K36HKcCeWY8rv6yD5HlPj10YTFyVYhNQ+vG1eI2WCe00HgK/Cwd0FMPOy4tMx8LII5tt IRdzBzp0vfhd8Mcdb0kW1dfwAILJlJvBUenqm8X92PvyLdmK1RF6TngDysSEyQ71/wM7 /KW9nhe1yBxv003gvC6F9WfrM0/t+mZgTae6tiyGDo7WqNFFXrNoeOYzfELbvgGIjlCt 5T2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=SEgYugyq; 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=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v10si4722125eds.470.2020.07.31.03.01.23; Fri, 31 Jul 2020 03:01:46 -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=@oracle.com header.s=corp-2020-01-29 header.b=SEgYugyq; 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=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732503AbgGaKAL (ORCPT + 99 others); Fri, 31 Jul 2020 06:00:11 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:52650 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732292AbgGaKAK (ORCPT ); Fri, 31 Jul 2020 06:00:10 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 06V9qw7Y015363; Fri, 31 Jul 2020 09:59:58 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2020-01-29; bh=S9ve+QX3l80OyB6k9hGZRrisazhkSN61TPadeW92FAU=; b=SEgYugyqhNyevsmB58/8dBw3UeEQKZZn4RGLKsfjMQGdB5w7poSmCCujgRo6lvNyP9J2 N6BlFv+evhhJgcXclTknHVtdHLqu2VEzhibj9GRqcDmfmSWUU5JeXzJPjdvFhxsIdS6x yZafV/ElbdjOysvaMjddzIPbyQy0GMoe5f/bK4NU7pR16NFjs1rwbVCfbis9hw7X8DxM wUO1jUuRdpbAEygEA3aHk/8hJbl0gXbPOHvR9RcyJqWGscZW7v2M48lyVejaheVou/Qc 2ZjlWBT4ZeCxpFJkDwOp9keWcdG7bQg6HQt0Ol0SuLZZ1nsF+0pY7zx0wV/+3hu0k1s/ WQ== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 32hu1jr9sn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 31 Jul 2020 09:59:58 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 06V9wiXB043580; Fri, 31 Jul 2020 09:59:58 GMT Received: from pps.reinject (localhost [127.0.0.1]) by userp3020.oracle.com with ESMTP id 32mf706216-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 31 Jul 2020 09:59:58 +0000 Received: from userp3020.oracle.com (userp3020.oracle.com [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 06V9xvtd046242; Fri, 31 Jul 2020 09:59:57 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userp3020.oracle.com with ESMTP id 32mf70620b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 31 Jul 2020 09:59:57 +0000 Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 06V9xsLW005845; Fri, 31 Jul 2020 09:59:55 GMT Received: from kadam (/41.57.98.10) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 31 Jul 2020 02:59:54 -0700 Date: Fri, 31 Jul 2020 12:59:43 +0300 From: Dan Carpenter To: Leon Romanovsky Cc: Peilin Ye , Santosh Shilimkar , "David S. Miller" , Jakub Kicinski , Arnd Bergmann , Greg Kroah-Hartman , linux-kernel-mentees@lists.linuxfoundation.org, netdev@vger.kernel.org, linux-rdma@vger.kernel.org, rds-devel@oss.oracle.com, linux-kernel@vger.kernel.org Subject: Re: [Linux-kernel-mentees] [PATCH net] rds: Prevent kernel-infoleak in rds_notify_queue_get() Message-ID: <20200731095943.GI5493@kadam> References: <20200730192026.110246-1-yepeilin.cs@gmail.com> <20200731045301.GI75549@unreal> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200731045301.GI75549@unreal> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9698 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 clxscore=1011 malwarescore=0 spamscore=0 suspectscore=0 bulkscore=0 priorityscore=1501 phishscore=0 mlxlogscore=999 lowpriorityscore=0 impostorscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007310073 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 31, 2020 at 07:53:01AM +0300, Leon Romanovsky wrote: > On Thu, Jul 30, 2020 at 03:20:26PM -0400, Peilin Ye wrote: > > rds_notify_queue_get() is potentially copying uninitialized kernel stack > > memory to userspace since the compiler may leave a 4-byte hole at the end > > of `cmsg`. > > > > In 2016 we tried to fix this issue by doing `= { 0 };` on `cmsg`, which > > unfortunately does not always initialize that 4-byte hole. Fix it by using > > memset() instead. > > Of course, this is the difference between "{ 0 }" and "{}" initializations. > No, there is no difference. Even struct assignments like: foo = *bar; can leave struct holes uninitialized. Depending on the compiler the assignment can be implemented as a memset() or as a series of struct member assignments. regards, dan carpenter