Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp832441ybb; Fri, 20 Mar 2020 08:47:39 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuuqHqmgnKm7Y5NKUmzG6C//a0ro36dDqvvRz5t/Wis2VkSGWzvNtBw3dGOBffD2/pNvBWW X-Received: by 2002:aca:d5d1:: with SMTP id m200mr7107179oig.49.1584719259314; Fri, 20 Mar 2020 08:47:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584719259; cv=none; d=google.com; s=arc-20160816; b=rGtQG9rnUZ2rOWpdZ/YrKnoGc/9ORH1Au2IUR8gV2p8ssOEM4pR7ua2XqUN235WhJM Eb4U2bNdQvTpUFXARJKwjhTX67I9yG6Yipoae+EYcWgXMOFud7QsL5qCmf5HWkWvkORm OUEAxgTU4an5Zaa0H+g4Fdcoh3lRLONMyGTI0rMuAtQd3p1+1uxy4Oba4SkHOqHFh9JL BbiuJEZAB3uyFN3efFDz/WvbhPFuUGdBgs49U9eH4RyIVzmT5Xw/cTZxLijhYCmFPoeJ n3/Kx+ierzWBiyDQN+1p4vTDtSlKqA+nWQ+fDVZvqnyOJaMLUxh+BEDU0IuvhCl5/xcv 7guA== 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=7jm9GW7oZIu2avy68pMnLphLfmqyLgOQJZdQyFw9H8M=; b=KeM17x2W0sX6BC8K9fU1e3YJg8Vj+6nXTphriNw22/P5FTB6ayCPUfaJTYxw0mITjc i/w1XZChZ3qYlHKqJEMt9RmftHgjOeOWnRSXuLz52ZmHtBJwdOB1ORj1fvr+fYgfIqsa /YXuvHCAuLPWLGU4HP/kLIH3B65eDAdOEZrzEZxGDXkf97teATJPC/RJcJ3WenorixTC 7TyvPxnO2GcpxA4xuJc/hIcw0dsJUeQROUzuUrpN9ZFdO3vO/hL30+WOEwWz8wA+7W+g IHzge4y4q99Q1UQrOuA2tWa+tri7r8EJ1z2ykRbGCLYPcNXviC4pKwYhrrDbVRsLbEaB Y6eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mMnfAdxQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r184si2669587oie.79.2020.03.20.08.47.24; Fri, 20 Mar 2020 08:47:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mMnfAdxQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727426AbgCTPqg (ORCPT + 99 others); Fri, 20 Mar 2020 11:46:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:39338 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727113AbgCTPqg (ORCPT ); Fri, 20 Mar 2020 11:46:36 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8A9FA2070A; Fri, 20 Mar 2020 15:46:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584719196; bh=vGKLtExp+TztSBVJmqOiwJhtSCSDjoH/BogaZKD2yIM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mMnfAdxQ8RgtNr+kx0OS0w+LnS2wzxEm0xMsW9/nqpCR8sP7FQvkjy9HpshXTFsYS UZ57JlyU3Euog+h3fcumSH+k0Dm9dacH8xMo8L1JTjF9A26Cj5hjPxlUkGreNH/Nzy ry9eMyzvl0/XO4ysV3oBGXd8UsqVkdYn8YXNWEs0= Date: Fri, 20 Mar 2020 16:46:33 +0100 From: Greg Kroah-Hartman To: Yonghong Song Cc: Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Andrii Nakryiko , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, Maciej =?utf-8?Q?=C5=BBenczykowski?= , John Stultz , Alexander Potapenko , Alistair Delva Subject: Re: [PATCH] bpf: explicitly memset the bpf_attr structure Message-ID: <20200320154633.GB765793@kroah.com> References: <20200320094813.GA421650@kroah.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 Fri, Mar 20, 2020 at 08:23:57AM -0700, Yonghong Song wrote: > > > On 3/20/20 2:48 AM, Greg Kroah-Hartman wrote: > > For the bpf syscall, we are relying on the compiler to properly zero out > > the bpf_attr union that we copy userspace data into. Unfortunately that > > doesn't always work properly, padding and other oddities might not be > > correctly zeroed, and in some tests odd things have been found when the > > stack is pre-initialized to other values. > > Maybe add more contexts about the failure itself so it could be clear > why we need this patch. I didn't have the full details, I think Maciej has them though. > As far as I know from the link below, the failure happens in > CHECK_ATTR() which checks any unused *area* for a particular subcommand > must be 0, and this patch tries to provide this guarantee beyond > area beyond min(uattr_size, sizeof(attr)). That macro also will get tripped up if padding is not zeroed out as well, so this is good to fix up. thanks for the review. greg k-h