From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E6531362133 for ; Wed, 22 Apr 2026 15:54:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776873249; cv=none; b=PWU9WqLX9yREMqjw2q/B1K30A9G7xxNcSwyL/+zv6uZq+G0/o4A6GEDad/7iUAoKTSUKa9ATBdm5Hbvi/GuY0k1gXL8eYa9dF/BUMuDf8tFoZZl4VgVpGPYnpx5vWlQmX1bO0c/624oY/8rEq0pgMKtpXbFCgMPpIk0ekP9yGng= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776873249; c=relaxed/simple; bh=chz0KLfckL0pVVlDTYqB5/Vp6ANh7y0usPSuATngaPA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=o12EpfJcmIFjqIl8UTl1RjBwde6yQbkUlAJs1V2pC29JFHUPPhJ4zs00HBGL2+autACI3sAqSYTjHvzWFkBCHI0zKFc0xW1V1dX0HWUQoaCG9Tyl8AEnre4/vFI7TeKIAj1zELlNOUhyz40pnxQLg90Kx52ZzCQHpC3lxWJVvyI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=sDoee2vF; arc=none smtp.client-ip=209.85.208.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="sDoee2vF" Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-67154eaef1cso798105a12.2 for ; Wed, 22 Apr 2026 08:54:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776873245; x=1777478045; darn=vger.kernel.org; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=1xYtCgCBSrJ171ZZx5YpgZR8oV4HLoKU+fvgbBYIH/A=; b=sDoee2vFt+loZjPVicWVQ8vvilrMCeE2eHW4Dj1H2ggz0T9oFTJbMvF2jKa6PdNJz/ HlXlXJwUVY9cvExQXXDQ9fYnphnQLtJN4BFBl1PRJsv/nlbOWrqYRXp0ZbuZszpRWBZr VYzILXdtcXL6JTJQlvj3badhmroynC0D1NuCWYPtcGfAJjw5vKutacKP2kTJa6xFZpFQ ez1ccNgrTffPq8bAWU0Gxnav69fFd5qHg3FVGe1sOzXH8AMq8P5HyldobgZJrR5DkUOJ lEUWvPvneZXU0e3t1wO1kG3dPdnCHJstbEakg9T6hKm39bapzqzHKV1Eik9nl2nzl1oc 7ILg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776873245; x=1777478045; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=1xYtCgCBSrJ171ZZx5YpgZR8oV4HLoKU+fvgbBYIH/A=; b=YYvCNUuWSZHV1VmrIAxu4Jp6MkOAz+dIAXI2yIomhfZ4KO0TXQb6K1NHTPoYLKkDUZ ybXsGT3NJ+bspxBbDWpi/crbk6tqrg0tnGi9IR6h7YD0/gjafYbGnKMSVyEseWNLfgc1 QjTJ7/cuzcs9JtwVa/bq75vcmLqu2t3nsM1n39u1KV414oU+L0D3cO4GMJJWCcSJ4E/7 VUsD0EsCEersF5dQmcut3f7SfCWF6fSwsrvsPKCWLawyPKTRWmRCS7M8VvjABA8AY1BR t5wrVJ7BpMh1JFYdF9xcN+m+uDmcDCwvtvYxfxriMOTrYydVm4csTP6TDeTJdTkyrfOF /ZXg== X-Forwarded-Encrypted: i=1; AFNElJ8pxIT+G2STMir5b8VHmIOG1IBuPdTAyrFJDVM5YVVIWQMhOrm4FRcSd+8X1/uJbMIGkgQVtP03Fm3V3Mo=@vger.kernel.org X-Gm-Message-State: AOJu0YxGbKtH8ovKrY6W7/L2GzcwquimwGrh0C3MEQiqLLz0ej3EfsVr hVL6nFPhOdT5bP6jkQWlexpVe9zljys4KFiCs/IMteklA19wUs5AsIRV X-Gm-Gg: AeBDieu5mAr3khpSZUk9Yz+wyVdJthu42snDlyc3so39SPiZwiYJ4Ubl5oGK0SK0VDL VYFhEykojECbRea/MuI688bc53judTCBqKPg5JWwJ+AkSfZtN5BOri0PUM5ARfh50bVHc15EzZ3 d5wIao9jXH50toBgdYjhH2698cY5kj13tACf0f6YoSg4roPS1ujEEVrqO56ez4yjk0iGIy65Jg7 Bmjf3FBLtiovC5YMqvv5KQdW/cSmWesWJpVPI2pxdM2rzkb3ZR7VwRfiUD1CLJ10nHm0NOUTzZd PIVDw15VRU2uoaS5yrEErXHtDZGeVbXF3gC5Wbuwz/IUaRjLcOGG0QvdFvehc1j5DaNPGX3d/G3 CzWIE40j1b5bhK1q10b2BruT8F1hqAuNHLt7+qrZNiwkcEh1veBFe8tXlL75iGHz64bD6nUzGEI mieiLdaGebfH9/uyO1+lnd3wMygQOrrgY5m+p1uFZXHRyeJ1aTyuqMs489pg== X-Received: by 2002:a05:6402:1cc1:b0:670:8ccd:704a with SMTP id 4fb4d7f45d1cf-672bfeda823mr4709355a12.5.1776873244793; Wed, 22 Apr 2026 08:54:04 -0700 (PDT) Received: from [192.168.168.223] ([182.176.170.188]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-672c4d50922sm3295274a12.21.2026.04.22.08.54.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 08:54:04 -0700 (PDT) From: Ali Raza Date: Wed, 22 Apr 2026 20:53:05 +0500 Subject: [PATCH] io_uring: fix missing submitter_task ownership check in bpf_io_reg() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260422-master-v1-1-e82f47558345@gmail.com> X-B4-Tracking: v=1; b=H4sIAODu6GkC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyDHUUlJIzE vPSU3UzU4B8JSMDIzMDEyMj3dzE4pLUIt0US7O0VINUi6Qk42QloOKCotS0zAqwQdGxEH5xaVJ WanIJSLdSbS0AA73dz2oAAAA= X-Change-ID: 20260422-master-d96fe0e8bb3c To: Jens Axboe Cc: io-uring@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Ali Raza , Pavel Begunkov X-Mailer: b4 0.15.2 bpf_io_reg() installs a BPF struct_ops loop_step on any io_uring ring the caller holds a file descriptor for. io_uring_ctx_get_file() only validates that the fd resolves to an io_uring file; it does not verify the caller has authority over the ring's submitter_task. A parallel path in io_uring_register() already enforces this: if (ctx->submitter_task && ctx->submitter_task != current) return -EEXIST; /* register.c:733 */ Without the equivalent check in bpf_io_reg(), a local user with CAP_PERFMON can exploit IORING_SETUP_R_DISABLED -- which defers submitter_task assignment until IORING_REGISTER_ENABLE_RINGS -- to install a loop_step on a ring before a more-privileged process becomes its submitter_task. The loop_step then executes in the privileged process's task context and can issue arbitrary io_uring operations (IORING_OP_WRITE, IORING_OP_READ, IORING_OP_SPLICE) against that process's open file table. This provides a cross-privilege io_uring execution primitive that can serve as a component in a privilege escalation chain when combined with a vector that induces a privileged process to adopt an attacker-controlled ring. Affected: v7.1-rc1+ with CONFIG_IO_URING_BPF_OPS=y. Requires: IORING_SETUP_DEFER_TASKRUN | IORING_SETUP_SINGLE_ISSUER. Add the ownership check in io_install_bpf(), which is called under uring_lock, matching the locking context of the register.c check. Signed-off-by: Ali Raza Cc: Pavel Begunkov --- io_uring/bpf-ops.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/io_uring/bpf-ops.c b/io_uring/bpf-ops.c index 937e48bef40b..cac11c929297 100644 --- a/io_uring/bpf-ops.c +++ b/io_uring/bpf-ops.c @@ -162,6 +162,8 @@ static int io_install_bpf(struct io_ring_ctx *ctx, struct io_uring_bpf_ops *ops) return -EOPNOTSUPP; if (!(ctx->flags & IORING_SETUP_DEFER_TASKRUN)) return -EOPNOTSUPP; + if (ctx->submitter_task && ctx->submitter_task != current) + return -EPERM; if (ctx->bpf_ops) return -EBUSY; --- base-commit: bea8d77e45a8b77f2beca1affc9aa7ed28f39b17 change-id: 20260422-master-d96fe0e8bb3c Best regards, -- Ali Raza