Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp22476727rwd; Fri, 30 Jun 2023 08:27:46 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4YmeoaC58DI9ZHmMRJtxstn9TU6qrh4+LtEI/1j+aVCdgh44wOTDoaCoNqfAN87vo2DZya X-Received: by 2002:a05:6a20:5486:b0:12c:f581:c3a3 with SMTP id i6-20020a056a20548600b0012cf581c3a3mr3061284pzk.6.1688138866236; Fri, 30 Jun 2023 08:27:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688138866; cv=none; d=google.com; s=arc-20160816; b=eIaVIX1COigNDX9iKaj9BVeNiOnJwVDZ/c/K7ry5Fe5XhJNJa+MBd8QwGitJ2Z4/+9 nPujKfVZfLUp2cWlZiHkh36Gb5csCPqnkJYcOjxRYn85iuEfYQ6fUD0Wl3fC2CZh2zlI IcK26h+vMqLIdZImoRs7palUmt9IeVDIwcrEKdGBA5FQpW82Y0WBaC8HB9DBJY6+zpLB F+u+olD0HAQTVyvvkSSGwULaeeB/jehoPcoPYryb3JehMinj+OcC+BjureD/UKO5XeXb HMTttcXZrai4Jbre+jQuTq2CThd6AjIxOaQoMZOyDmCBahjN8R1gSeijg+bYABFFmhC9 zwmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:mime-version:date :dkim-signature; bh=loQnDSW9i5LQhmfPoJ46XCIWUTUs998PhfaFmb8iPCg=; fh=NSJLBjKXARWho6yNMQ6NKYVCTrOJ3nemVYf/i4/l8dI=; b=v/tD6cSLQlQNBRzJ81mXh4CgIAhz6JjK7My6Ki8WnNPlX4jvxtpJct9UBlPh2tkzt4 cM1SaSUehOIXawVVZEs6UO6ce59V/viidCtXpL1qEcjMwUrfkel+0WQnhksLA0brpY6Y yr+vwDwCqg8OcmwGpCqO1OKpEbBeRj5PBJa92en7wM2odrkVav7AUM9AXaHv6tjoawnL ryFaARnA7Mzuxr3QxvItN5JwvPcz66bphLgc6w7WXwk/g+zshDgScYWGLQton1cdTlP9 BLtaz8yf1OjSvog5Vs0mRu4Um7wjPLCZsbHqVUxrxVsMhEvrdXN4U5eaFUnXs1aoJtbX f0Tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b="wV/AbYBD"; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c15-20020a63ea0f000000b00553b512757fsi12731552pgi.169.2023.06.30.08.27.33; Fri, 30 Jun 2023 08:27:46 -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=@google.com header.s=20221208 header.b="wV/AbYBD"; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231743AbjF3PKj (ORCPT + 99 others); Fri, 30 Jun 2023 11:10:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232940AbjF3PKh (ORCPT ); Fri, 30 Jun 2023 11:10:37 -0400 Received: from mail-ed1-x549.google.com (mail-ed1-x549.google.com [IPv6:2a00:1450:4864:20::549]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48E4830C5 for ; Fri, 30 Jun 2023 08:10:35 -0700 (PDT) Received: by mail-ed1-x549.google.com with SMTP id 4fb4d7f45d1cf-51da39aa6dcso1287551a12.2 for ; Fri, 30 Jun 2023 08:10:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1688137833; x=1690729833; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=loQnDSW9i5LQhmfPoJ46XCIWUTUs998PhfaFmb8iPCg=; b=wV/AbYBDpdmbnu1YXDKN+oBr9te5bbwTFjXCX+p+JSvzD9dErSY/O74w8yfzZ16p51 3Od1QYzsQZ1AEsh/lKwZLkk6RMDChs6mPHCDAfEeHwdgo32BUfdw7HeOjkjURjOyUOzz ZgqnDNwD6BICpQkyAkzynhWrpXaEObB7I/EuwzIzU53xHc3lm7lXWhUPYBmLYQo8PY9g Rzy+UmgVqCt9AOwDqjuOzicwNW8jX4Idp00fTc2oymxSWVZCArWNwTTIH73Cr6egGvrk hk7g81HfHNGEK0uiRVgMoV91gLwmAsXnVPI0R/K/LL3ZOZpH8P4jw4wkn9fHrY76oIwk cXdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688137833; x=1690729833; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=loQnDSW9i5LQhmfPoJ46XCIWUTUs998PhfaFmb8iPCg=; b=Ua+kqGnjVW267Q5j77WGQsGmZ5fOWeiWJKDrXbQ886XXUNXo0+UpjmLVVpeRM8ASFS voNvbUfh14NeiP7jNVbwMvdBRmagtYREtGUQQd6VEpzxKfyEvYiP9jEbd5VLep3Wdebn DZ68kYTopN8JENcb9fQ3hla9t3ps73VyIgxLX6E6eLQIKlcYoF06uiyr7L3DC74tY3sb CFNun3c6/LVkiNhZ26Q4r/CTyUgXkRteeAyPkCQ+iXZWE/maUFNWApLJqqzDF+idvpQ0 UGNYIo2SYMPu8T4gpkAfJB3bYKm4CnajlnW4ORzxaqRJztOLFdEGfGyHrX1BN6vn5Npo 86Qw== X-Gm-Message-State: ABy/qLZdOY8jnAj6/zQq2zyTAI2EtWpGmTfPYWpZ08r+5fxyhx0GsnU4 FnUSjhHMYuWzW3VFcwsSlFvUD6c4srtVbHu+cA== X-Received: from mr-cloudtop2.c.googlers.com ([fda3:e722:ac3:cc00:31:98fb:c0a8:fb5]) (user=matteorizzo job=sendgmr) by 2002:a50:a6dd:0:b0:51d:9659:4dae with SMTP id f29-20020a50a6dd000000b0051d96594daemr11259edc.5.1688137833489; Fri, 30 Jun 2023 08:10:33 -0700 (PDT) Date: Fri, 30 Jun 2023 15:10:02 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.41.0.255.g8b1d071c50-goog Message-ID: <20230630151003.3622786-1-matteorizzo@google.com> Subject: [PATCH v3 0/1] Add a sysctl to disable io_uring system-wide From: Matteo Rizzo To: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, io-uring@vger.kernel.org, axboe@kernel.dk, asml.silence@gmail.com Cc: matteorizzo@google.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, jmoyer@redhat.com, krisman@suse.de Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED, USER_IN_DEF_DKIM_WL 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 Over the last few years we've seen many critical vulnerabilities in io_uring[1] which could be exploited by an unprivileged process to gain control over the kernel. This patch introduces a new sysctl which disables the creation of new io_uring instances system-wide. The goal of this patch is to give distros, system admins, and cloud providers a way to reduce the risk of privilege escalation through io_uring where disabling it with seccomp or at compile time is not practical. For example a distro or cloud provider might want to disable io_uring by default and have users enable it again if they need to run a program that requires it. The new sysctl is designed to let a user with root on the machine enable and disable io_uring systemwide at runtime without requiring a kernel recompilation or a reboot. [1] Link: https://goo.gle/limit-iouring --- v3: * Fix the commit message * Use READ_ONCE in io_uring_allowed to avoid races * Add reviews v2: * Documentation style fixes * Add a third level that only disables io_uring for unprivileged processes Matteo Rizzo (1): io_uring: add a sysctl to disable io_uring system-wide Documentation/admin-guide/sysctl/kernel.rst | 19 +++++++++++++ io_uring/io_uring.c | 31 +++++++++++++++++++++ 2 files changed, 50 insertions(+) base-commit: 1601fb26b26758668533bdb211fdfbb5234367ee -- 2.41.0.255.g8b1d071c50-goog