Received: by 2002:a05:7412:8d11:b0:fa:4934:9f with SMTP id bj17csp509361rdb; Mon, 15 Jan 2024 04:49:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IGJ2PLB2PG8GEi6z9EcTbQLHiF4+nteew2uaZu+u03v6mJ2mxqHqf9DXDsKCDun03qGzGBb X-Received: by 2002:a17:906:a850:b0:a2d:58cb:841c with SMTP id dx16-20020a170906a85000b00a2d58cb841cmr1188561ejb.51.1705322983851; Mon, 15 Jan 2024 04:49:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705322983; cv=none; d=google.com; s=arc-20160816; b=XfMGVu6jqA3YMnBduO0ocRwFYBr+61rO4I9HMhbYy2shprQ8Gibo970sN0yXrxqvPN hUGMw27wStALRWeYgFUrW6jvK5Wvca457gFSK4YG4SMHiLreyo2iBLjDpNwxQOsBDuDZ MfnFyF94lwSU9Gw5kZusHNQS4RZegwXgdrJSGpBa+nYK1CMG/JUF/rNezLW48SlJgWzP 2xnMdz0CmzCAUKonWjAKD3iNqaCxOQz9K2GZil/RD8F3nPXjdv06T83Ouwnebyg1e3AD njSH6CfLzdnBOumagjATANf2fNV2e1T4wfmnHoh9Zwwerkoo/vYmNSpIv+vhd0xAsqrp mNkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:to:from :dkim-signature; bh=zAY4fhIX05imv8R3TK0HIbxeC0Nq1d7M0aRDqNU4YGc=; fh=d73pb0+WdclC5XnP85QlSqLEyuJesFsiolAZMrQ1oUk=; b=sq1h4VCqhw+T7ROZuvR9n4R52PArveovSY4wp2f3bDMGTRZyCGnXugrukrvuRzfcTe oiNdPXNQXrGSrCcralV2K0UeQIFQ+Xke9siM/Bm4PKXgnOtRnHGraAZndhUSA0KGo7ho CuOxnaXKAM/WM3733XuesRFIxp27INX2MQ9AWiuychrKD9BKXx1dq4ewXkwUjVjFaQZ8 8MeTfrA94x9GQ+ttJe+zmesrygtH3TKZJ0YaMk6XJ2JhH3g8DIVppgypebvPCE/K1gtz 5MUzm44B78Dw+3nG28G+Dh0rm9lQ4EoybD5vzhB4NVGwHjNh4Jr5ce7UQiio4PsLPcmc 3zpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ALrmMsr4; spf=pass (google.com: domain of linux-kernel+bounces-25972-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25972-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 16-20020a170906059000b00a2a20ab96f9si3605282ejn.338.2024.01.15.04.49.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 04:49:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-25972-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ALrmMsr4; spf=pass (google.com: domain of linux-kernel+bounces-25972-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25972-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 68A651F21FE3 for ; Mon, 15 Jan 2024 12:49:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 59E531640B; Mon, 15 Jan 2024 12:49:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ALrmMsr4" Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (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 48A03134CA; Mon, 15 Jan 2024 12:49:32 +0000 (UTC) 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 Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-1d542701796so44016865ad.1; Mon, 15 Jan 2024 04:49:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705322972; x=1705927772; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=zAY4fhIX05imv8R3TK0HIbxeC0Nq1d7M0aRDqNU4YGc=; b=ALrmMsr4AR78gpILyMraNM3HtrYpeeoDVcBb+8HZK3Eev/ne8fPxmBZCkC6Kmd05xm 8GCUipCaumGcAgVY39SDH4u7kofkL47JSgJSvfdJsi3vtxuMr8tpUbExtVGB4X1m19wE Zm7+gaujeRLxWbC3i0jV2LTfM5quVd19oFggZhTSTCiYwlFB0THCmIR8Tii125vP22Bv VUUjtJu+qljgGatJCqheGcIvK5GVOLENPXpkTWglaWYJgNDQjf2qFliYxOfHCsKA3yu5 GfdmJXut0xlsRFevEYZveXb6ZElFcG0s2YjwR75dmgu52VkzOzgipneAV/XOP7wYJt2Y d34g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705322972; x=1705927772; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zAY4fhIX05imv8R3TK0HIbxeC0Nq1d7M0aRDqNU4YGc=; b=a1aolULyEnccpKa9IRJw5+SPU14+yjWjsyOpb8xNAMlYGjI0U7xBystopSXl8JSxdZ 8J3Dxurvg5oYmkamWGEMCdePRnNOUHhoTcmhMg8Wk5yyDAecf5YnR02sNCiqUEqS+WxS Um1j9fy0wonssbG2X4RYxW181sGMG2H8UVp1wQs38OrIOVLPyTlLdlEJbhrOcfdyLypj f7vPBVEW64GF0C1kHW9EFQP2I6kG5KB537lgEhFU5WOzHhUXzPNmA0POfg+FJI7FJv5D 43lDiucv/HZ5J8epwFTTvnrtxTP20yGRKajyoVvMRk9CxUBeobLect+dEr8T1mkvBD0p k8UQ== X-Gm-Message-State: AOJu0Ywy125Mi0DkySUc11UMVqMnpzAAmRx66FGFPcCp//u0DEc9oOrv McRMcuyfpL+eMFNNL1ka+QA= X-Received: by 2002:a17:902:c385:b0:1d4:c1b5:7248 with SMTP id g5-20020a170902c38500b001d4c1b57248mr2941983plg.96.1705322972422; Mon, 15 Jan 2024 04:49:32 -0800 (PST) Received: from user.. ([106.51.187.155]) by smtp.gmail.com with ESMTPSA id s3-20020a17090330c300b001d5b7ae4831sm3840331plc.180.2024.01.15.04.49.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 04:49:32 -0800 (PST) From: Subramanya Swamy To: corbet@lwn.net, axboe@kernel.dk, asml.silence@gmail.com, ribalda@chromium.org, rostedt@goodmis.org, bhe@redhat.com, akpm@linux-foundation.org, matteorizzo@google.com, subramanya.swamy.linux@gmail.com, ardb@kernel.org, alexghiti@rivosinc.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, io-uring@vger.kernel.org Subject: [PATCH] iouring:added boundary value check for io_uring_group systl Date: Mon, 15 Jan 2024 12:49:25 +0000 Message-Id: <20240115124925.1735-1-subramanya.swamy.linux@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 7bit /proc/sys/kernel/io_uring_group takes gid as input added boundary value check to accept gid in range of 0<=gid<=4294967294 & Documentation is updated for same Signed-off-by: Subramanya Swamy --- Documentation/admin-guide/sysctl/kernel.rst | 9 ++++----- io_uring/io_uring.c | 8 ++++++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Documentation/admin-guide/sysctl/kernel.rst b/Documentation/admin-guide/sysctl/kernel.rst index 6584a1f9bfe3..3f96007aa971 100644 --- a/Documentation/admin-guide/sysctl/kernel.rst +++ b/Documentation/admin-guide/sysctl/kernel.rst @@ -469,11 +469,10 @@ shrinks the kernel's attack surface. io_uring_group ============== -When io_uring_disabled is set to 1, a process must either be -privileged (CAP_SYS_ADMIN) or be in the io_uring_group group in order -to create an io_uring instance. If io_uring_group is set to -1 (the -default), only processes with the CAP_SYS_ADMIN capability may create -io_uring instances. +When io_uring_disabled is set to 1, only processes with the +CAP_SYS_ADMIN may create io_uring instances or process must be in the +io_uring_group group in order to create an io_uring_instance. +io_uring_group is set to 0.This is the default setting. kexec_load_disabled diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index 09b6d860deba..0ed91b69643d 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -146,7 +146,9 @@ static void io_queue_sqe(struct io_kiocb *req); struct kmem_cache *req_cachep; static int __read_mostly sysctl_io_uring_disabled; -static int __read_mostly sysctl_io_uring_group = -1; +static unsigned int __read_mostly sysctl_io_uring_group; +static unsigned int min_gid; +static unsigned int max_gid = 4294967294; /*4294967294 is the max guid*/ #ifdef CONFIG_SYSCTL static struct ctl_table kernel_io_uring_disabled_table[] = { @@ -164,7 +166,9 @@ static struct ctl_table kernel_io_uring_disabled_table[] = { .data = &sysctl_io_uring_group, .maxlen = sizeof(gid_t), .mode = 0644, - .proc_handler = proc_dointvec, + .proc_handler = proc_douintvec_minmax, + .extra1 = &min_gid, + .extra2 = &max_gid, }, {}, }; -- 2.34.1