From patchwork Fri Jul 5 13:44:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Tissoires X-Patchwork-Id: 811036 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 B8D6414D2B8; Fri, 5 Jul 2024 13:45:07 +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=1720187107; cv=none; b=Q9sphdWOmTt4AxlKdTZWwX7ZP8hVrZFwJSs5uHvW8DWpSHptNFnN7isf1Sjm0K9ynPjCw3vc6yQeqeqYw32X9aiySOYhruAy4sln8GRcoc/ahOGBoxLJbQU6m8RAzb0x11019SIAdJ0OwaKzLfjKRuuBSgis8areGH566h/r7IA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720187107; c=relaxed/simple; bh=tmlkinceJ217REpu6WVDDhCLWZe8vaBSsNuNDlMyUz4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pNV7p1tBfmRuxMVY2+CzGhQvKJmNdrH1De0vGLptA34ObuMRM/0sIuh23A/wpF54cBszDo5jk7y8Xk+uRINcqGENH3SrJdSQUhtaq0fYD+o2hhKfYFbDTpmAg1PAnDFlQm4u020HMArK6C8VutkwMxfpjerXMl1NpjCZSRaAT2g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=A+jHveHw; 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="A+jHveHw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB69BC4AF11; Fri, 5 Jul 2024 13:45:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720187107; bh=tmlkinceJ217REpu6WVDDhCLWZe8vaBSsNuNDlMyUz4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=A+jHveHwkXY+CiXSr4nEQhDxyZYfXNRYPawIeh3hWq68kBtjRuqgygRzYMfiKB38C zhkkU+XFnw+mQ5HZi+Yh5kFy+7FBgRAdXVbG0DrxbqMOIcKyZ6KOCpoGjdB463+Jrd ouT02icDl36H8wQ8zicD92bGHPP6d1hZgUex5PGQg3E9go3OfftqoXc5qUopMSP9Xd sm7g7n9gDwqjefm2VK+WATzhjt3JIqkbMhBGjF+uF0cHHDWysHIEcjEdD8QX3JulgX /HNYgdTX2I8LXGhEeTk5z7Zy+n/FBGjkfRqquwYuWDHimpdW9NHdeOVhye4CqJNIyt vl/rwRptXPo1A== From: Benjamin Tissoires Date: Fri, 05 Jul 2024 15:44:52 +0200 Subject: [PATCH bpf-next 1/2] bpf: helpers: fix bpf_wq_set_callback_impl signature Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240705-fix-wq-v1-1-91b4d82cd825@kernel.org> References: <20240705-fix-wq-v1-0-91b4d82cd825@kernel.org> In-Reply-To: <20240705-fix-wq-v1-0-91b4d82cd825@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=1720187099; l=1192; i=bentiss@kernel.org; s=20230215; h=from:subject:message-id; bh=tmlkinceJ217REpu6WVDDhCLWZe8vaBSsNuNDlMyUz4=; b=aEuQ8LRz2zkWCf81XAaAcE6Oew8VwVkkUrZWdIV+xJPTbKhBDIUR1z7v4elK0NSLvh++p3qs/ Knb29Frb3ofCcatLJCO/LQfjhot+L+/Aqx0adjheU74FDsYUKRcKalM X-Developer-Key: i=bentiss@kernel.org; a=ed25519; pk=7D1DyAVh6ajCkuUTudt/chMuXWIJHlv2qCsRkIizvFw= 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) {