From patchwork Sun Jan 30 09:29:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hou Tao X-Patchwork-Id: 12729773 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 63971C433F5 for ; Sun, 30 Jan 2022 09:31:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WGb96aHqenGfP9C62GQGPfunMm7YAosRN14AhoRa4qc=; b=hXInxJAdMj6WK/ QBvABBq6WBuOi0jQMLAYiL/OczR6z9Q/lmQa5Pd3G5zXOoRmQrFdRBW378F3DeKMdAqFbdl/FvE8F LUj69xirdBHiUUWc8j6GEqKzF8hZi02NRqV5LdIsJSmORsOPFqVvM61k58Bo0tcNKtLL497lnyYpr QBdo+UQ9randxc8sSZhuJ5vPFCiGgcIOIlNy8FultCbg4LnJebm+RT+lMpAnz/7YoYxPTQDkc9YMH u0wOpVN01K7SbTrK9w0dcNv5j8ASZW53LAAr/8nQRP5zs7AoGWpBrkUeOKl0O9FhgQTpQ1TFBQdQ5 j3fHuDz2WxocbTuNwuSg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nE6XF-006F0k-6G; Sun, 30 Jan 2022 09:30:13 +0000 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nE6X4-006EyQ-B1 for linux-arm-kernel@lists.infradead.org; Sun, 30 Jan 2022 09:30:03 +0000 Received: by mail-pj1-x102d.google.com with SMTP id h20-20020a17090adb9400b001b518bf99ffso15216693pjv.1 for ; Sun, 30 Jan 2022 01:30:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hwhiK/i0m2gMPbUVcACp59cbViDIBKcuhYUz1Evs1T8=; b=SuD27Uwt0VDKSTE/hpK3UZuAUqFXHAvhFsvcLUhQRKTsYPHnRI0c6V0HyqeD2GB4Lt 3131mhQojJSEJ1QRUJCStJrmlGncfYqKyz6x8w5sG/+oPwXivgY5zT1bqATqP2FSaNqN EWXwhewG8LIWvVScBum9ffoC8MxRNFsC2RFTo+QmK9teDyZH1dJ7jHnFGoSOSQj6zqpQ sqwmvXtZu9JYtOpnAPk2H3T9IA0AZv/QW10jukl1ISXqEaZsHLsGzWLKhs9M4lDF3s8m 1y6rk0ngTzfYApmqjGiTgdZRSdwVSQEuZJ5i2IMaK5yx+OL9Pg/l4Y979H4ci84g2379 kinA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hwhiK/i0m2gMPbUVcACp59cbViDIBKcuhYUz1Evs1T8=; b=taoqssLL6qEVrzCH4Cu4cqFs1AH8U8XE5IYKIFulJ92LFEsp+UV4VPHZQgAbI8N4hK atuewayCol9qRdvU81AlIBLu0P6WzeahbKCIKwE6gQUvAPXYbpFBg0zlW7CPskacYnLw Y/k/XkGi9X6VurKxD9D3XwJQ0wWFSl8m8phbbFUcMzzGMeToUswOKIht5ITDEC5I7VcQ 3n7PpNI1PIuTbyVac/Q0dWi5oDlmSTIgyHC6J2YgI0HtpU+LZYPnuh1BACGi1+SCh5ep TMsO8A8ebBZoPCvDCUkat8EZY22I3mMZEWiitKV8HrhKOiXq4uQ/X7HZy9WQHE0lEGV2 NecA== X-Gm-Message-State: AOAM531sLXZMJUOqUn70KlSchjmHgfieymZpE7KsK/2QYPvfQ2CSS9kU SkdlT9J9TTxgdwmefqfLT1I= X-Google-Smtp-Source: ABdhPJxiXht9rQ0HJ5RMTZeHOXNaz82mVp0MXPm3OIsOJ7xyLtnXTTg6KUALVdRw3mTcR2Z9AEXxrQ== X-Received: by 2002:a17:903:2290:: with SMTP id b16mr16037097plh.103.1643535001397; Sun, 30 Jan 2022 01:30:01 -0800 (PST) Received: from localhost (61-223-193-169.dynamic-ip.hinet.net. [61.223.193.169]) by smtp.gmail.com with ESMTPSA id e28sm1159654pgm.23.2022.01.30.01.30.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jan 2022 01:30:00 -0800 (PST) From: Hou Tao To: Daniel Borkmann Cc: Alexei Starovoitov , Martin KaFai Lau , Yonghong Song , Andrii Nakryiko , "David S . Miller" , Jakub Kicinski , John Fastabend , netdev@vger.kernel.org, bpf@vger.kernel.org, houtao1@huawei.com, Zi Shen Lim , Catalin Marinas , Will Deacon , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Subject: [PATCH bpf-next v3 1/3] bpf, arm64: enable kfunc call Date: Sun, 30 Jan 2022 17:29:15 +0800 Message-Id: <20220130092917.14544-2-hotforest@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220130092917.14544-1-hotforest@gmail.com> References: <20220130092917.14544-1-hotforest@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220130_013002_456056_C136D56B X-CRM114-Status: UNSURE ( 9.91 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Hou Tao Since commit b2eed9b58811 ("arm64/kernel: kaslr: reduce module randomization range to 2 GB"), for arm64 whether KASLR is enabled or not, the module is placed within 2GB of the kernel region, so s32 in bpf_kfunc_desc is sufficient to represente the offset of module function relative to __bpf_call_base. The only thing needed is to override bpf_jit_supports_kfunc_call(). Signed-off-by: Hou Tao --- 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 e96d4d87291f..74f9a9b6a053 100644 --- a/arch/arm64/net/bpf_jit_comp.c +++ b/arch/arm64/net/bpf_jit_comp.c @@ -1143,6 +1143,11 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog) return prog; } +bool bpf_jit_supports_kfunc_call(void) +{ + return true; +} + u64 bpf_jit_alloc_exec_limit(void) { return VMALLOC_END - VMALLOC_START;