Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp20845202rwd; Thu, 29 Jun 2023 07:43:20 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ62LTWGx/58UW/EHaeg6xMNQwUTp9Dm0kpUlj/CMhhBz0X7WdPirLUc1fI+3ma9pyW2pZMt X-Received: by 2002:a17:902:b497:b0:1b7:f73d:524 with SMTP id y23-20020a170902b49700b001b7f73d0524mr12224367plr.43.1688049799877; Thu, 29 Jun 2023 07:43:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688049799; cv=none; d=google.com; s=arc-20160816; b=lbFhq7OGj24upv7NwJmA8gb9bFzuA5OT7niNrCRn6U6QhUNazL3IIZMXd1u6eOCjjc AJQ5PWO1H6cIhpzMQKfN6kxgWgbr14tdAiHavTaHO9PyyAmz2g5QmyJqAtykpWs+kHf3 vCIvPiTceNpQk4fc/nEDHCTc9Y71cFJgVocYe2ItQvBUBKY4ZE5DQqbBV/Pd0AlFbSTb afSWFv4hyferRw0SSk2lUjGv6ct8EFN8e8I7WvCLpNWVd0bMxs86Bg8rqehjwUGwJv6s cCV6Fle3ndCxbpv//SSmCPjETldvR7uDf9OHIEOzLNL6J0ay8Ax49WCeH13HhhjcTPVc w7qA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=nt/lZipfISIHsuLxfevEY+jOYU3M96+2WX/kvTfP87Y=; fh=EDqS7TtxB6PJk72pIXdNdOPlMipSKwKNrKidhF+9NtQ=; b=gdFJpi4O5AWSuVR8m+vbdWht8ZLbVuG8W2PTJJK2EGYsoB4wWc/m2Adm5+7wqjLnDx mBMKVGnUAUio2I8PvkAXBPszOXcrgabBSBXEcG0q1nUlYyjmH5oV9j/68mJkgJFuVDZr SS7CF3DbqZVEwV46NkB5+bTPnPGnIHkPOHdVQClZFPEXGEBjT1O1KhZ128uyUF7OH0zB ekiprlamWJ8rrjCfTHiUXaazDZG3dim1Gwu1MtiRXOG8mHOY9+W9cdHCJFyIKL2X6LIw jin5oijCrjrS1ezOEsYGGwcXcjAffFju+wTuf2OInDvqCwlft5vwNF+xpkIgs4cvkJRN XEhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IeH88kCj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ix1-20020a170902f80100b001b7ea1efd5dsi9222339plb.319.2023.06.29.07.43.05; Thu, 29 Jun 2023 07:43:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IeH88kCj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231933AbjF2OS1 (ORCPT + 99 others); Thu, 29 Jun 2023 10:18:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229494AbjF2OSX (ORCPT ); Thu, 29 Jun 2023 10:18:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0B0E358A for ; Thu, 29 Jun 2023 07:18:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6D81E61558 for ; Thu, 29 Jun 2023 14:18:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9AF03C433C0; Thu, 29 Jun 2023 14:18:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688048301; bh=cBPe9u9KZDbd5csui0WGqBq35mFNRweRCSHEgHuupio=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=IeH88kCjF7clYHMc/gXG35iOIKXaXt9dNRMKWDcvWq67WplRlgpl5+mpSPrXG0Y3h MidfVBrgZF0qgjW7lZawaoy84q2UhhkOJdUBHIOy6wmF0B2V5r5gjM0PinG7Izkobw iI0eIMmSaSnV6fjQlCsyaP5e53WGy3xLwGr48SChdeyGZ4In/Km+WSogRkDshxiXKR qcPBnyPt8bZcYVPDQ4twWcltZSzY9+v9dw7l8fmpiPva05xAPu0upe4hUYneO3sq6z lSiFwuSXqsiX0u0cENpr09ZE2rKzauHxBU+M3JF7p2hUBzgA85Ll97Vmug0tSq14J7 KCi6khFiRocpw== Date: Thu, 29 Jun 2023 07:18:19 -0700 From: Josh Poimboeuf To: Michal Kubecek Cc: Peter Zijlstra , linux-kernel@vger.kernel.org Subject: Re: [PATCH] objtool: initialize all of struct elf Message-ID: <20230629141819.aopy23zi5wc6iqof@treble> References: <20230629102051.42E8360467@lion.mk-sys.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20230629102051.42E8360467@lion.mk-sys.cz> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 29, 2023 at 12:05:05PM +0200, Michal Kubecek wrote: > Function elf_open_read() only zero initializes the initial part of > allocated struct elf; num_relocs member was recently added outside the > zeroed part so that it was left uninitialized, resulting in build failures > on some systems. > > The partial initialization is a relic of times when struct elf had large > hash tables embedded. This is no longer the case so remove the trap and > initialize the whole structure instead. > > Fixes: eb0481bbc4ce ("objtool: Fix reloc_hash size") > Signed-off-by: Michal Kubecek > --- > tools/objtool/elf.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c > index d420b5d2e2b6..081befa4674b 100644 > --- a/tools/objtool/elf.c > +++ b/tools/objtool/elf.c > @@ -1005,7 +1005,7 @@ struct elf *elf_open_read(const char *name, int flags) > perror("malloc"); > return NULL; > } > - memset(elf, 0, offsetof(struct elf, sections)); > + memset(elf, 0, sizeof(*elf)); > > INIT_LIST_HEAD(&elf->sections); Thanks! Acked-by: Josh Poimboeuf -- Josh