Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3266489pxa; Sat, 8 Aug 2020 15:59:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyr9Wq/xR1ZBz8ODgG+1S7N011KS4ZJpz4/ANyf4Rh6Q5bhPa9h7AkTARR5AkdRxI0m6b9J X-Received: by 2002:aa7:df95:: with SMTP id b21mr14427269edy.86.1596927573376; Sat, 08 Aug 2020 15:59:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596927573; cv=none; d=google.com; s=arc-20160816; b=Wri3ydTOewaeYu6j27GFsP/epwxkpPKp4GRldj4scbzlBIjwTdCI2F8r0Mah9Gxe9U LglZiq/THseieXILBhX7GTwLe+hzXdg8g/FEOoBk7TmHURAEeksmgoifWHYbtO5mdA/3 OWoQ3q23XyCqmtaX9CONTzEzazMExrwJJKrr3q3ljLj+loW06+In48oGxm3w8KdpN+HU 7VeeQCY0KAc55yMF+H5BIRWZrUeV1WBTfoYlF1AO+XH92wdBt1XIKWsdvIWjgXzIIgy5 Dor87YXXD5CYs1I/1Vii2jCUuIScqLAz/b8QQR750o9nrv7D1AU9+wtyCWAxrAcsT5ya oa/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=9sPtCXARRDyoJ9gED6VcstU3ZnY0CN85dWocZ7ctG2E=; b=DbkPOTVtjkMb+1v+eVwnsq64WpMjGtEnxELZ/4CKwy8a6iA906V7zfbCqz/sG97ide 2o+CyhGGZC/RwzVbaI5GwUdQAiaVDvhjLIBCHJ7vJYVdb3t5xbfVvLTbXzV0dPDdNtvL iVyPFxr8KOVThcZAJsA43oMYNgHuc7dzrm+kQuQfbWtraDZQnOHolktUSymx0r7ici1i P9Zi7krN/P+VJc3h7hXdfZb5c8uFPC2PUxBat+MpnIZHrLG1kcn9XLgF4loWlgTWXk2I LlnavsfVE8HSoL2Gnoq4JLg/Mt8UAWw/zlpFyukiJAbIh7npDrZfXQgovxSeMjNvRZtd oKwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="QZU/Tvgq"; 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 e15si7830641edy.357.2020.08.08.15.59.10; Sat, 08 Aug 2020 15:59:33 -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="QZU/Tvgq"; 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 S1726291AbgHHW5i (ORCPT + 99 others); Sat, 8 Aug 2020 18:57:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725988AbgHHW5h (ORCPT ); Sat, 8 Aug 2020 18:57:37 -0400 Received: from mail-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2250C061756; Sat, 8 Aug 2020 15:57:37 -0700 (PDT) Received: by mail-pj1-x1043.google.com with SMTP id c6so2761275pje.1; Sat, 08 Aug 2020 15:57:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=9sPtCXARRDyoJ9gED6VcstU3ZnY0CN85dWocZ7ctG2E=; b=QZU/Tvgq78IUEtDcC1+6C6xvjHGuXJHXguScPFEZz+aS8foez55jwUhTUnx6KF7Il+ M4iZheUMXLzs7xSlWXfG7H+dM0oO1GHdyFlV0iYOxUVqXT3hfmdNyhfIzRT+rq9ZVN0p lRJeSK58lKVj6qy80rOKm5wmcgQJxk8Egn9Qe4S2LdY9PTEFAUCSDT509S/C9+IxX6PH sNXvvUkN+iMb38o1tJ6uK54VtqU/ZK2fQsTq02a3T44B4e6sPjqwCS08rXMMlOJD1Akz yjwAl/o38v5nzut99M9Sbzr9YLxJdAPl/n+p9mtauvxWllfoTls6vC9FiQQ+0wzanl/6 Aeyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=9sPtCXARRDyoJ9gED6VcstU3ZnY0CN85dWocZ7ctG2E=; b=pc1ce5ZdI0gvM5iXcPpO3CzZuagcLFgbxg1XOYwpAyV5euFJdsDoOg3PIMKisqtZBh d85bo0dT9NEH+m9x8I1zJZzDe/GTygF/mGT/NqfTufw7J+PQDUcRDsXvfYSR9Ko6GjRi 5iAB0XWncXBU1IjdmNItUR2Qz+AkSLKvrzSSBXy/MBjsWFPAHq1ucobzB7YlN2Bk7Gsn b9xT4J6hPHWmqPVvbe/Fx6AqUCvnEWcgGJOUpMWnFnEBtygziOsgx7++4UHx1TVxlRNB ugRm/D9qgrXaa+RGph3QCxt56tTZU2ZZR/TdVgPZXxmA1c9+UpBi0jFn2RAW6t3IcgVZ 2vpQ== X-Gm-Message-State: AOAM532Y80AuIWCNU5D+X8EDBfwHY4WW4CXAa6am/Nbi4i4yn7Cs4Y+y qHC/npR9im4OaCELMRw1VH4/uoF5oj9D3Q== X-Received: by 2002:a17:90a:d482:: with SMTP id s2mr19980811pju.140.1596927456678; Sat, 08 Aug 2020 15:57:36 -0700 (PDT) Received: from [100.115.92.198] (18.48.24.136.in-addr.arpa. [136.24.48.18]) by smtp.gmail.com with ESMTPSA id y17sm17167551pfe.30.2020.08.08.15.57.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 08 Aug 2020 15:57:36 -0700 (PDT) Subject: Re: [Linux-kernel-mentees] [PATCH net] rds: Prevent kernel-infoleak in rds_notify_queue_get() To: Jason Gunthorpe , Joe Perches Cc: Leon Romanovsky , Greg Kroah-Hartman , Peilin Ye , Santosh Shilimkar , "David S. Miller" , Jakub Kicinski , Dan Carpenter , Arnd Bergmann , 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 References: <20200731053333.GB466103@kroah.com> <20200731140452.GE24045@ziepe.ca> <20200731142148.GA1718799@kroah.com> <20200731143604.GF24045@ziepe.ca> <20200731171924.GA2014207@kroah.com> <20200801053833.GK75549@unreal> <20200802221020.GN24045@ziepe.ca> <20200802222843.GP24045@ziepe.ca> <60584f4c0303106b42463ddcfb108ec4a1f0b705.camel@perches.com> <20200803230627.GQ24045@ziepe.ca> From: Jack Leadford Message-ID: Date: Sat, 8 Aug 2020 15:57:33 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <20200803230627.GQ24045@ziepe.ca> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello! Thanks to Jason for getting this conversation back on track. Yes: in general, {} or a partial initializer /will/ zero padding bits. However, there is a bug in some versions of GCC where {} will /not/ zero padding bits; actually, Jason's test program in this mail https://lore.kernel.org/lkml/20200731143604.GF24045@ziepe.ca/ has the right ingredients to trigger the bug, but the GCC versions used are outside of the bug window. :) For more details on these cases and more (including said GCC bug), see my paper at: https://www.nccgroup.com/us/about-us/newsroom-and-events/blog/2019/october/padding-the-struct-how-a-compiler-optimization-can-disclose-stack-memory/ Hopefully this paper can serve as a helpful reference when these cases are encountered in the kernel. Thank you. Jack Leadford On 8/3/20 4:06 PM, Jason Gunthorpe wrote: > On Sun, Aug 02, 2020 at 03:45:40PM -0700, Joe Perches wrote: >> On Sun, 2020-08-02 at 19:28 -0300, Jason Gunthorpe wrote: >>> On Sun, Aug 02, 2020 at 03:23:58PM -0700, Joe Perches wrote: >>>> On Sun, 2020-08-02 at 19:10 -0300, Jason Gunthorpe wrote: >>>>> On Sat, Aug 01, 2020 at 08:38:33AM +0300, Leon Romanovsky wrote: >>>>> >>>>>> I'm using {} instead of {0} because of this GCC bug. >>>>>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119 >>>>> >>>>> This is why the {} extension exists.. >>>> >>>> There is no guarantee that the gcc struct initialization {} >>>> extension also zeros padding. >>> >>> We just went over this. Yes there is, C11 requires it. >> >> c11 is not c90. The kernel uses c90. > > The kernel already relies on a lot of C11/C99 features and > behaviors. For instance Linus just bumped the minimum compiler version > so that C11's _Generic is usable. > > Why do you think this particular part of C11 shouldn't be relied on? > > Jason > >