Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp5963756rwb; Tue, 1 Aug 2023 10:12:16 -0700 (PDT) X-Google-Smtp-Source: APBJJlEnhl3iT4F5LFGzwYourUeshoj0v3lpuqc8FwpF3n547BLBr1I8bOXd0mRbC9qaPvSIKjvr X-Received: by 2002:a05:6a20:419:b0:134:198b:84e9 with SMTP id a25-20020a056a20041900b00134198b84e9mr10656236pza.61.1690909936244; Tue, 01 Aug 2023 10:12:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690909936; cv=none; d=google.com; s=arc-20160816; b=cBGNdg8V61a/XOzbuRAlfYZ3UZgl9wrdb22Da0M25ADK1s2jlBJWGCptoIdyg/qclS q16YlyToKkCQcUwcWBBIvCFDGy6cHbGDy3dMezfFHixJYPoH9gHICIQjDBLJeWElXbZs j7Epyi6p0TMbQiuMuIUYxRg/j0nUGbyh+YY2WPkPsmruqBoqey/hUXfubW4QrV5uWu6/ TBxjTy2bT9uUt6Ic2DGIr9LZPp5/OuBCg7mYMB4uzSvntNFZ66pMLPc/94ZTrsOKA4z3 WCQg+y1Xzl99VvEPJUtpg/mJTFcMwe+TKICTgXRqJpuNX4k0NT4a+RUVsSP93XruJpb1 4lzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:reply-to:mime-version :date:dkim-signature:message-id; bh=V4lu9rl80wnpynbxYMmCvM9Rbb29PtC/a1L2v3oqVO0=; fh=Khgsj2Xj78jT4/ncjizAwO4cpAi3AyAuH2Hwt2jveGE=; b=xIH/vn2TM6OpTxUHjeAQ0bBjA9PmuVEFTRjFctuQqVx0jgCJvhn94hjuL9bzwgXGpq tBAeXLbKfo3mNpKf5RXPyi8nCvx4U2lZqGokewI+/Pey01J8LJLOoQeh3LAWliXKGhBa 8qr0mSzCHOdR9UB8tSUj+KQS5bfJh9HpZKsmEHMKo2hEScfVygqrDEMMM4f6cd6qXV1m EitGdSoBU+GiisbuAg2E+GQNzKgbc4ZMMIWPbyNrVo7cYd7guS3M24JOF+GHMejjOFW0 ecxRN3XIgpraWMxLkIsP76KcA6xi4S48n8QguPAOliwROr849Ozam5M1oxWZfLTIV7vm PLEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=qVaXNcLl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j71-20020a63804a000000b0055beccef366si2287577pgd.727.2023.08.01.10.12.01; Tue, 01 Aug 2023 10:12:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=qVaXNcLl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233807AbjHAOli (ORCPT + 99 others); Tue, 1 Aug 2023 10:41:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233684AbjHAOlh (ORCPT ); Tue, 1 Aug 2023 10:41:37 -0400 Received: from out-94.mta0.migadu.com (out-94.mta0.migadu.com [91.218.175.94]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 921C01702 for ; Tue, 1 Aug 2023 07:41:36 -0700 (PDT) Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1690900894; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=V4lu9rl80wnpynbxYMmCvM9Rbb29PtC/a1L2v3oqVO0=; b=qVaXNcLloEZwQ2po8bFkXfXrg349uHQUgN8d/XBrekpVlt+0SSC30kHjxtrIdeMT1gDnTR CkVGzp5+BONOjUUfdt7ukfJMwMQ35o+ByfUy8Mhv0SsUFyiBPNK7tP+0UdeW2t38BnZefB 8Gck6qbJnSiJKaq139e4ecgImIX7OUo= Date: Tue, 1 Aug 2023 07:41:26 -0700 MIME-Version: 1.0 Reply-To: yonghong.song@linux.dev Subject: Re: [PATCH] [v5] bpf: fix bpf_probe_read_kernel prototype mismatch Content-Language: en-US To: Arnd Bergmann , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Song Liu , Steven Rostedt , Masami Hiramatsu Cc: Arnd Bergmann , stable@vger.kernel.org, John Fastabend , Martin KaFai Lau , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Kumar Kartikeya Dwivedi , Dave Marchevsky , David Vernet , Peter Zijlstra , bpf@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org References: <20230801111449.185301-1-arnd@kernel.org> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Yonghong Song In-Reply-To: <20230801111449.185301-1-arnd@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable 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 8/1/23 4:13 AM, Arnd Bergmann wrote: > From: Arnd Bergmann > > bpf_probe_read_kernel() has a __weak definition in core.c and another > definition with an incompatible prototype in kernel/trace/bpf_trace.c, > when CONFIG_BPF_EVENTS is enabled. > > Since the two are incompatible, there cannot be a shared declaration in > a header file, but the lack of a prototype causes a W=1 warning: > > kernel/bpf/core.c:1638:12: error: no previous prototype for 'bpf_probe_read_kernel' [-Werror=missing-prototypes] > > On 32-bit architectures, the local prototype > > u64 __weak bpf_probe_read_kernel(void *dst, u32 size, const void *unsafe_ptr) > > passes arguments in other registers as the one in bpf_trace.c > > BPF_CALL_3(bpf_probe_read_kernel, void *, dst, u32, size, > const void *, unsafe_ptr) > > which uses 64-bit arguments in pairs of registers. > > As both versions of the function are fairly simple and only really > differ in one line, just move them into a header file as an inline > function that does not add any overhead for the bpf_trace.c callers > and actually avoids a function call for the other one. > > Cc: stable@vger.kernel.org > Link: https://lore.kernel.org/all/ac25cb0f-b804-1649-3afb-1dc6138c2716@iogearbox.net/ > Signed-off-by: Arnd Bergmann Acked-by: Yonghong Song