Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2626680rdb; Fri, 8 Dec 2023 14:01:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IHeAM1wYE+pnJZOaPTs4EIZA5/tOoyS2PWRUjtDDisiXsS7szoDwEmR2LJvkOC9F9sjz+8H X-Received: by 2002:a05:6a00:1382:b0:6ce:2731:a083 with SMTP id t2-20020a056a00138200b006ce2731a083mr905796pfg.50.1702072868613; Fri, 08 Dec 2023 14:01:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702072868; cv=none; d=google.com; s=arc-20160816; b=JpAIV0J44n/shXVkSViUSBzuCoGTLZNh2cvnYwVIAQ5k41B8E+4mXdMIz8mXJa5HgW wFaMBG0wEBDU4UymfdhUN16b4DS/pQEaovm/xxyoCnBd/rkhguN+bwtmHIyRrZidK4pp M2ryt5pfCF3BsaZwcNt2q0NZRWFwDf2dEFkDpzPDKqCCOm81GOHup/3pxiU+DQt+QQLT 1y98SLxBe9b6C561jmAJTMxbM6T5G3EgdYFvGRf7bd/BQx+ZAuhytiV2p6jFFbnFZUGF B2knFYLGSZU4lcKFSRBP4A1+chAVyHUK1n6aet6aA3l/fre6Yvi7HEz7XjbQrSTiWSWe Sqrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:autocrypt:references:in-reply-to:date:cc :to:from:subject:message-id:dkim-signature; bh=YMLpYnfVM9iEfLiGUcdGRUL+oUiUpU3M2wg2/3ArWGU=; fh=Yu+dOg3n3sy1x/Yqj4Olcf/Wa8hBAeIezFZIB2Gits8=; b=ZPdhT1CLwUEc3UWeQIX3xvev6nH6XTVqqf5ql5uZyYeCPPMqz2XH3pMtY4ptoJT+Bk F1CXd5qlJFB/0X3KvRU3Ua/DsxVlwn4YsaLo8/HWW3mV+h2qQMiemmNsjLXpBLyLViGm YN2SIqn2BVF5mytD3F8a/9zFyzcsWb5THBKG193VN74SNpa8uKfSB8H8Exe+3/eYLV9w cB/Skidpld0zP/5Zm/uu+pKbNCSDWW6ptSPjCyhfUgJXcMiEhpY+q0Wajj9NVx4wmXZS CLUeKqXOKQ0II61CMZZysMCwYKRSfIgIM19UIHw2w+luVVun4iW1lTj5NNYrM5582tW/ Jmgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=jpJDJgL2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id c24-20020a630d18000000b005bd68976351si2194372pgl.55.2023.12.08.14.01.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 14:01:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=jpJDJgL2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 94C6A803549C; Fri, 8 Dec 2023 14:00:47 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1574813AbjLHWAb (ORCPT + 99 others); Fri, 8 Dec 2023 17:00:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235943AbjLHWAa (ORCPT ); Fri, 8 Dec 2023 17:00:30 -0500 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 472371716; Fri, 8 Dec 2023 14:00:36 -0800 (PST) Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-332fd81fc8dso2409570f8f.3; Fri, 08 Dec 2023 14:00:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702072835; x=1702677635; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:autocrypt :references:in-reply-to:date:cc:to:from:subject:message-id:from:to :cc:subject:date:message-id:reply-to; bh=YMLpYnfVM9iEfLiGUcdGRUL+oUiUpU3M2wg2/3ArWGU=; b=jpJDJgL2I3xGR5RTIUWOUTtHwj4J/5JHqP3NUCT8fn1iXw451Da3id8428VXsge2ch l60+sG5iMOonMl2NTKZ8UW0gH+NWY1LFGPK4JVniYnbos20Ye4LtnKkiwCbIQHYx0jhT FrANCq8uPjblXrixNF57CnrMVbpNHojXQR3ijHgwYARJmcx8RXl1sJEQUTOA9QlsvjFZ A1ugAzcmfueGGExQGCZnqRXVxohOJu5nBxAXw5MdIY7S6MadVdVfAwP9ixHGeKOXNveC ftadUH03Hb7qNEUx120wcSwbqsxE62p/kS7g5vEH44Xb1QGMyXOTWJ8U+uChL9LDmGC6 AHIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702072835; x=1702677635; h=mime-version:user-agent:content-transfer-encoding:autocrypt :references:in-reply-to:date:cc:to:from:subject:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=YMLpYnfVM9iEfLiGUcdGRUL+oUiUpU3M2wg2/3ArWGU=; b=SjAoFJbNYUEIBmAzPxAHs8bfvE1ispH9JgYoHQz0+eLeftDsMrBtrXtY6gUKIUW+tr QCc50qYSEBOdLfo9FDLHG3KVxL1KNfkz3ulKfBTuYXZKAsuXF+9tbSl99y0c3jzRh6/1 6+sGVAFq5ck8GiHYs9eL7BlUXNRWjHjC8P5JttFsqCnIXlF1bwsW7KMBs0RNMxpfDeYW GEaQ9HdQXlYhVrnEracsa0DAoeJXmfWaVUqGYd3PouLlzpNygDcT2ufkImezNUowxSr7 5mn6FgxIeitLW6RpqZ5p/R1n979X0OFDwi/3D2+AvaKkHb6swHj0dNTuZ7URu8wep/jw 7pQQ== X-Gm-Message-State: AOJu0YzEA557opD8q3J5O0E9YgUxlUxOGhd9+fy3d4rmGzVhEHw8rZmv L4W5HwJVraH45wgWsJ2Q2yqbEG3eJYb/1w== X-Received: by 2002:adf:cf05:0:b0:333:2fd2:68b8 with SMTP id o5-20020adfcf05000000b003332fd268b8mr375478wrj.75.1702072834234; Fri, 08 Dec 2023 14:00:34 -0800 (PST) Received: from [192.168.1.95] (host-176-36-0-241.b024.la.net.ua. [176.36.0.241]) by smtp.gmail.com with ESMTPSA id k18-20020a5d5192000000b0033339027c89sm2823380wrv.108.2023.12.08.14.00.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 14:00:33 -0800 (PST) Message-ID: Subject: Re: [PATCH v2] libbpf: add pr_warn() for EINVAL cases in linker_sanity_check_elf From: Eduard Zingerman To: Sergei Trofimovich , bpf@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa Date: Sat, 09 Dec 2023 00:00:32 +0200 In-Reply-To: <20231208215100.435876-1-slyich@gmail.com> References: <159e94e7ce82e9432bd2bba0141c8feab0a9a2e6.camel@gmail.com> <20231208215100.435876-1-slyich@gmail.com> Autocryp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MU/mAW/CFNSIxV397zm749ZNLA0L2dMy1AKuOqH+/B+/ImBfJMDjmdyJQ8WU/OFRuGLdqOd2oZrA1iuPIa+yUYyZkaZfz/emQwpIL1+Q4p1R/OplA4yc301AqruXXUcVDbEB+joHW3hy5FwK5t5OwTKatrSJBkydSF9zdXy98fYzGniRyRA65P0Ix/8J3BYB4edY2/w0Ip/mdYsYQljBY0A== Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.1 MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 08 Dec 2023 14:00:47 -0800 (PST) On Fri, 2023-12-08 at 21:51 +0000, Sergei Trofimovich wrote: > Before the change on `i686-linux` `systemd` build failed as: >=20 > $ bpftool gen object src/core/bpf/socket_bind/socket-bind.bpf.o src/c= ore/bpf/socket_bind/socket-bind.bpf.unstripped.o > Error: failed to link 'src/core/bpf/socket_bind/socket-bind.bpf.unstr= ipped.o': Invalid argument (22) >=20 > After the change it fails as: >=20 > $ bpftool gen object src/core/bpf/socket_bind/socket-bind.bpf.o src/c= ore/bpf/socket_bind/socket-bind.bpf.unstripped.o > libbpf: ELF section #9 has inconsistent alignment addr=3D8 !=3D d=3D4= in src/core/bpf/socket_bind/socket-bind.bpf.unstripped.o > Error: failed to link 'src/core/bpf/socket_bind/socket-bind.bpf.unstr= ipped.o': Invalid argument (22) >=20 > Now it's slightly easier to figure out what is wrong with an ELF file. >=20 > CC: Alexei Starovoitov > CC: Daniel Borkmann > CC: Andrii Nakryiko > CC: Martin KaFai Lau > CC: Song Liu > CC: Yonghong Song > CC: John Fastabend > CC: KP Singh > CC: Stanislav Fomichev > CC: Hao Luo > CC: Jiri Olsa > CC: Eduard Zingerman > CC: bpf@vger.kernel.org > Signed-off-by: Sergei Trofimovich > --- > tools/lib/bpf/linker.c | 24 ++++++++++++++++++++---- > 1 file changed, 20 insertions(+), 4 deletions(-) > Change since v1: > Following Eduard's suggestion added one extra pr_warn() call around > section alignment and added compared values into warning messages. Thank you for doing adjustments. (Note: when I apply this patch locally full CC block is a part of the commit message, this is usually omitted from commit messages). Acked-by: Eduard Zingerman