Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp2500079rwj; Mon, 19 Dec 2022 05:32:40 -0800 (PST) X-Google-Smtp-Source: AA0mqf7pRYQoGSGzsRC+cztW6r6Slb8X7Hw1sxtA9jmbaYnkWnP4nNN7B+vMrbnj8wmMuxlJfcga X-Received: by 2002:a17:90a:c788:b0:219:49c6:5385 with SMTP id gn8-20020a17090ac78800b0021949c65385mr44334921pjb.45.1671456760365; Mon, 19 Dec 2022 05:32:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671456760; cv=none; d=google.com; s=arc-20160816; b=xRwFGHkJjl1T+VPYkHqe/q7FnlEJ2y8TQKRau7MMf68WrjZ6SLezD3br2z7+JgIzGx OvFE+2dpwLWbOhgxUdQEX1WtiR3MRXBBBiiCpC+fKtxbvxl6jvL2UX81or1g359ycMwV c/rGMssoCyZqqHqWd7hMNtMOZYe0C0Db1W8Qa5MQMHTkAMd6xIuCpLBzeICuGcDxb14K aAQqDI1p75XAWOGBWrf/2BlqeeNHILDGuYqNHniZY6IbwGhEPXVpJg1s+8oXVtUDcDK8 XWFuHjZSHjgwKuTMXqDzvPi0vMT8sYq0TMo0cqgGQlaftfWPzok58OHXMhP1+7tNOmUt LSCw== 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=5TbJOYAky7lYMlLFZHLO4RBS9Vf8WzfuYJ8EExbV3q0=; b=LIuLRExwJcZA8XuMk0u/wVCpryr4yBhLfuaHB+TKYZCWh6tKgDJjFO4vUYo/eYoQdW z3so1QaFR40BZspp39UnT2rDHPTGXUHaD0aK1yAhRsTUkMCh94Owiyhu+QegEkV6C+8P MEKmBSDAQcptge6/nDdemsDyWz0cDuj0MBAxf38r9cNHNeq0eFmDwlEhIfuySn4Uek/z a9cZfrWedkoF5bWCZcxQVPyF2iwRv5RP4T0USiUgKGMYaOA+JCDNrDIRoSCFvZwTIySN NmfKyWSgH5lJpHaM8Ct3S3T2aXW9Gw7vKfxs3dFMCc17pQm5d+nbMHjDYxAgQg1w464z LLUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@weissschuh.net header.s=mail header.b=Rwnr78Y9; 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 mv24-20020a17090b199800b0021859b5fe8asi10115935pjb.145.2022.12.19.05.32.28; Mon, 19 Dec 2022 05:32:40 -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=Rwnr78Y9; 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 S231812AbiLSNAr (ORCPT + 71 others); Mon, 19 Dec 2022 08:00:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231292AbiLSNAn (ORCPT ); Mon, 19 Dec 2022 08:00:43 -0500 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E494612B; Mon, 19 Dec 2022 05:00:40 -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=1671454839; bh=LXP8YNxMczzf+pLAFEBraHS71TcH5D0s/f2HVc8xxo4=; h=From:Date:Subject:To:Cc:From; b=Rwnr78Y9jfXzdcmkxygZwu95fm9+vfXTRkow+2qgz3mbjfKlU0XXr05lUjAj4NdCG L1ykEBJDjcDajDxRwD7rnMIjud/KujFSohf+xLxxVepyCh2T9yJQ1HxMGG/Fi9tVTR Dr+Ow3J0tTlKs3rzJK7BqxUhcL9SF4Qp0j7pDM00= Date: Mon, 19 Dec 2022 13:00:34 +0000 Subject: [PATCH v3] 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-v3-1-b7f0eb7ccdd0@weissschuh.net> X-B4-Tracking: v=1; b=H4sIAHJgoGMC/4WOQQ6CMBBFr0K6tqbTQguuvIdx0ZZim2BrGMAYw t0tLjWR1eT/5L0/C0E3BIfkVCxkcHPAkGIO4lAQ63W8ORranAlnnAOHkkbskIZkx57adH/okUJV 1qaTVQ1akcwZjY6aQUfrMxmnvs+lDzim4fXZmSGfyz/lDJTRWqiuBaeUaevz0wVEtH7yx+jGbWY PNyAb1UjGmOHf+DXzM9/9gm8a3lTGiAZEJ38067q+ASgwZ45CAQAA To: Alexander Viro , Andrey Vagin , "Eric W. Biederman" , Serge Hallyn Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Karel Zak , Thomas =?utf-8?q?Wei=C3=9Fschuh?= X-Mailer: b4 0.11.0-dev-e429b X-Developer-Signature: v=1; a=ed25519-sha256; t=1671454836; l=1768; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=LXP8YNxMczzf+pLAFEBraHS71TcH5D0s/f2HVc8xxo4=; b=2gw9Voe7WdS31apTPWwDknLxyefznbIjUh+p5EDw3UsHntsLl2MoJyz8yQNxCJd8WpeYr6tPuoa/ JXy7VWNLCOnCmbpuJnqf1Hy9TMT05hjvRfgGbxwRR6TUGXJUNKZ3 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 via compat_ptr_ioctl(). 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 Link: https://github.com/util-linux/util-linux/pull/1924#issuecomment-1344133656 Signed-off-by: Thomas Weißschuh --- Changes in v3: - Resend without changes v1 and v2 did not reach the mailing lists due to an issue in my mail setup - Link to v2: https://lore.kernel.org/r/20221214-nsfs-ioctl-compat-v2-0-b295bb3913f6@weissschuh.net Changes in v2: - Use compat_ptr_ioctl() - Link to v1: https://lore.kernel.org/r/20221214-nsfs-ioctl-compat-v1-0-b169796000b2@weissschuh.net --- fs/nsfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/nsfs.c b/fs/nsfs.c index 3506f6074288..c28f69edef97 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 = compat_ptr_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