Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp774331pxb; Tue, 5 Apr 2022 22:46:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjEpUl+uQXc/onOZSNkAhJtaSWydt0RoCa4FIP+s7aJ49wQoE/Xxei98M94+pq+uGSvbBA X-Received: by 2002:a17:902:6acc:b0:149:8f60:a526 with SMTP id i12-20020a1709026acc00b001498f60a526mr6999851plt.25.1649223999300; Tue, 05 Apr 2022 22:46:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649223999; cv=none; d=google.com; s=arc-20160816; b=xgm/BhsyMqWPr7hsQGtnCHlfb6YIGYBexiwlKERp8Po1sVyWwlaQvjvOmPJyvOEUHN 6zQy/RRKdh2Iaj2epwWQinZJqxLWSHEr55B2aXJ5PCVWPmRZxa9J6Qi+U0lMKbCehLap 3Zs7gqM36AbeRIIvho4j9l7VGI5YvFaDNOlJyApu8a5TyFLpRt93x2jJsSZkPhjGpkIl Cca/9evvzEwMTcw2XSyvu059x/TIwa2l0UScJ7kMckZ8QIBIJdDwB+XCXb9hGI6m3CaR MCDA36H47JRlSZvShMnIb4WULEu2Uxt6dWrXhHQTF/VcFReSYJQlGxmxpsugsqOU8gz+ afWA== 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=VQJMu1IN0802UG1yf1bYvzaXV+XdMWa1CQZrxkou5HY=; b=l/N05SJzH51Xg3nVEYS+uTJ4cozL9c6vvqjZj/SUbbYgMZDhj2pj5N4wR/AfgAoLu+ 7gC2PJ3DjE9u2a753plUJJwzOxyzKZay4irom/VaDZHGn3kUxxEo0Pi5Op7Q20M5FMZU NUF7W+T1C8SrkdmrS457muUl/So+FW4A2Linls0VkqEpn74PQZeuh3aBYMje1SOE/cUz kB3iZonGOi4EZPB+pgLPseiK+bdqJfZV69CBBdlXDg4ywVXFzUiF3+R/y+7YwOEXt8ME aOxN1O5w/9nRTLIKS7Bk2iJkIhl4PvNznB3njEyLCYWAF/bbfwEfVS0FvVCL1kK/xHAr JLbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NFAAaRgM; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id h34-20020a631222000000b003816043efd3si13871641pgl.456.2022.04.05.22.46.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 22:46:39 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NFAAaRgM; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8D5F4487C13; Tue, 5 Apr 2022 22:11:23 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376624AbiDEVZu (ORCPT + 99 others); Tue, 5 Apr 2022 17:25:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349240AbiDEJt2 (ORCPT ); Tue, 5 Apr 2022 05:49:28 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8577523151; Tue, 5 Apr 2022 02:43:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id E07D9CE1C6F; Tue, 5 Apr 2022 09:43:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C982C385A1; Tue, 5 Apr 2022 09:42:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649151780; bh=ZYk0CNHgZuiWpDdSQFnDnwESFchksbpwfapp1FW5hKk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NFAAaRgMWXr6lb9vtB9llqDMsghX1jaFFk0ZONzOy7mYxnukHMnRUAZ7PnHfVdNkR /EuohcJvkZvJU77Usg1SaWimYlwZ+5+dDbaOM+Pd+G3zq6dmPwZ0vo0RmjM5dbw6MU PjxuOH657s0WaXAoM7k/FKvBLwy7yb2AZt3DraC8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Borkmann , Hou Tao , Sasha Levin Subject: [PATCH 5.15 500/913] bpf, arm64: Feed byte-offset into bpf line info Date: Tue, 5 Apr 2022 09:26:02 +0200 Message-Id: <20220405070354.842042643@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 From: Hou Tao [ Upstream commit dda7596c109fc382876118627e29db7607cde35d ] insn_to_jit_off passed to bpf_prog_fill_jited_linfo() is calculated in instruction granularity instead of bytes granularity, but BPF line info requires byte offset. bpf_prog_fill_jited_linfo() will be the last user of ctx.offset before it is freed, so convert the offset into byte-offset before calling into bpf_prog_fill_jited_linfo() in order to fix the line info dump on arm64. Fixes: 37ab566c178d ("bpf: arm64: Enable arm64 jit to provide bpf_line_info") Suggested-by: Daniel Borkmann Signed-off-by: Hou Tao Signed-off-by: Daniel Borkmann Link: https://lore.kernel.org/bpf/20220226121906.5709-3-houtao1@huawei.com Signed-off-by: Sasha Levin --- arch/arm64/net/bpf_jit_comp.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c index d13d9e5085a7..b56e7bd96594 100644 --- a/arch/arm64/net/bpf_jit_comp.c +++ b/arch/arm64/net/bpf_jit_comp.c @@ -1126,6 +1126,11 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog) prog->jited_len = prog_size; if (!prog->is_func || extra_pass) { + int i; + + /* offset[prog->len] is the size of program */ + for (i = 0; i <= prog->len; i++) + ctx.offset[i] *= AARCH64_INSN_SIZE; bpf_prog_fill_jited_linfo(prog, ctx.offset + 1); out_off: kfree(ctx.offset); -- 2.34.1