Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp9751368rwl; Wed, 11 Jan 2023 09:27:52 -0800 (PST) X-Google-Smtp-Source: AMrXdXtL8mYS6/vtACeBy1+A+yOfuDynol0lsMer17K7wAQiQLfNVz6CkmZXrgdtu51n0Q5Jx4WE X-Received: by 2002:aa7:cad0:0:b0:492:8207:f2ba with SMTP id l16-20020aa7cad0000000b004928207f2bamr19348493edt.1.1673458072708; Wed, 11 Jan 2023 09:27:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673458072; cv=none; d=google.com; s=arc-20160816; b=O6lAAEiMN5FzwPNIDkzC8jn9YL6f2cWoEcqX0dHpQZ1SyzNnKbiEPO1MGQPc5uCRMU y2jDN93OUjiwJEQq9L+STQm004bhPbKNHCesAYI/DzZNk0NdwzVqF4Piuj+MI5EdST/4 5XebOFSEWQdaSgzYXGHkP9Uk3munwiTwWfj/X883ptEk4UlrNKLorkz4WYtjnGKvgKLi WwX8gunlUDTnCuJTehhn3Uu3VUwZCLv93uDU9mMj0LBNZmLjvFFHPbYerS+0F96gmm7y 6U5UJZh7hpZSNYT+UMwrFt36skeDZvN/IJM18mE3ALgsSPBsRrWYdiBdJGawXP17M9K0 L9uQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:message-id:content-transfer-encoding :mime-version:subject:date:dkim-signature:from; bh=fCBEtYuqDeCSQ8JCZHSutg1FRpD4EjPHrFV/rwVBwwc=; b=eScumKuxUFsetkvXje0pI1FVfkNXe+3+T+8fOInzu1kgNMfiefyrcKWybns4BjYOhG iouoWtE8aNekiIJgln+qgqQ/SGJo6WxoIeqMjDsohsCTqPYx1L2OD+T1Z+D7Vi9nAPMq 8svPcmAsgdop4W5Q1N0UAcclhGlMLJGB8BvmWSFmjeVH+Y4u9V1tPpE4NzA+lIqrCz4T HhnfXI+RYUe9FChDAWxnHtIs74nvZpLeqbRInVu87D+93TeOIvNswYLb0QZT2oVgjPzq 3Oq1jcxn4bv4eWgHVHvYy/H06KuySM4TbIomR5WN64AvT1Le6JrjIpEFlfY0e15SzXcv VOJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@weissschuh.net header.s=mail header.b=uC9H5QXx; 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 y22-20020a056402359600b00461dc830100si17974882edc.452.2023.01.11.09.27.39; Wed, 11 Jan 2023 09:27:52 -0800 (PST) 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=fail header.i=@weissschuh.net header.s=mail header.b=uC9H5QXx; 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 S229833AbjAKQnX (ORCPT + 51 others); Wed, 11 Jan 2023 11:43:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234628AbjAKQmm (ORCPT ); Wed, 11 Jan 2023 11:42:42 -0500 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0ECC6164B4; Wed, 11 Jan 2023 08:42:13 -0800 (PST) From: Thomas =?utf-8?q?Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=weissschuh.net; s=mail; t=1673455331; bh=oPHeqffJWnugBEy5BfA0S5pz/LFEC+mvhbSZ1LgHT58=; h=From:Date:Subject:To:Cc:From; b=uC9H5QXx7fmv+zhsei6EGCF/6P/ONA27ENwGoqmlOvXE491AVx4VG+fYsmyTxdToD smpW96FSWIu3Ql0VweMOclcGL4zNUzBfeQ2rqr1rtqPm+hlwsNk1PIvX15W0QT3a7W rwA3pQ0yLvFXXhGlvdBvGtCP5Ixol6EzzqdQC1mo= Date: Wed, 11 Jan 2023 16:42:07 +0000 Subject: [PATCH RESEND] nsfs: add compat ioctl handler MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-Id: <20221214-nsfs-ioctl-compat-v1-1-3180bf297a02@weissschuh.net> To: Alexander Viro , Andrey Vagin , "Eric W. Biederman" , Serge Hallyn Cc: Karel Zak , Thomas =?utf-8?q?Wei=C3=9Fschuh?= , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.11.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1673455329; l=1998; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=oPHeqffJWnugBEy5BfA0S5pz/LFEC+mvhbSZ1LgHT58=; b=tzvA9e99k86pJFluK36zg2SRWMLBn1EeQhsLRb6yMGnq59eSxNS8B/XA0kkQdc3HO7R7O5l+XtQA b3I2140ODuPWNtO7N2RYz5akkOlebbCFDv3vLRnsBcIZVTaCd2Wu X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 As all parameters and return values of the ioctls have the same representation on both 32bit and 64bit we can reuse the normal ioctl handler for the compat handler. All nsfs ioctls return a plain "int" filedescriptor which is a signed 4-byte integer type on both 32bit and 64bit. The only parameter taken is by NS_GET_OWNER_UID and is a pointer to a "uid_t" which is a 4-byte unsigned integer type on both 32bit and 64bit. Fixes: 6786741dbf99 ("nsfs: add ioctl to get an owning user namespace for ns file descriptor") Reported-By: Karel Zak Signed-off-by: Thomas Weißschuh --- As all parameters and return values of the ioctls have the same representation on both 32bit and 64bit we can reuse the normal ioctl handler for the compat handler. All nsfs ioctls return a plain "int" filedescriptor which is a signed 4-byte integer type on both 32bit and 64bit. The only parameter taken is by NS_GET_OWNER_UID and is a pointer to a "uid_t" which is a 4-byte unsigned integer type on both 32bit and 64bit. --- To: Alexander Viro To: Andrey Vagin To: "Eric W. Biederman" To: Serge Hallyn Cc: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: Karel Zak --- fs/nsfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/nsfs.c b/fs/nsfs.c index 3506f6074288..4d2644507364 100644 --- a/fs/nsfs.c +++ b/fs/nsfs.c @@ -21,6 +21,7 @@ static long ns_ioctl(struct file *filp, unsigned int ioctl, static const struct file_operations ns_file_operations = { .llseek = no_llseek, .unlocked_ioctl = ns_ioctl, + .compat_ioctl = ns_ioctl, }; static char *ns_dname(struct dentry *dentry, char *buffer, int buflen) --- base-commit: f9ff5644bcc04221bae56f922122f2b7f5d24d62 change-id: 20221214-nsfs-ioctl-compat-1548bf6581a7 Best regards, -- Thomas Weißschuh