From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oo1-f54.google.com (mail-oo1-f54.google.com [209.85.161.54]) (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 5940D282F06 for ; Fri, 10 Jul 2026 13:03:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783688602; cv=none; b=EWqQF2VX82N5Lnav5ogdtepdhVlBnp8TcBLXufD9OkY+PDDFjbJUdtbbx4Z5SJuV0vjQ+GEmJ7i0syVA5N/B+BkJcGNJsY8XTri5pWz/wVTLefDo4p/oJrL7ToA3fxcJguyQQwpglmlJDLFUYN0DEjz+lmRjF9rzzPzLJscZDPM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783688602; c=relaxed/simple; bh=A5Ml02DRgrqpt0RhhLWCeNmYpxshEtOXGwmi0wKQ+J0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Dvk/c03MsfIzNyw6g3KoMuIAxDdyNahHreRjMt4DfpjAfryemGVtMupbSI54uBqPV030SxJQk1x+yIdDysR+MgpWvs8V8Bhz5N8sHBy1Jch07JXsFMElDCJfKJmIh1h+mWDGPbyr0bkQ0Xs4CBBr7HuCN0ZmmCjwgZGunmflRVs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk; spf=pass smtp.mailfrom=kernel.dk; dkim=pass (2048-bit key) header.d=kernel-dk.20251104.gappssmtp.com header.i=@kernel-dk.20251104.gappssmtp.com header.b=vkHYI2r/; arc=none smtp.client-ip=209.85.161.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kernel.dk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel-dk.20251104.gappssmtp.com header.i=@kernel-dk.20251104.gappssmtp.com header.b="vkHYI2r/" Received: by mail-oo1-f54.google.com with SMTP id 006d021491bc7-6a31b9a492aso640060eaf.1 for ; Fri, 10 Jul 2026 06:03:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20251104.gappssmtp.com; s=20251104; t=1783688599; x=1784293399; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=AXDUBu3394gYScWwI1t5FfFrD6OkXTPwEpvqTOElS9E=; b=vkHYI2r/uQm9fgPjVZkFbUXIM1b557BeD5Helybn0LA3sw212cV0omMAEqeGU2t9C7 u1BBEwxHB4yHmLFis5F76ufSFaNF8TjP2HG/8RQWzCAoUSO1B9SuMooTE0fQwT12p5bM SYu1aZ1NlIkGcXgkMe0Ck0mOVfhH/uwWpisrQ0QWD4rGrD+TK1fM+pvR86BYuwe7OTP1 uJbASdaqTN7g8Wti7xixUZ5B2k5M6zu2bEzRW4rxNIhJsxQI9ykdhCZopLy8CwRvtovt zxrYn22GuYPCFeQSzZPpscfUFsesPYoTGI/yLkNaCMDhGoVCz0E7EYBWn9KDE2b5qzLd jvPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783688599; x=1784293399; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=AXDUBu3394gYScWwI1t5FfFrD6OkXTPwEpvqTOElS9E=; b=Ysf55BB3QwuW0uIkok2ZCUBN3itlR3jd+a08Xe+svumbk14sAREBvTsv2MxjV916f2 RhVdUwaSIaMtXoV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qLvSA2gy81W5lZs= X-Received: by 2002:a05:6820:f00e:b0:6a3:93ee:17b1 with SMTP id 006d021491bc7-6a393ee2940mr543087eaf.4.1783688598637; Fri, 10 Jul 2026 06:03:18 -0700 (PDT) Received: from [192.168.1.150] ([198.8.77.157]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-6a38b9ccff2sm1527126eaf.3.2026.07.10.06.03.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 Jul 2026 06:03:18 -0700 (PDT) Message-ID: <7c885746-3787-4ca9-9cc7-6d37be60faf0@kernel.dk> Date: Fri, 10 Jul 2026 07:03:15 -0600 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [BUG] io_uring: task-scoped restriction/BPF filter bypass via blind register path and R_DISABLED rings To: inging gpt Cc: io-uring@vger.kernel.org, linux-kernel@vger.kernel.org References: Content-Language: en-US From: Jens Axboe In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit > === Bug 1 (strongest): blind register path skips all restriction checks === > > io_uring_register_blind() (register.c:1001) dispatches > IORING_REGISTER_SEND_MSG_RING directly without consulting the sqe_op > allowlist, BPF opcode filter, or register_op allowlist. The blind path > has zero restriction checks. > > A task that installs a restriction denying IORING_OP_MSG_RING can bypass > it by calling io_uring_register(-1, IORING_REGISTER_SEND_MSG_RING, ...) > instead of submitting an SQE. The message is delivered to the target > ring ? the forbidden MSG_RING operation executes. No restriction > configuration can prevent this. > > Root cause: the submit path (io_uring.c:1792/1893) checks > ctx->restrictions.sqe_op and ctx->bpf_filters, but the blind register > path reaches io_uring_sync_msg_ring() without building an io_kiocb, > so neither check fires. The register_op allowlist (register.c:767) is > only checked in __io_uring_register() which requires fd != -1 ? the > blind path bypasses it entirely. This is nonsense, they are two different things - one is an sqe op, the other is a register op. The filter supports both, you just only set 1. > === Bug 2: register_op allowlist bypassed via R_DISABLED === > > The register_op allowlist check (register.c:767) gates on > !(ctx->flags & IORING_SETUP_R_DISABLED): > > if ((ctx->int_flags & IO_RING_F_REG_RESTRICTED) && > !(ctx->flags & IORING_SETUP_R_DISABLED)) { > if (!test_bit(opcode, ctx->restrictions.register_op)) > return -EACCES; > } > > For ring-scoped restrictions, R_DISABLED is a transient setup window > that ENABLE_RINGS closes. But for task-scoped restrictions cloned at > ring creation, the sandboxed task controls R_DISABLED and can simply > never call ENABLE_RINGS, leaving the register_op allowlist permanently > unenforced while still issuing register opcodes. This seems like a minor oversight, send a patch for it. If you can LLM your way through producing all of this stuff, at least have the courtesy to also LLM your way to a patch. Ignored the rest, because it's also just fluffy LLM garbage. -- Jens Axboe