From patchwork Mon Jul 8 09:52:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Tissoires X-Patchwork-Id: 13726371 X-Patchwork-Delegate: bpf@iogearbox.net Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A7FE041C69; Mon, 8 Jul 2024 09:53:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720432392; cv=none; b=lzTlIdl8oVh9Pe08L2BIklTVHiz/C9U7CvtcsjNYm3NhNqvIxnbvS8Gq2Nj+0pcYenr5RvKm1rkoG6HQpUYcg4VRmFjjFzzo3ro3Fd2ml609riBYUk5ec56ozkAtMjkdNj1/RJnTRgFG5F0A9/e64fEVY3QwBbMu9/gXrrvjdXA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720432392; c=relaxed/simple; bh=tmlkinceJ217REpu6WVDDhCLWZe8vaBSsNuNDlMyUz4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fFVRIIeL/Jo3kLTMl826zqrFdcTOtlzkvpQCUNRCVG9smdUJA+I1Z9vvMcbJccOMen6u+7Wv7o1c6KXcvCZvoUl8cGN2I5gA6ogiFROJGAB2T+CT1uq29zHaHpFEFGleeXob6+XEgoh5tIics6DUwBnC/1AX1V/jy4UYyw29uUg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RqvnYt0g; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="RqvnYt0g" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4244C4AF0B; Mon, 8 Jul 2024 09:53:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720432392; bh=tmlkinceJ217REpu6WVDDhCLWZe8vaBSsNuNDlMyUz4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=RqvnYt0gUOflVbMqsbjq/J1QSfkqhutdrFN+GxErg+PHVx0DNmB5X28Rw5q4aUWXW /QS3WACw8PW79vR02pMwxiPUIgkIKL/g0fHonzc5Kfl82TkO+LoNqM+D3PdSj7TJ0a e9xl5GQD+uTTOwxXID7FJvgDrwHAbW/GF/C1vSSsiaQSYS7lJcf13EgNcxbY9BFcRr RCcR1aTTsv5GdmSTKjAgBVdYHtwtD6Z1iSBVBzcXF49ROQy2E3fXL5fKFZ1v+G1zDE K+4zAAmB3WXKOx0zN1a000AFFFnrS+CMGmzzlpWE2dseuUhqmj1yiOMJn5tZ9uR9gg E2GbWGBGXZKIA== From: Benjamin Tissoires Date: Mon, 08 Jul 2024 11:52:57 +0200 Subject: [PATCH bpf-next v2 1/2] bpf: helpers: fix bpf_wq_set_callback_impl signature Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240708-fix-wq-v2-1-667e5c9fbd99@kernel.org> References: <20240708-fix-wq-v2-0-667e5c9fbd99@kernel.org> In-Reply-To: <20240708-fix-wq-v2-0-667e5c9fbd99@kernel.org> To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Mykola Lysenko , Shuah Khan Cc: bpf@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Benjamin Tissoires X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1720432384; l=1192; i=bentiss@kernel.org; s=20230215; h=from:subject:message-id; bh=tmlkinceJ217REpu6WVDDhCLWZe8vaBSsNuNDlMyUz4=; b=8EZU9HCeLG0gJfz3EK7kDGScbSgfQfmWRA40L/PAQO4G7Gx0gyUQ5m4FDoBDsDwXHiXseNti2 30iBuaJlZ5eCGIcezGJloMEqMRIFTGo6uQUaMDQbSE1Vhr25P3/Zoh+ X-Developer-Key: i=bentiss@kernel.org; a=ed25519; pk=7D1DyAVh6ajCkuUTudt/chMuXWIJHlv2qCsRkIizvFw= X-Patchwork-Delegate: bpf@iogearbox.net I realized this while having a map containing both a struct bpf_timer and a struct bpf_wq: the third argument provided to the bpf_wq callback is not the struct bpf_wq pointer itself, but the pointer to the value in the map. Which means that the users need to double cast the provided "value" as this is not a struct bpf_wq *. This is a change of API, but there doesn't seem to be much users of bpf_wq right now, so we should be able to go with this right now. Fixes: 81f1d7a583fa ("bpf: wq: add bpf_wq_set_callback_impl") Signed-off-by: Benjamin Tissoires --- kernel/bpf/helpers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c index 229396172026..5241ba671c5a 100644 --- a/kernel/bpf/helpers.c +++ b/kernel/bpf/helpers.c @@ -2734,7 +2734,7 @@ __bpf_kfunc int bpf_wq_start(struct bpf_wq *wq, unsigned int flags) } __bpf_kfunc int bpf_wq_set_callback_impl(struct bpf_wq *wq, - int (callback_fn)(void *map, int *key, struct bpf_wq *wq), + int (callback_fn)(void *map, int *key, void *value), unsigned int flags, void *aux__ign) {