Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp980204pxb; Wed, 6 Apr 2022 05:57:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwodUA43hVnSVUTZZH0EIbkzUI16QQYzo1xjLYTu0s935Ol4YVKzWLwKxEdLjOxTXpadH0b X-Received: by 2002:a17:90b:3003:b0:1c9:9751:cf9c with SMTP id hg3-20020a17090b300300b001c99751cf9cmr9799377pjb.20.1649249836230; Wed, 06 Apr 2022 05:57:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649249836; cv=none; d=google.com; s=arc-20160816; b=gBTqFd9MX3kLqLntfTV88ca+puPbPA7YxIQclDQCpf9SzSTBZ193BOY9anwFdb3L9g stIY90KbwZgP38gmubIvqHkcneMtxSht6Jr8u+3Waq6CccS4hmDi0hxoLN3Y0eBY5LJw Kuo4jnxEQ/SuMvPTYIlWu+ExZUZrflTsul7pSDjtXiSpI1JVob6Ra15YMQhh3CjdYKaZ rky/0wYzvn9vbbDZCxXgWYypar2kY9ApZwWVFfP0/8yEh88RuxR7XPwGrgov5vIMcGXP g0W5YPQdqrk3xItH8W9cIMWeyIuWpz/ieU57efp4GJJc8g8v7a52QPtrK6/TiUhaWhdi eiww== 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=GobBfcDbPRfn1bNTB+Da3RW44YDX4p3gbC7JVE5OzZ0=; b=yXHdWoxLgrCNme0zCVO59fehlY8gy0ugsZSIUFq1l/sFmjpqSvI5mAqs5xmvhZ7Vnr wBFzCj5PeoNN3PjdlroRyH6BvnoVm8VMh+j+WAlxuABKlcfFum0tpW5JY+Py0+9ahcnT I8Rb2wpbjbTX+1IFOJAXAZoIt+dxbsqeAsixMepgJycBfbHalZKmfTkLM4F0zjQ+R3jC HfFmqkMLTReZD12xRck7uvBgRGVdXANTjDDP3GOW6LUkL3kvEzHcx9DVg6YrOGeTaVG3 CatBvkTQzgQBsNr1B1ryzEag5xxrBzXie73a2NoAC2VXWfujI6fTVhnoi7hWlIvOxmdA Lcmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vi8gsU3E; 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 p7-20020a170902e74700b00153b2d1651asi182940plf.290.2022.04.06.05.57.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 05:57:16 -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=vi8gsU3E; 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 out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4EBCA4406AE; Wed, 6 Apr 2022 03:06:37 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347503AbiDEVaa (ORCPT + 99 others); Tue, 5 Apr 2022 17:30:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349229AbiDEJt2 (ORCPT ); Tue, 5 Apr 2022 05:49:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3F8722BD6; Tue, 5 Apr 2022 02:42:58 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 5127961576; Tue, 5 Apr 2022 09:42:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62D30C385A1; Tue, 5 Apr 2022 09:42:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649151777; bh=cQGKMLWxdF5P/yDNlUth6Ig7C50k5+SASMNoZMLOBF8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vi8gsU3Ek0XLTw5EQSeCSr+KD6n4J8FpdvNPOpUA0vdMLX4hD+8DO3VgE69Mz+n2e 1iWKwaThaS15RLNytYmaUrcbAy2IKKfm1vBY/OCd945TYohOGYaQPWlCLt8GBG00Rt 1WjNOj2EGQnXTjW7LvhzUu/m4XmN3Ar36DxSlYJY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hou Tao , Daniel Borkmann , Sasha Levin Subject: [PATCH 5.15 499/913] bpf, arm64: Call build_prologue() first in first JIT pass Date: Tue, 5 Apr 2022 09:26:01 +0200 Message-Id: <20220405070354.812793604@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 68e4f238b0e9d3670a1612ad900a6e98b2b3f7dd ] BPF line info needs ctx->offset to be the instruction offset in the whole JITed image instead of the body itself, so also call build_prologue() first in first JIT pass. Fixes: 37ab566c178d ("bpf: arm64: Enable arm64 jit to provide bpf_line_info") Signed-off-by: Hou Tao Signed-off-by: Daniel Borkmann Link: https://lore.kernel.org/bpf/20220226121906.5709-2-houtao1@huawei.com Signed-off-by: Sasha Levin --- arch/arm64/net/bpf_jit_comp.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c index 465c44d0c72f..d13d9e5085a7 100644 --- a/arch/arm64/net/bpf_jit_comp.c +++ b/arch/arm64/net/bpf_jit_comp.c @@ -1042,15 +1042,18 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog) goto out_off; } - /* 1. Initial fake pass to compute ctx->idx. */ - - /* Fake pass to fill in ctx->offset. */ - if (build_body(&ctx, extra_pass)) { + /* + * 1. Initial fake pass to compute ctx->idx and ctx->offset. + * + * BPF line info needs ctx->offset[i] to be the offset of + * instruction[i] in jited image, so build prologue first. + */ + if (build_prologue(&ctx, was_classic)) { prog = orig_prog; goto out_off; } - if (build_prologue(&ctx, was_classic)) { + if (build_body(&ctx, extra_pass)) { prog = orig_prog; goto out_off; } -- 2.34.1