From mboxrd@z Thu Jan 1 00:00:00 1970 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 6ED4217AAD for ; Wed, 9 Aug 2023 11:34:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E49D3C433C8; Wed, 9 Aug 2023 11:34:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1691580850; bh=OO2f11G/Odzh/TvI0Pw6397Vj1U5v8I9q279GTOfN2g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QBjzcSSpvzjlPM9sFIh9fdruhyx1KDDb23+HXoho6/8Mj4xPSIawNSj51KPVIE/pO 5EXMdPC8T1OD4jm3oq+4UvtlQ3MOtKtMjrrI+KTXVNTEN6oHBtmDDiXVhNLcZ1jpqt ckT7TadhWMVPVWcavhf1y87DJtQx9KPPnxd8xwxU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ondrej Mosnacek , Jeff Moyer , Jens Axboe , Sasha Levin Subject: [PATCH 5.10 002/201] io_uring: dont audit the capability check in io_uring_create() Date: Wed, 9 Aug 2023 12:40:04 +0200 Message-ID: <20230809103643.876541279@linuxfoundation.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230809103643.799166053@linuxfoundation.org> References: <20230809103643.799166053@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Ondrej Mosnacek [ Upstream commit 6adc2272aaaf84f34b652cf77f770c6fcc4b8336 ] The check being unconditional may lead to unwanted denials reported by LSMs when a process has the capability granted by DAC, but denied by an LSM. In the case of SELinux such denials are a problem, since they can't be effectively filtered out via the policy and when not silenced, they produce noise that may hide a true problem or an attack. Since not having the capability merely means that the created io_uring context will be accounted against the current user's RLIMIT_MEMLOCK limit, we can disable auditing of denials for this check by using ns_capable_noaudit() instead of capable(). Fixes: 2b188cc1bb85 ("Add io_uring IO interface") Link: https://bugzilla.redhat.com/show_bug.cgi?id=2193317 Signed-off-by: Ondrej Mosnacek Reviewed-by: Jeff Moyer Link: https://lore.kernel.org/r/20230718115607.65652-1-omosnace@redhat.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- io_uring/io_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index 51e6ebe72caf9..f84584b762d09 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -10431,7 +10431,7 @@ static int io_uring_create(unsigned entries, struct io_uring_params *p, if (!ctx) return -ENOMEM; ctx->compat = in_compat_syscall(); - if (!capable(CAP_IPC_LOCK)) + if (!ns_capable_noaudit(&init_user_ns, CAP_IPC_LOCK)) ctx->user = get_uid(current_user()); /* -- 2.39.2