Message ID | 20221214-nsfs-ioctl-compat-v3-1-dce2d26e1fec@weissschuh.net |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp3425646wrt; Wed, 11 Jan 2023 08:49:06 -0800 (PST) X-Google-Smtp-Source: AMrXdXuDinB3TooSxll0JLY177SzSE1BcPfPD/LINgucqjHpbwo3leWjfXBkujWky6413BBDvWOv X-Received: by 2002:a17:906:484:b0:7c1:ac8:399 with SMTP id f4-20020a170906048400b007c10ac80399mr61271767eja.55.1673455746508; Wed, 11 Jan 2023 08:49:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673455746; cv=none; d=google.com; s=arc-20160816; b=G12r0tSbd1sMzZNLaK0ley3Fv49S5EYIyToczlRHlCwfFdlH2EoSash8STFihgtvB7 HUspNrspRcRkviSQhf7+JTrZ3dOYeZc+B8wByMv9pOVvHIHOL9zzl6Rix5XJrdpd4F12 84bImxinlY7mn9tJnAKCYLECi/mPtY0pfem5FyjFb0B9PCB5lreVOhxhx4+oS3t82sw+ 00TntQQVjGgc+alguaafcT+NZR/6p6BxUTxixMhoF2Syq5ZN5vTXJ7HT1zZx2xopJoJa HfjkqmJuwLvG+XEwp1GqhYgGfAsJ2CpjA47ozhHLfafbSw93FSg18fzij3d48HaFRCJY ZaNA== 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=nJvCc8PPjvpB2YEdcvM680mw61trYw3Slox3G48aIOGAFa2B9pW2yVFsNMln7LClq+ e2aBueQpuqfKNaLq3x7/hFXB/mk2IFVcpnsIW3/L9iqTbnJMBcd8zFecqaRkQfSk+hNW UrFtyNRZhznrmGpZ3EHfPXXX9hmYP1RUsJuVT/fQTO3hTCKggTJscbHUf+dNtDoVUIWs lVJa2ppEMbkxiS+h9QYEZiP06NYWInbj31e8nZT8EUogc5mu+EQZWE3pMFDa5eHIqJTz tfCv9z4JFEL2o/Exc1KPbFxALkqOdKdAKMuIkNRI8fAZEYgBCnFmiSfYZISKQgaIlIpE OrGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@weissschuh.net header.s=mail header.b=Yc7Axi0+; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sh39-20020a1709076ea700b008361e2a67b2si3729602ejc.0.2023.01.11.08.48.42; Wed, 11 Jan 2023 08:49:06 -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=Yc7Axi0+; 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 S232877AbjAKQqr (ORCPT <rfc822;syz17693488234@gmail.com> + 99 others); Wed, 11 Jan 2023 11:46:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231972AbjAKQqg (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 11 Jan 2023 11:46:36 -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 F358AE014; Wed, 11 Jan 2023 08:46:34 -0800 (PST) From: Thomas =?utf-8?q?Wei=C3=9Fschuh?= <linux@weissschuh.net> DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=weissschuh.net; s=mail; t=1673455592; bh=LXP8YNxMczzf+pLAFEBraHS71TcH5D0s/f2HVc8xxo4=; h=From:Date:Subject:To:Cc:From; b=Yc7Axi0+ryvHb7W5TZEecULFxIr2/k+ULGBcJLv9MmdtQxO+I2KUWWZhT+VjMwDhh AuhOjhBzWEPa37T9RGGPkGImtbwdT0GKR92tM6q+85o807NPlBRqR5TU2Xa3osqSOC IEFMfTOd6P1rWxkPurgdnJC4vi+5VxrlFP3enSU8= Date: Wed, 11 Jan 2023 16:46:30 +0000 Subject: [PATCH RESEND 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-dce2d26e1fec@weissschuh.net> To: Alexander Viro <viro@zeniv.linux.org.uk>, Andrey Vagin <avagin@openvz.org>, "Eric W. Biederman" <ebiederm@xmission.com>, Serge Hallyn <serge@hallyn.com> Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Karel Zak <kzak@redhat.com>, Thomas =?utf-8?q?Wei=C3=9Fschuh?= <linux@weissschuh.net> X-Mailer: b4 0.11.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1673455590; l=1768; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=LXP8YNxMczzf+pLAFEBraHS71TcH5D0s/f2HVc8xxo4=; b=ZgToiTDahdoWp0LhjVZMSRvT+AAWvdKPw60kow4YX/v6R6SPspt8FjTS/3efh5vLpJ83nXZvASoX nyhNP5wUAJRM+BuYiO+2gubO1tKh+erPxDYgV+xtmNS40ENURsj3 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754745367029864759?= X-GMAIL-MSGID: =?utf-8?q?1754745532824355299?= |
Series |
[RESEND,v3] nsfs: add compat ioctl handler
|
|
Commit Message
Thomas Weißschuh
Jan. 11, 2023, 4:46 p.m. UTC
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 <kzak@redhat.com>
Link: https://github.com/util-linux/util-linux/pull/1924#issuecomment-1344133656
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
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(+)
---
base-commit: f9ff5644bcc04221bae56f922122f2b7f5d24d62
change-id: 20221214-nsfs-ioctl-compat-1548bf6581a7
Best regards,
Comments
On Wed, Jan 11, 2023 at 04:46:30PM +0000, Thomas Weißschuh wrote: > 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 <kzak@redhat.com> > Link: https://github.com/util-linux/util-linux/pull/1924#issuecomment-1344133656 > Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Applied...
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)