Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3658754rdg; Wed, 18 Oct 2023 02:02:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHBW9ZyxLr1St8j+u/yQk+M3lrz0CAvyqx7aKXvYTLpLOk6cV+v6LTo40y16QaBCGE1fuHg X-Received: by 2002:a05:6a20:4429:b0:126:42ce:bd44 with SMTP id ce41-20020a056a20442900b0012642cebd44mr7030781pzb.17.1697619762027; Wed, 18 Oct 2023 02:02:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697619762; cv=none; d=google.com; s=arc-20160816; b=EJM7n/sbaQ01A7809qGYyAtDMsfVr+lxDJ/tL1oKDP8b8TBeH0GwbavEU2ybKRNMe2 hd1Ocb9TQI5wBNTQFixJNiuQj8WFF9GHNcnxNX5Wjbsv8Kq6WPWQzNj9QnI4w/gExllI Qn0OwJ8Db1EHQvj6ujZHoRAE7drnqzMJffyXG0ByZZeDa1FoK1iShWYfEPDDKkAK43ck nMaP6jNql1kNAWlSRoHd0nm7Qrt+FJBuhTb0yZ6Na5W3RZLEdhFfBDaJHI3NTYe+mJjr 5hslU0sBaDetbRXn+frUN3wgU+1RnKkuzJXUieqQUoxhQAruP4kibcaw5BkQNT5Xgzjp YwYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:date:references:in-reply-to :message-id:mime-version:user-agent:feedback-id:dkim-signature :dkim-signature; bh=/69j3hXZYCUlxIkqapaFj++HVDN18WQt0u8wr2jBqgk=; fh=odzNzxmLU/5gRY92//977QIParckCOqZnARMw4moJSk=; b=HPp6tmKODZvzVT0dxCjT9dzQEesHIJMawpLg8WYmGcyL3ctuYvPqcvhzQArDexA5q9 yaj8JJdL4+S1xyBycgmzhnROtKj6VIwU17bH2d8oejCliO6mL03jsaZkFNtc85+QJe8U l3HBrudmjCtfZ0VfaPmABTyNLOT7RjBzc4yXfHBioQ4zkf7uBULp5H4mzjcFjO4oEyf8 qELOJ5Yt5Lt8ImSVXHYAljEagnLKRUp1N7Pfxk7Tm6DTiWdyPbqAWsYtpgerAvt2kRcG mPcBty27bekasMP5q239gNzz5U/d0qQXnvJ7yUiXlmy02SH1Q1RKMQeKFJ79ulj8jIoc zuTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm2 header.b=sEk8LzaJ; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=UWjoI0Ff; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id b15-20020a63d30f000000b005b81f21a25csi1728444pgg.830.2023.10.18.02.02.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 02:02:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@arndb.de header.s=fm2 header.b=sEk8LzaJ; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=UWjoI0Ff; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id EBFBF80C8DD8; Wed, 18 Oct 2023 02:02:38 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229618AbjJRJC1 (ORCPT + 99 others); Wed, 18 Oct 2023 05:02:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbjJRJCY (ORCPT ); Wed, 18 Oct 2023 05:02:24 -0400 Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE77FEA for ; Wed, 18 Oct 2023 02:02:22 -0700 (PDT) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id D091A3200B11; Wed, 18 Oct 2023 05:02:21 -0400 (EDT) Received: from imap51 ([10.202.2.101]) by compute5.internal (MEProxy); Wed, 18 Oct 2023 05:02:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1697619741; x=1697706141; bh=/6 9j3hXZYCUlxIkqapaFj++HVDN18WQt0u8wr2jBqgk=; b=sEk8LzaJPZfb+m2p5v iCdapM+nd25Yef+7Tk94lj0d9hLBRZlqV1yTvs28bxDadWfxwoOQfADf846T1c8W sPpgG6Io/uHToKsHBIf3wwVpTdLALYNUeAmWolqc+akZ8bTLtaS8kg6Fu/0jt703 mAOWCtkBST7iFTBR75zAfN2r8C1tk+vxesaGCISJIdv9Y6MKMURFd/RC6EjjfO7s ihh1aLnLQGnf0lcWUjo/TDghSxvo1DLWZQuS4m/NJP8RduPIpa5Jut5ezZyLwbQc DgS7C5RS4l+sUknr/+b4T206hCDJ4V8DOYvmIGB/f7NMNI8xfBzY7BDs1SBSEQBj hiug== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1697619741; x=1697706141; bh=/69j3hXZYCUlx IkqapaFj++HVDN18WQt0u8wr2jBqgk=; b=UWjoI0FfU1QSPibA547jAbuotqinO DbIsH+hA36TfmPpjLdzmuW5yj3QWqYfk9JGQEFbKTVT2HovfNwF4SV3SYrY1kZaj RYNELKy20J4mFEiBcSFdyMUI39+Km7nEkXn0OjWJ+aVcBPji7MrKiWm0diFV2XuD xN3nHYialcbmu2US5ZB7Ukg38Bx0/6gxK1ZGTDJxfCkEypM3+4O18LP3C6d28hYL aj8/lTLVUBUemvNFT2RGrJqT+q3ye7LrPIfY0wph4bwu9OHd9niHs6KrntpLryCh oE1xwL8PnjDsHd4jEbkcen9i5FNHwN1ev43jxnGZOqJEYDLFIx8wUhUHw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrjeeggddutdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvvefutgesthdtredtreertdenucfhrhhomhepfdetrhhn ugcuuegvrhhgmhgrnhhnfdcuoegrrhhnugesrghrnhgusgdruggvqeenucggtffrrghtth gvrhhnpeffheeugeetiefhgeethfejgfdtuefggeejleehjeeutefhfeeggefhkedtkeet ffenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrrh hnugesrghrnhgusgdruggv X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 3394DB60089; Wed, 18 Oct 2023 05:02:21 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-1019-ged83ad8595-fm-20231002.001-ged83ad85 MIME-Version: 1.0 Message-Id: <6fb88a6a-dd66-4368-8da9-596f384fe5bc@app.fastmail.com> In-Reply-To: <20231018081941.475277-4-saeed@kernel.org> References: <20231018081941.475277-1-saeed@kernel.org> <20231018081941.475277-4-saeed@kernel.org> Date: Wed, 18 Oct 2023 11:02:00 +0200 From: "Arnd Bergmann" To: "Saeed Mahameed" , "Greg Kroah-Hartman" Cc: linux-kernel@vger.kernel.org, "Leon Romanovsky" , "Jason Gunthorpe" , "Jiri Pirko" , "Saeed Mahameed" Subject: Re: [PATCH 3/5] misc: mlx5ctl: Add info ioctl Content-Type: text/plain X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 18 Oct 2023 02:02:39 -0700 (PDT) On Wed, Oct 18, 2023, at 10:19, Saeed Mahameed wrote: > Implement INFO ioctl to return the allocated UID and the capability flags > and some other useful device information such as the underlying ConnectX > device. I'm commenting on the ABI here, ignoring everything for the moment. > static const struct file_operations mlx5ctl_fops = { > .owner = THIS_MODULE, > .open = mlx5ctl_open, > .release = mlx5ctl_release, > + .unlocked_ioctl = mlx5ctl_ioctl, > }; There should be a .compat_ioctl entry as well, to allow 32-bit tasks to use the same interface. > static int mlx5ctl_probe(struct auxiliary_device *adev, > diff --git a/include/uapi/misc/mlx5ctl.h b/include/uapi/misc/mlx5ctl.h > new file mode 100644 > index 000000000000..81d89cd285fc > --- /dev/null > +++ b/include/uapi/misc/mlx5ctl.h > @@ -0,0 +1,24 @@ > +/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB WITH Linux-syscall-note */ > +/* Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. */ > + > +#ifndef __MLX5CTL_IOCTL_H__ > +#define __MLX5CTL_IOCTL_H__ > + > +struct mlx5ctl_info { > + __aligned_u64 flags; > + __u32 size; > + __u8 devname[64]; /* underlaying ConnectX device */ > + __u16 uctx_uid; /* current process allocated UCTX UID */ I don't know what a UCTX UID is, but if this is related to uid_t, it has to be 32 bit wide. > + __u16 reserved1; > + __u32 uctx_cap; /* current process effective UCTX cap */ > + __u32 dev_uctx_cap; /* device's UCTX capabilities */ > + __u32 ucap; /* process user capability */ > + __u32 reserved2[4]; > +}; If I'm counting right, this structure has a size of 108 bytes but an alignment of 8 bytes, so you end up with a 4-byte hole at the end, which introduces a risk of leaking kernel data. Maybe give it an extra reserved word? Arnd