From patchwork Mon Aug 22 21:21:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Moore X-Patchwork-Id: 12951402 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A61FCC28D13 for ; Mon, 22 Aug 2022 21:21:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238014AbiHVVVN (ORCPT ); Mon, 22 Aug 2022 17:21:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238060AbiHVVVL (ORCPT ); Mon, 22 Aug 2022 17:21:11 -0400 Received: from mail-qk1-x735.google.com (mail-qk1-x735.google.com [IPv6:2607:f8b0:4864:20::735]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96D4652094 for ; Mon, 22 Aug 2022 14:21:09 -0700 (PDT) Received: by mail-qk1-x735.google.com with SMTP id g21so8929106qka.5 for ; Mon, 22 Aug 2022 14:21:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paul-moore-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:message-id:date:cc:to:from:subject:from:to:cc; bh=tBvBvoY7Kax3qLh+hCG+8GOl8mJNoIgfMsJnNPYNA+o=; b=WxNfdds9Z31JwSLesJVUKuuFnOze2bcmZvqgp6FrbYYzhFiTS+zzBZh9YHAhrqHQNI ajQq0VJ/Scjw+6DlFDICkSV0AhNQQUpU6SaUfdCw13SJh+bSKAnGXb+M1ojmSe00mqJ4 acD25E1LPop7+4/XSNZ7N6PVZvIKyn/8U7P1iyabrpgDcIgCxylxZDm4MvlCcsSYcAC2 lViqt2c89LeNLAbeXKcDbmunxyWg6WguaM8rEcur1zWRoYv70IqOx3x36Z4EGeh8YF+t URmci5DMWxHqMWzGmLKuInKjrnYvkxX/SsGzysMz0UxBlg97yUH6J4S7038t2y1YbRUA JYXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:message-id:date:cc:to:from:subject:x-gm-message-state :from:to:cc; bh=tBvBvoY7Kax3qLh+hCG+8GOl8mJNoIgfMsJnNPYNA+o=; b=PFeBw1Qg+sZleFLZqbQH9y63fknbWOdsyn2anlZYw1j0HJrFqPHV/PGgIdNKMpXCUT d2/KmJtzSndK/3DWtYdncSRhfpLkhd9HOU3d9LuiTOW9bXMxZxnq11Skg7vv9xs0d333 f3oa9io2FEXvKf0K9G/WyxkHUAQmuWPW+siD3X1/fg3lIe1kKBn/WdaqZMBD9awlyyPh 4IE3iRAs1R/5aXHp2aSTm0eQu3LmWIUWdVYb1qOYXK7WDWc9cXGaohkCBwfOxGqgMe1i xMwba/aZASPHuydkRFJ0O5gUXn021ZlGvat2m3v09VzJ0djFy1VzWXGY8jeUwFS2zD+8 JVsA== X-Gm-Message-State: ACgBeo3Uhkgo7IMS1dQZTcXC6ZQo5OrihYO4eit+zDZJsUc4S/SAu3vI 9xlj6laHfEOasBgnEs5uQB1D X-Google-Smtp-Source: AA6agR6LFqis/vbXNQ9SBwbPQPKo79xErEry6IV+AxmlSucjhhdge/XotZYCjJYccJBlidk4Wsyu4Q== X-Received: by 2002:a05:620a:448f:b0:6b5:fdcc:fe74 with SMTP id x15-20020a05620a448f00b006b5fdccfe74mr13889545qkp.64.1661203268664; Mon, 22 Aug 2022 14:21:08 -0700 (PDT) Received: from localhost (pool-96-237-52-46.bstnma.fios.verizon.net. [96.237.52.46]) by smtp.gmail.com with ESMTPSA id dt2-20020a05620a478200b006bb024c5021sm11980062qkb.25.2022.08.22.14.21.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 14:21:08 -0700 (PDT) Subject: [PATCH 1/3] lsm,io_uring: add LSM hooks for the new uring_cmd file op From: Paul Moore To: linux-security-module@vger.kernel.org, selinux@vger.kernel.org, io-uring@vger.kernel.org Cc: Arnd Bergmann , Greg Kroah-Hartman , Luis Chamberlain Date: Mon, 22 Aug 2022 17:21:07 -0400 Message-ID: <166120326788.369593.18304806499678048620.stgit@olly> In-Reply-To: <166120321387.369593.7400426327771894334.stgit@olly> References: <166120321387.369593.7400426327771894334.stgit@olly> User-Agent: StGit/1.5 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org From: Luis Chamberlain io-uring cmd support was added through ee692a21e9bf ("fs,io_uring: add infrastructure for uring-cmd"), this extended the struct file_operations to allow a new command which each subsystem can use to enable command passthrough. Add an LSM specific for the command passthrough which enables LSMs to inspect the command details. This was discussed long ago without no clear pointer for something conclusive, so this enables LSMs to at least reject this new file operation. [0] https://lkml.kernel.org/r/8adf55db-7bab-f59d-d612-ed906b948d19@schaufler-ca.com Fixes: ee692a21e9bf ("fs,io_uring: add infrastructure for uring-cmd") Signed-off-by: Luis Chamberlain Acked-by: Jens Axboe Signed-off-by: Paul Moore --- include/linux/lsm_hook_defs.h | 1 + include/linux/lsm_hooks.h | 3 +++ include/linux/security.h | 5 +++++ io_uring/uring_cmd.c | 5 +++++ security/security.c | 4 ++++ 5 files changed, 18 insertions(+) diff --git a/include/linux/lsm_hook_defs.h b/include/linux/lsm_hook_defs.h index 806448173033..60fff133c0b1 100644 --- a/include/linux/lsm_hook_defs.h +++ b/include/linux/lsm_hook_defs.h @@ -407,4 +407,5 @@ LSM_HOOK(int, 0, perf_event_write, struct perf_event *event) #ifdef CONFIG_IO_URING LSM_HOOK(int, 0, uring_override_creds, const struct cred *new) LSM_HOOK(int, 0, uring_sqpoll, void) +LSM_HOOK(int, 0, uring_cmd, struct io_uring_cmd *ioucmd) #endif /* CONFIG_IO_URING */ diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h index 84a0d7e02176..3aa6030302f5 100644 --- a/include/linux/lsm_hooks.h +++ b/include/linux/lsm_hooks.h @@ -1582,6 +1582,9 @@ * Check whether the current task is allowed to spawn a io_uring polling * thread (IORING_SETUP_SQPOLL). * + * @uring_cmd: + * Check whether the file_operations uring_cmd is allowed to run. + * */ union security_list_options { #define LSM_HOOK(RET, DEFAULT, NAME, ...) RET (*NAME)(__VA_ARGS__); diff --git a/include/linux/security.h b/include/linux/security.h index 1bc362cb413f..7bd0c490703d 100644 --- a/include/linux/security.h +++ b/include/linux/security.h @@ -2060,6 +2060,7 @@ static inline int security_perf_event_write(struct perf_event *event) #ifdef CONFIG_SECURITY extern int security_uring_override_creds(const struct cred *new); extern int security_uring_sqpoll(void); +extern int security_uring_cmd(struct io_uring_cmd *ioucmd); #else static inline int security_uring_override_creds(const struct cred *new) { @@ -2069,6 +2070,10 @@ static inline int security_uring_sqpoll(void) { return 0; } +static inline int security_uring_cmd(struct io_uring_cmd *ioucmd) +{ + return 0; +} #endif /* CONFIG_SECURITY */ #endif /* CONFIG_IO_URING */ diff --git a/io_uring/uring_cmd.c b/io_uring/uring_cmd.c index 8e0cc2d9205e..0f7ad956ddcb 100644 --- a/io_uring/uring_cmd.c +++ b/io_uring/uring_cmd.c @@ -3,6 +3,7 @@ #include #include #include +#include #include @@ -88,6 +89,10 @@ int io_uring_cmd(struct io_kiocb *req, unsigned int issue_flags) if (!req->file->f_op->uring_cmd) return -EOPNOTSUPP; + ret = security_uring_cmd(ioucmd); + if (ret) + return ret; + if (ctx->flags & IORING_SETUP_SQE128) issue_flags |= IO_URING_F_SQE128; if (ctx->flags & IORING_SETUP_CQE32) diff --git a/security/security.c b/security/security.c index 14d30fec8a00..4b95de24bc8d 100644 --- a/security/security.c +++ b/security/security.c @@ -2660,4 +2660,8 @@ int security_uring_sqpoll(void) { return call_int_hook(uring_sqpoll, 0); } +int security_uring_cmd(struct io_uring_cmd *ioucmd) +{ + return call_int_hook(uring_cmd, 0, ioucmd); +} #endif /* CONFIG_IO_URING */ From patchwork Mon Aug 22 21:21:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Moore X-Patchwork-Id: 12951403 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 682AAC28D13 for ; Mon, 22 Aug 2022 21:21:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238020AbiHVVVT (ORCPT ); Mon, 22 Aug 2022 17:21:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238063AbiHVVVQ (ORCPT ); Mon, 22 Aug 2022 17:21:16 -0400 Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 203F55208E for ; Mon, 22 Aug 2022 14:21:15 -0700 (PDT) Received: by mail-qk1-x72d.google.com with SMTP id n21so8929410qkk.3 for ; Mon, 22 Aug 2022 14:21:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paul-moore-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:message-id:date:cc:to:from:subject:from:to:cc; bh=TfAr+WtZsNrKIQGkjBb/tfdPalG4u+PDPJ+/5QKn8xM=; b=6NLLC2at5hobLZFMb/PRSHQIazCOxWgouYVmGv9etSZepkU7+Mol1KWuO2tIQMgtn2 899uZRz49DXPgdDGBwQKpV2H3FID/pXUncy8UgFZ0T2fC473arwt0vvUMYMBwskH7Mev yzHDyAjy45x1NM9nGjXXLTyDaFXH+VvpJGNg6Y2XcCDkKGSRbvI2UqLpC7setLR3CNNh +r7xB+roPetL+0c58wMVrDYTznXtTa6BVqgLueF0NKQzbLFKfw/CNGkhqeyO/XkEkGl+ AN2ljaY60XfTDTvBIhJ1QnZBEPWyK5VGy6cAzlekIRJXxZZ4nHnDfW7b14QoFqkKNchu urOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:message-id:date:cc:to:from:subject:x-gm-message-state :from:to:cc; bh=TfAr+WtZsNrKIQGkjBb/tfdPalG4u+PDPJ+/5QKn8xM=; b=sKRrtek0yn7wfD2r72ozaRClApnKjRmmCqi4/UGw2+yNwmLcuxTkxK6j9Zq+ZQoKNv dj180Qlall2QgXNOFLXlzI0uTVhjT62ugU8nuxPIc9egTFqVUmPw+jLB+Ol/iVdzTj7t O0xOO8gKdRC7XD2SIEi+cc40928J8OBuKC+rA5VwCcaKr4BMtiIxkC3vZqhlQqkaYLja BJKO8sIVrkeM113SgmxkcYvEQcm713OEi66oObS7bEfoftBlNZ6kZRyRTQZ4kv0sJe4n ocZ92gRwr64o/ZyCcLLV6NiQ9+2r0zcQ1oFqKDzRuLUrdZt5LWDyRT/9drpUXo5E6bG4 OSpw== X-Gm-Message-State: ACgBeo2lLlcXColwFpvfzZFy0oEAOIidvAa5/YDO3qy7QR4Di9TzpGit nzWAR0V/kkuELaxdOzmpT6au X-Google-Smtp-Source: AA6agR6Trm+m8bjvG4fQ14EYIOo8A5RaBj693BOZCa3YPkrDe2BHnFjHxb/65s6KEWTuVm8/Nnqj0A== X-Received: by 2002:a37:a9d8:0:b0:6ba:be20:48e2 with SMTP id s207-20020a37a9d8000000b006babe2048e2mr13655458qke.301.1661203274726; Mon, 22 Aug 2022 14:21:14 -0700 (PDT) Received: from localhost (pool-96-237-52-46.bstnma.fios.verizon.net. [96.237.52.46]) by smtp.gmail.com with ESMTPSA id dt2-20020a05620a478200b006bb024c5021sm11980198qkb.25.2022.08.22.14.21.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 14:21:14 -0700 (PDT) Subject: [PATCH 2/3] selinux: implement the security_uring_cmd() LSM hook From: Paul Moore To: linux-security-module@vger.kernel.org, selinux@vger.kernel.org, io-uring@vger.kernel.org Cc: Arnd Bergmann , Greg Kroah-Hartman , Luis Chamberlain Date: Mon, 22 Aug 2022 17:21:13 -0400 Message-ID: <166120327379.369593.4939320600435400704.stgit@olly> In-Reply-To: <166120321387.369593.7400426327771894334.stgit@olly> References: <166120321387.369593.7400426327771894334.stgit@olly> User-Agent: StGit/1.5 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org Add a SELinux access control for the iouring IORING_OP_URING_CMD command. This includes the addition of a new permission in the existing "io_uring" object class: "cmd". The subject of the new permission check is the domain of the process requesting access, the object is the open file which points to the device/file that is the target of the IORING_OP_URING_CMD operation. A sample policy rule is shown below: allow :io_uring { cmd }; Cc: stable@vger.kernel.org Fixes: ee692a21e9bf ("fs,io_uring: add infrastructure for uring-cmd") Signed-off-by: Paul Moore --- security/selinux/hooks.c | 24 ++++++++++++++++++++++++ security/selinux/include/classmap.h | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 79573504783b..03bca97c8b29 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -91,6 +91,7 @@ #include #include #include +#include #include "avc.h" #include "objsec.h" @@ -6987,6 +6988,28 @@ static int selinux_uring_sqpoll(void) return avc_has_perm(&selinux_state, sid, sid, SECCLASS_IO_URING, IO_URING__SQPOLL, NULL); } + +/** + * selinux_uring_cmd - check if IORING_OP_URING_CMD is allowed + * @ioucmd: the io_uring command structure + * + * Check to see if the current domain is allowed to execute an + * IORING_OP_URING_CMD against the device/file specified in @ioucmd. + * + */ +static int selinux_uring_cmd(struct io_uring_cmd *ioucmd) +{ + struct file *file = ioucmd->file; + struct inode *inode = file_inode(file); + struct inode_security_struct *isec = selinux_inode(inode); + struct common_audit_data ad; + + ad.type = LSM_AUDIT_DATA_FILE; + ad.u.file = file; + + return avc_has_perm(&selinux_state, current_sid(), isec->sid, + SECCLASS_IO_URING, IO_URING__CMD, &ad); +} #endif /* CONFIG_IO_URING */ /* @@ -7231,6 +7254,7 @@ static struct security_hook_list selinux_hooks[] __lsm_ro_after_init = { #ifdef CONFIG_IO_URING LSM_HOOK_INIT(uring_override_creds, selinux_uring_override_creds), LSM_HOOK_INIT(uring_sqpoll, selinux_uring_sqpoll), + LSM_HOOK_INIT(uring_cmd, selinux_uring_cmd), #endif /* diff --git a/security/selinux/include/classmap.h b/security/selinux/include/classmap.h index ff757ae5f253..1c2f41ff4e55 100644 --- a/security/selinux/include/classmap.h +++ b/security/selinux/include/classmap.h @@ -253,7 +253,7 @@ const struct security_class_mapping secclass_map[] = { { "anon_inode", { COMMON_FILE_PERMS, NULL } }, { "io_uring", - { "override_creds", "sqpoll", NULL } }, + { "override_creds", "sqpoll", "cmd", NULL } }, { NULL } }; From patchwork Mon Aug 22 21:21:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Moore X-Patchwork-Id: 12951404 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D6BAC28D13 for ; Mon, 22 Aug 2022 21:21:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238074AbiHVVVa (ORCPT ); Mon, 22 Aug 2022 17:21:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238068AbiHVVVW (ORCPT ); Mon, 22 Aug 2022 17:21:22 -0400 Received: from mail-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7B3750719 for ; Mon, 22 Aug 2022 14:21:21 -0700 (PDT) Received: by mail-qt1-x836.google.com with SMTP id j17so8964350qtp.12 for ; Mon, 22 Aug 2022 14:21:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paul-moore-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:message-id:date:cc:to:from:subject:from:to:cc; bh=RF5VEJInS+M/9ME7+1NBi/v+S++RwTNIyd06M5yvDic=; b=Bzko282c/NA8xtUH43S/BmgiKEOqxZlc/yiGTmIUFKwBF2/CI4U3o3yimKgsdK3OL5 KepJIP4NU6oFEfrl/HPiHklwqzipd4WdkyqYesfiEprf4U27s8pq5IMpqY4mEn6Yn7Cm eVR7m4BZAZfjGcXIgcay/d3zTFyimGyaEaEfTCMADRb+QplAXF4turAC1XrIvwT+lYFs QT1oGKmV0VbjHUXcKJk086tY+P+t9Cz0N6AQrh6G6dYxpuMnXFE+vh1OG646SjZ84Zdq 3lasui8tN5mOiB78AfFiBPDGRmuZuXGiPDajcUJ0wRsckWUBaLEl2UcobDNNLFJE3h5z 68Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:message-id:date:cc:to:from:subject:x-gm-message-state :from:to:cc; bh=RF5VEJInS+M/9ME7+1NBi/v+S++RwTNIyd06M5yvDic=; b=Hou10KWV8ERMHimWugulN0jIPu38bvYiYqhJGscyPCK0jB9BS0xW8emn1E8ds1V80R ScQSZLn017trhdpCJQ1oZzPxfa0G3MKsaJOcIld1prL1yS9Ijb6SMNMoUj7i1823TvwK kykLUenqqTnh07LjD8lvScUUe6LJG3uWf8kHxMbLx9PvnNyojko5MOHORCzV6EtxJEHB XaZ61USXKQOEX1YcveDg/nCP+N71MRgggS4j5o+OjZG3Dfifg63NBAS2nea8Lm1GLX73 ZJUV/vjPZQyF4L2iZtlg44PRVPET1hPRq/MvZKQkwhSeCmWt8+aF6l5/IkffYPHPD7Lh IkPA== X-Gm-Message-State: ACgBeo0QO/m/pTN49lkNQyOIpFjuvN/5PYAIeK0681LjAJLz5iGJ2dQI X3cTH9Kx8kOTaEMv54NKtRuc X-Google-Smtp-Source: AA6agR7wCUyNXyYxqoTS06r/xS+GyibVxNaJIowJibrZFTJwbR9zhIgL23Ot9xjTsFbhKMW/+DTKKA== X-Received: by 2002:ac8:7f47:0:b0:344:8d2b:14a9 with SMTP id g7-20020ac87f47000000b003448d2b14a9mr16667027qtk.442.1661203280736; Mon, 22 Aug 2022 14:21:20 -0700 (PDT) Received: from localhost (pool-96-237-52-46.bstnma.fios.verizon.net. [96.237.52.46]) by smtp.gmail.com with ESMTPSA id w18-20020ac87e92000000b0033a5048464fsm10188122qtj.11.2022.08.22.14.21.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 14:21:20 -0700 (PDT) Subject: [PATCH 3/3] /dev/null: add IORING_OP_URING_CMD support From: Paul Moore To: linux-security-module@vger.kernel.org, selinux@vger.kernel.org, io-uring@vger.kernel.org Cc: Arnd Bergmann , Greg Kroah-Hartman , Luis Chamberlain Date: Mon, 22 Aug 2022 17:21:19 -0400 Message-ID: <166120327984.369593.8371751426301540450.stgit@olly> In-Reply-To: <166120321387.369593.7400426327771894334.stgit@olly> References: <166120321387.369593.7400426327771894334.stgit@olly> User-Agent: StGit/1.5 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org This patch adds support for the io_uring command pass through, aka IORING_OP_URING_CMD, to the /dev/null driver. As with all of the /dev/null functionality, the implementation is just a simple sink where commands go to die, but it should be useful for developers who need a simple IORING_OP_URING_CMD test device that doesn't require any special hardware. Cc: Arnd Bergmann Cc: Greg Kroah-Hartman Signed-off-by: Paul Moore Acked-by: Jens Axboe --- drivers/char/mem.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/char/mem.c b/drivers/char/mem.c index 84ca98ed1dad..32a932a065a6 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c @@ -480,6 +480,11 @@ static ssize_t splice_write_null(struct pipe_inode_info *pipe, struct file *out, return splice_from_pipe(pipe, out, ppos, len, flags, pipe_to_null); } +static int uring_cmd_null(struct io_uring_cmd *ioucmd, unsigned int issue_flags) +{ + return 0; +} + static ssize_t read_iter_zero(struct kiocb *iocb, struct iov_iter *iter) { size_t written = 0; @@ -663,6 +668,7 @@ static const struct file_operations null_fops = { .read_iter = read_iter_null, .write_iter = write_iter_null, .splice_write = splice_write_null, + .uring_cmd = uring_cmd_null, }; static const struct file_operations __maybe_unused port_fops = {