From patchwork Wed Feb 21 16:25:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Tissoires X-Patchwork-Id: 13565931 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 1D7F181731; Wed, 21 Feb 2024 16:25:28 +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=1708532729; cv=none; b=kXNjRZV9UnFldf5vEVqUg5mxZHww7si2xBv0qub3WW2W37TzCpxZA4M5aZCYsUJ7Ic9LPEjk0chheEm0i+GJ0N0iraPiVpIS//Gch55iZeK7kHTjWYqp2Lm+WAg/9MJ7HIQX+TREbU4Kd6tcS7pMSB4iSb64yLzsQIzn+ehLyCw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708532729; c=relaxed/simple; bh=R3G29V1nYqPfReSpGBjXHcB6eUKOdQPJgoZsK67W94g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gMG3r/gfXoh1Wb/j555WRckKzEguhTU4NpKkhdIO3JVDIAciF586RYDbZKrUn9CxqvRCREr7l+MKFiOmpQ9nEWUhF7mUO94E6Jb/UzgZBy3KUvu6sQxyCCyZCcK35ZIxQfexT6tmcFe0rsVVe3P4sg8LpaK0gP6haQk8Ie41AiU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nYcRtqq0; 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="nYcRtqq0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7080CC433B2; Wed, 21 Feb 2024 16:25:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708532728; bh=R3G29V1nYqPfReSpGBjXHcB6eUKOdQPJgoZsK67W94g=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=nYcRtqq0BYleLMWVme4nWxcvJm//247pjMWOUnYH8ciU/DCq/xWp9PU1gmDacqs6N vg6+GFYqpPyR3fKPLyU5KzPuzlB6gMrkfvmyZS7fswB52lucDTMBh8dGt1ZwniUtbl RriSFP9Ru2NKl4gSiMPQSRSixwhXs6y+HxX5ZuueaLlj3EXO6i++mFHkjF0xB3BWZI IvK5GkwjKWms4gdC3nz5uKoM1wBmNz8ngPdxQrQqTilwOnmLO6tpZreVlUmv1Ppeik qzI23UglSDKXsXIyHCcL5F6hXHfVoYy+OTT42qX/Y/avQD/uNCW/ILNUiHG0b42RZC 1gwrofyKYw0fA== From: Benjamin Tissoires Date: Wed, 21 Feb 2024 17:25:17 +0100 Subject: [PATCH RFC bpf-next v3 01/16] bpf/verifier: allow more maps in sleepable bpf programs Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240221-hid-bpf-sleepable-v3-1-1fb378ca6301@kernel.org> References: <20240221-hid-bpf-sleepable-v3-0-1fb378ca6301@kernel.org> In-Reply-To: <20240221-hid-bpf-sleepable-v3-0-1fb378ca6301@kernel.org> To: Alexei Starovoitov , Daniel Borkmann , John Fastabend , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Jiri Kosina , Benjamin Tissoires , Jonathan Corbet , Shuah Khan Cc: bpf@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, Benjamin Tissoires X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1708532719; l=1061; i=bentiss@kernel.org; s=20230215; h=from:subject:message-id; bh=R3G29V1nYqPfReSpGBjXHcB6eUKOdQPJgoZsK67W94g=; b=Sj7ipK1o5q96wXkl7PmldN0CmFbJdrMyNtyHoJiZuX1EPDYejRzCG4iBxZ+OSDYpD5UptXfDe Y71xE1UhYqMC9qmgMnDcBIxYAtpJT7wWm68sYByi26265cLilYCfRIg X-Developer-Key: i=bentiss@kernel.org; a=ed25519; pk=7D1DyAVh6ajCkuUTudt/chMuXWIJHlv2qCsRkIizvFw= These 2 maps types are required for HID-BPF when a user wants to do IO with a device from a sleepable tracing point. Allowing BPF_MAP_TYPE_QUEUE (and therefore BPF_MAP_TYPE_STACK) allows for a BPF program to prepare from an IRQ the list of HID commands to send back to the device and then these commands can be retrieved from the sleepable trace point. Signed-off-by: Benjamin Tissoires --- no changes in v3 changes in v2: - dropped BPF_MAP_TYPE_PROG_ARRAY from the list --- kernel/bpf/verifier.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index 011d54a1dc53..88e9d2e4c29f 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -18022,6 +18022,8 @@ static int check_map_prog_compatibility(struct bpf_verifier_env *env, case BPF_MAP_TYPE_SK_STORAGE: case BPF_MAP_TYPE_TASK_STORAGE: case BPF_MAP_TYPE_CGRP_STORAGE: + case BPF_MAP_TYPE_QUEUE: + case BPF_MAP_TYPE_STACK: break; default: verbose(env,