Received: by 2002:a05:6358:51dd:b0:131:369:b2a3 with SMTP id 29csp72351rwl; Wed, 9 Aug 2023 11:05:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHg8TRmrHvXNFY73no2KmXihw/3qDW4q7SEKk8c4AxZKbI8U95AzMiZMxPwKGnvsoSWYaME X-Received: by 2002:a17:903:41c7:b0:1b7:f443:c7f8 with SMTP id u7-20020a17090341c700b001b7f443c7f8mr4165798ple.15.1691604330802; Wed, 09 Aug 2023 11:05:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691604330; cv=none; d=google.com; s=arc-20160816; b=szQLYqnk3o0H9/1DqKf7plpcUP4ogEeDTugrOl85SHqe9iWrgpjM5+GO5FPBE+Wprx k3zXhZnDsgLmBSw7o19ndDuVfec7DMr0Xy6Qlrv49abLexN9dPWVYU5Nevb2+daGzVPK m2Wh3h7R18SgfjRTmkivC2Cw3Dk8pjFDpVYbBTSmPb2WTYXCdXmQX5hes9kFkfBjsZst 9b+E5I8zz1lAGI+supebnECiXJQ+WBODiLqo8320sFbLk440Db6c9vqd/nKU4ywr+3iF s0dBjPgXrbi0iFSZRZqVjJWtYV3KEbN0OuVoXc9TWo8yT4KP1aiEiE+jrpy5KqHp5VnW lNJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=fWPKgkPD2NApId8xAMwR5FJ9kwbAbO40jZgA/kxOPXw=; fh=nIlC5lWgEAmddaiJt5YE7DUBHoCJWvVib/Ts9ybT5kQ=; b=vZJc3Hdqs3Zz62ozQd+A2++LRiy3Vne+XcBa+9gAlJxgzPB47q2Rh9E7mv0dbVVB8b 5MflbStJoYOiYebhl8oOs0V3dahrT8w9aHQ7TB2lHcCVgQmSwnbREA+xFKF6MjoDv8UX +9dJ9FZaNMC0xLQCkW8QhEYBNlAuizZDSOgqecezwokE8H53R0X7hX3/A95wL9dVwWvg UDaNT3lvEKnaM6eTafzVNWH4nzt3zu2n18ld7KK4u0v0n4ekDl0xmDb1Tf1zqUg2OGqf e4WEDMPpbmw8ALgvNkaw3QUYYKradwntPeweolS/6m+Albmgv/KxPC/7TtN+3pBlTjlM rYug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20221208.gappssmtp.com header.s=20221208 header.b=xiZQdRUM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lf15-20020a170902fb4f00b001bb053dc947si9720110plb.177.2023.08.09.11.05.17; Wed, 09 Aug 2023 11:05:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20221208.gappssmtp.com header.s=20221208 header.b=xiZQdRUM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230299AbjHIQpo (ORCPT + 99 others); Wed, 9 Aug 2023 12:45:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230188AbjHIQpn (ORCPT ); Wed, 9 Aug 2023 12:45:43 -0400 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0AA601BFA for ; Wed, 9 Aug 2023 09:45:41 -0700 (PDT) Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-6873f64a290so1825517b3a.0 for ; Wed, 09 Aug 2023 09:45:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20221208.gappssmtp.com; s=20221208; t=1691599540; x=1692204340; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=fWPKgkPD2NApId8xAMwR5FJ9kwbAbO40jZgA/kxOPXw=; b=xiZQdRUMzTPeshTAGUCQLm71pGlwG66tm90kWG1wNVdvxVbSSeZKoYp8ya8uKdQgJj YD3zbUYdow9V8KDGVxi6V5rfM1uK+bitg9oAfomuVGVgbf7fNV1N2kpUy0KRbgD/1guf Hz7wVDRWhoiiN8W2VG8oZ2UuSbkRBwLF+eFqI0Mfmck/SzIVDiS2sK21wdgxtfLoiQAA xKzKjov3DuUI+ayU9saBx3Q6as8aU/rUXnZaqopfgn9jzoyfnIKPrwQE2a0ieH4GQPq7 9g27h/OWDPqhePzXLqdkt7ezzJCGwtSLt5Fhg0kHpFxmVuzeQJFR8NmkEeoVLqBRtjNY nmGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691599540; x=1692204340; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=fWPKgkPD2NApId8xAMwR5FJ9kwbAbO40jZgA/kxOPXw=; b=ci7A0Rn72fvBYgQOP2KF39S1I+Gk/N5SQBkmRc+vZad4P8AGQDItwZeOJfNM6pNb1R PWzgtmz+RkndEswOX3KAbzI6a1JkQkzQgXF4yu5VU8/OVOWxrCgBVc95CpquevmmN4hY u6aR1+K6mkh41JRwW3WMYITJURl8ptG0rtQ22D08HKtAAyYAcdv17NEDSKdIlXlDltIU PY8oegcrEIuTv9ECebTvflIe7IQtSUGxOdqOCjlwHQHVwyyfJmn2sGGluGq2tqRzaFRJ kurgPAcKLLhPA52k4AZFvSzjBYpigBwpTnjUawftqClZ+ozRihaZHg5ljLKPQpCwPoYq FPDQ== X-Gm-Message-State: AOJu0Yy0le7Vz5iYsnsVJ6leXMBgVxqyz+hcx89lz+YuJY74zxl1//6L t7m+Nt3wm5svQhqL582SeYsotw== X-Received: by 2002:a05:6a00:1d23:b0:676:2a5c:7bc5 with SMTP id a35-20020a056a001d2300b006762a5c7bc5mr3500680pfx.1.1691599540439; Wed, 09 Aug 2023 09:45:40 -0700 (PDT) Received: from [192.168.1.136] ([198.8.77.157]) by smtp.gmail.com with ESMTPSA id u6-20020a62ed06000000b006833bcc95b0sm10186888pfh.115.2023.08.09.09.45.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 09 Aug 2023 09:45:39 -0700 (PDT) Message-ID: Date: Wed, 9 Aug 2023 10:45:36 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 1/1] io_uring: add a sysctl to disable io_uring system-wide Content-Language: en-US To: Andres Freund , Jeff Moyer Cc: Matteo Rizzo , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, io-uring@vger.kernel.org, asml.silence@gmail.com, corbet@lwn.net, akpm@linux-foundation.org, keescook@chromium.org, ribalda@chromium.org, rostedt@goodmis.org, jannh@google.com, chenhuacai@kernel.org, gpiccoli@igalia.com, ldufour@linux.ibm.com, evn@google.com, poprdi@google.com, jordyzomer@google.com, krisman@suse.de References: <20230630151003.3622786-1-matteorizzo@google.com> <20230630151003.3622786-2-matteorizzo@google.com> <20230726174549.cg4jgx2d33fom4rb@awork3.anarazel.de> <20230809150945.abp755qafjhxbmx6@awork3.anarazel.de> From: Jens Axboe In-Reply-To: <20230809150945.abp755qafjhxbmx6@awork3.anarazel.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/9/23 9:09 AM, Andres Freund wrote: > Hi, > > Sorry for the delayed response, EINBOXOVERFLOW. > > On 2023-07-26 16:02:26 -0400, Jeff Moyer wrote: >> Andres Freund writes: >> >>> Hi, >>> >>> On 2023-06-30 15:10:03 +0000, Matteo Rizzo wrote: >>>> Introduce a new sysctl (io_uring_disabled) which can be either 0, 1, >>>> or 2. When 0 (the default), all processes are allowed to create io_uring >>>> instances, which is the current behavior. When 1, all calls to >>>> io_uring_setup fail with -EPERM unless the calling process has >>>> CAP_SYS_ADMIN. When 2, calls to io_uring_setup fail with -EPERM >>>> regardless of privilege. >>> >>> Hm, is there a chance that instead of requiring CAP_SYS_ADMIN, a certain group >>> could be required (similar to hugetlb_shm_group)? Requiring CAP_SYS_ADMIN >>> could have the unintended consequence of io_uring requiring tasks being run >>> with more privileges than needed... Or some other more granular way of >>> granting the right to use io_uring? >> >> That's fine with me, so long as there is still an option to completely >> disable io_uring. > > Makes sense. > > >>> ISTM that it'd be nice if e.g. a systemd service specification could allow >>> some services to use io_uring, without allowing it for everyone, or requiring >>> to run services effectively as root. >> >> Do you have a proposal for how that would work? > > I think group based permissions would allow for it, even if perhaps not in the > most beautiful manner. Systemd can configure additional groups for a service > with SupplementaryGroups, so adding a "io_uring" group or such should work. I'm going to drop the original patch until we work out a scheme that everybody is happy with, and that is flexible enough. -- Jens Axboe