Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3513069pxb; Mon, 4 Apr 2022 19:25:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5a9lPeFg1nOC6FdrqmXsGgvyr+ZY85PFqD1AIAx1yZ51cCS+Wct/9bBQrNRPwpROGIXhf X-Received: by 2002:a63:fb57:0:b0:381:c29a:d966 with SMTP id w23-20020a63fb57000000b00381c29ad966mr979105pgj.358.1649125532822; Mon, 04 Apr 2022 19:25:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649125532; cv=none; d=google.com; s=arc-20160816; b=j7TIFOjO//wxVHE7ZmAzkaFQSivi26dEWmqivj1CRbWvD492Q+XBobG4wkCbEo0QPP /bFW0jLXwZ6f98LO2ONi1Ts7w/srQ0kGcv7cylzLtdtPrZ5krig4KCMpxjmi4/CLOFBb 8S3nperalHKGIDkBoXYUUyyWnBbl1edFwvWDJBysvuMAW6+LDIpdi72aLBAhUocxJExM Y4Q2pfP4+gtZACWANxJ4VDr/rO1ne0QOGrVZQOTGmf/5khQIlCinGXzoUdkILFDaTTQy pMd0R2qwvDAbtwIfRREMvn+F6DWI8vd0jnDMk8EkEVTqshKVx84G7137FhQ1Wn7T9AFW +q3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=a3HAUNAOGJbuMUJGWk34muWFcGqX/DzMj8VavXq90tI=; b=eqf6pRlHBa8dDEcC0hGFa4sjUzRJrjhr+zcXv2qezdxtDfkpCxfteY7vPuQp6d2fly ogeMIpVo+MEu6tkMZ3AoOuLgNGaEEV55XgesozVBALFhbSx5DV1YLkHplr6bUX/jIM+C iCw6kQ88ch/qBlkqCI42EhjY/R8pxj05bb/Se+4L/PDIsBOnW1TV/Iho6E75ABOQS4e4 n4JWS3gL8Xnx7X0WoV1a90QvJmFhAKSCB5TBWeG295Bn4uT7XIXVoaoSO3ne035MOGwW Hb3Yy8rLl8zxDaSXWTcGH81TEWUIqseJB4eHhV36U1lsUZKnFHGdvkjViV09jozt1oLg 0WXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=L0nJ6s2B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id i10-20020a170902cf0a00b00153b2d16591si10352404plg.409.2022.04.04.19.25.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 19:25:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=L0nJ6s2B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 628933D5C79; Mon, 4 Apr 2022 17:47:46 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376630AbiDCXM1 (ORCPT + 99 others); Sun, 3 Apr 2022 19:12:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357532AbiDCXMY (ORCPT ); Sun, 3 Apr 2022 19:12:24 -0400 Received: from mail-il1-x12a.google.com (mail-il1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AAB32BB36; Sun, 3 Apr 2022 16:10:30 -0700 (PDT) Received: by mail-il1-x12a.google.com with SMTP id x9so5703989ilc.3; Sun, 03 Apr 2022 16:10:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=a3HAUNAOGJbuMUJGWk34muWFcGqX/DzMj8VavXq90tI=; b=L0nJ6s2BVwW8B84xCcYvOJ2ZJSnAjg214/lRxP7iEMPY6jzsGy4TEwH4F6a5nbPoCx ldZRFFBKJ/QxS0bsNI3VGsT47JNE+azq/SXHjTWhE0SYF0FGD4XywW4HLW2nBHFpEVOw l7zvZ0Q+bGKKcyCUE1Dki8jzzPfmdQ2IErLH1weOl+tF/LTgjZMsdyx5Cfw3UiP+SFkX CRlfrTF+rxkYiqf+5DxY2b+eCd7i6TZwHADu/mfuO0ZxOGZfE8lr0RKXjCnvGZ4zVVuw Usd3L8Uuo9WfhZvA9K7O/aFQb0ziOyU8293JEbtUJwddmhv0mU1ud9KCQN3o/c79xjc7 yTog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=a3HAUNAOGJbuMUJGWk34muWFcGqX/DzMj8VavXq90tI=; b=0rNhpdgkHDcukDTf5m7co6BgqRvDtzOn4rUSmRtyc0CnfWZeVo+LUx36EicG4uvLUZ d2urF4X7HByd4KbhaU/Tu7F5zY12yY086uD+V0TIYcF27kZiS40hcyLSfIiDkc3wvvtn dlCkQGkttwSn7BYmPX3SfGqJmL9GDDmEtmjHWoExRfR5VnLJeKlxYQT7om0fkQK7iWVu qinPAusYCAsDfrXkRfodgPMp2SMpLL1G9oUlNOxWLeJ4fKFc5DX1enjkbdDoXq8eWHDj AJhUQ5ohpmuwEl+9CtgIjrC4fflCd5gxmZvdl4ABr8L5tmANL9y08xRfq0icQBbJvuXV JuBQ== X-Gm-Message-State: AOAM532uuxNtE9qrOoHQ/Bk+fvFjAadZH8mD4gc3jjIjsEbQxmc2ZJd9 tN3oCqeoAiR15nfXxyEA089BTRhaJc9cHx/JpsU= X-Received: by 2002:a92:6406:0:b0:2bb:f1de:e13e with SMTP id y6-20020a926406000000b002bbf1dee13emr4162168ilb.305.1649027429127; Sun, 03 Apr 2022 16:10:29 -0700 (PDT) MIME-Version: 1.0 References: <20220316145213.868746-1-ytcoode@gmail.com> In-Reply-To: <20220316145213.868746-1-ytcoode@gmail.com> From: Andrii Nakryiko Date: Sun, 3 Apr 2022 16:10:18 -0700 Message-ID: Subject: Re: [PATCH bpf-next v2] libbpf: Don't return -EINVAL if hdr_len < offsetofend(core_relo_len) To: Yuntao Wang Cc: Andrii Nakryiko , Alexei Starovoitov , bpf , Daniel Borkmann , john fastabend , Martin Lau , KP Singh , open list , Networking , Song Liu , Yonghong Song , =?UTF-8?B?VG9rZSBIw7hpbGFuZC1Kw7hyZ2Vuc2Vu?= Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Wed, Mar 16, 2022 at 7:52 AM Yuntao Wang wrote: > > Since core relos is an optional part of the .BTF.ext ELF section, we should > skip parsing it instead of returning -EINVAL if header size is less than > offsetofend(struct btf_ext_header, core_relo_len). > > Fixes: e9fc3ce99b34 ("libbpf: Streamline error reporting for high-level APIs") > Signed-off-by: Yuntao Wang > --- > v1 -> v2: skip core relos if hdr_len < offsetofend(core_relo_len) > Seems like this never made it to Patchworks. Can you please trim down the CC list and resubmit? > tools/lib/bpf/btf.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c > index 1383e26c5d1f..9b7196b21498 100644 > --- a/tools/lib/bpf/btf.c > +++ b/tools/lib/bpf/btf.c > @@ -2826,10 +2826,8 @@ struct btf_ext *btf_ext__new(const __u8 *data, __u32 size) > if (err) > goto done; > > - if (btf_ext->hdr->hdr_len < offsetofend(struct btf_ext_header, core_relo_len)) { > - err = -EINVAL; > - goto done; > - } > + if (btf_ext->hdr->hdr_len < offsetofend(struct btf_ext_header, core_relo_len)) > + goto done; // skip core relos parsing don't use C++-style comments, only /* */ > > err = btf_ext_setup_core_relos(btf_ext); > if (err) > -- > 2.35.1 >