Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4618011pxj; Wed, 12 May 2021 09:20:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxS4LyckJJ+Ur+olSmdYuOqQ9VfZFv4IpaCj0NirJ/Objzr5ul87Yn4p5WXJy/1m/pM56TJ X-Received: by 2002:a9d:58c5:: with SMTP id s5mr32267507oth.243.1620836440030; Wed, 12 May 2021 09:20:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620836440; cv=none; d=google.com; s=arc-20160816; b=Zw4n7427U9JMblL0yy9PWE9rd5SXiC+ttAFsM2Uqmmi6sB8bVaxtzquqAtCNYZzPGR 9W2tVDhC8W3hkYHqUy2JfFCFIvp9YVAsv/25+JyuJzwQHyv4lHjfJoukCoJuzYrTslrO DngMgfttOpuRJT07AJC7Jmu7HZcTpnkjPAio+D8gg3bcWxdF4m4+lyewVnFuqSl44CYf yF6dlsdUOdIeFAFXHFosVE7fSgEOeofHG3fLtKKovwTz789PQ69vZ9bXACx2/tDGtk2l qawf6Fkxu32e7x8ofOtSBPHkmAG5LcRc6QukZU8TovU1n62PneAnrXN9SnjUOPPuFCuI m4FQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wmVDqyJ7yPxG47Ko01IcJMqd3h7X+QGv6gKR0FujHDc=; b=eVCTXwFmkkAHJrYIu1un+EK4jN9Yxk7ngRnplwg2JBO81uM9Ox0EL3ikYAkeZpcXaU xHSTDUIj6EJnRLfl8fVeoITnp3CJj/hycK0R24hT4rO1UmHr21TqOJ0i5mCW04dwhwJB /EiTFk+9f8aWS1wf8yYtPDHwac+cqBzlGQKRZ2YyeylpCU2NOMwolDjRfznVHi+p0lSW KGamtLZjSPYGUMaUur60co8LZP1YlIWx7eF06Um4J9/HInIoq8Mb8VbSWlzpJHKivdzf d5kDlKIU7maZ37c9Bg6oeYHH+XWzThgnhYwq9qB8nihI7/Whv31w+WKdv2vR8pfU+Qku AIkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1GB1Pzow; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a9si392982oif.124.2021.05.12.09.20.26; Wed, 12 May 2021 09:20:40 -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=@linuxfoundation.org header.s=korg header.b=1GB1Pzow; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240212AbhELQRh (ORCPT + 99 others); Wed, 12 May 2021 12:17:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:50220 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232975AbhELPeC (ORCPT ); Wed, 12 May 2021 11:34:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6832E61988; Wed, 12 May 2021 15:17:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832641; bh=UoBPs+ib/MLJd/Zb/Kg7QX2w2kOvX+whXCVSfpeLZQM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1GB1PzowyR9Ls2s5ZVsV5lloc47pAXzeb4XhmqqKU90BgY4QydyAxulf+sUq9noXx qVJlm2NUue2zpj1m/i8KI6buvjQ+w4vpz1YOTnOnImErSlWp/vjhsJmtVEyVGLMWqD RUHGJB2dS1Eznz8dnEX5JvXOH3rPfr0RI594c5I4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrii Nakryiko , KP Singh , Sasha Levin Subject: [PATCH 5.10 362/530] libbpf: Add explicit padding to btf_dump_emit_type_decl_opts Date: Wed, 12 May 2021 16:47:52 +0200 Message-Id: <20210512144831.679489000@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: KP Singh [ Upstream commit ea24b19562fe5f72c78319dbb347b701818956d9 ] Similar to https://lore.kernel.org/bpf/20210313210920.1959628-2-andrii@kernel.org/ When DECLARE_LIBBPF_OPTS is used with inline field initialization, e.g: DECLARE_LIBBPF_OPTS(btf_dump_emit_type_decl_opts, opts, .field_name = var_ident, .indent_level = 2, .strip_mods = strip_mods, ); and compiled in debug mode, the compiler generates code which leaves the padding uninitialized and triggers errors within libbpf APIs which require strict zero initialization of OPTS structs. Adding anonymous padding field fixes the issue. Fixes: 9f81654eebe8 ("libbpf: Expose BTF-to-C type declaration emitting API") Suggested-by: Andrii Nakryiko Signed-off-by: KP Singh Signed-off-by: Andrii Nakryiko Link: https://lore.kernel.org/bpf/20210319192117.2310658-1-kpsingh@kernel.org Signed-off-by: Sasha Levin --- tools/lib/bpf/btf.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/btf.h index 57247240a20a..9cabc8b620e3 100644 --- a/tools/lib/bpf/btf.h +++ b/tools/lib/bpf/btf.h @@ -164,6 +164,7 @@ struct btf_dump_emit_type_decl_opts { int indent_level; /* strip all the const/volatile/restrict mods */ bool strip_mods; + size_t :0; }; #define btf_dump_emit_type_decl_opts__last_field strip_mods -- 2.30.2