Re: [PATCH] cifs: add IOCTL for QUERY_INFO passthrough to userspace

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The ABI, and the structure, changed from previous patches.

I send a new/updated smbinfo command for the new ABI:
https://www.spinics.net/lists/linux-cifs/msg15281.html

Can you try that ?


regards
ronnie sahlberg

On Thu, Oct 4, 2018 at 9:31 PM Aurélien Aptel <aaptel@xxxxxxxx> wrote:
>
> Ronnie Sahlberg <lsahlber@xxxxxxxxxx> writes:
> > This allows userspace tools to query the raw info levels for cifs files
> > and process the response in userspace.
> > In particular this is useful for many of those data where there is no
> > corresponding native data structure in linux.
> > For example querying the security descriptor for a file and extract the
> > SIDs.
> >
> > Signed-off-by: Ronnie Sahlberg <lsahlber@xxxxxxxxxx>
> > ---
> >  fs/cifs/cifs_ioctl.h | 11 +++++++
> >  fs/cifs/cifsglob.h   |  4 +++
> >  fs/cifs/ioctl.c      | 21 +++++++++++++
> >  fs/cifs/smb2inode.c  |  2 +-
> >  fs/cifs/smb2ops.c    | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++-
> >  fs/cifs/smb2pdu.c    | 16 +++++-----
> >  fs/cifs/smb2proto.h  |  3 +-
> >  7 files changed, 132 insertions(+), 11 deletions(-)
>
> I couldn't apply it on for-next directly, it requires your compounding
> changes (minus 2 patches already in there).
>
> I have applied and built both patches in their respective repo but I run
> into an issue. The ioctl id doesn't match. I've added a debug print of
> CIFS_QUERY_INFO (expected) along with the command received.
>
>
> $ smbinfo quota file
> fs/cifs/inode.c: CIFS VFS: in cifs_revalidate_dentry_attr as Xid: 8 with uid: 0
> fs/cifs/dir.c: name: \file
> fs/cifs/inode.c: Update attributes: \file inode 0x(____ptrval____) count 1 dentry: 0x(____ptrval____) d_time 0 jiffies 4294893374
> fs/cifs/inode.c: Getting info on \file
> fs/cifs/smb2misc.c: Calculated size 153 length 152 mismatch mid 23
> fs/cifs/inode.c: cifs_revalidate_cache: revalidating inode 23949104
> fs/cifs/inode.c: cifs_revalidate_cache: invalidating inode 23949104 mapping
> fs/cifs/inode.c: CIFS VFS: leaving cifs_revalidate_dentry_attr (xid = 8) rc = 0
> fs/cifs/file.c: CIFS VFS: in cifs_open as Xid: 9 with uid: 0
> fs/cifs/dir.c: name: \file
> fs/cifs/file.c: inode = 0x(____ptrval____) file flags are 0x8000 for \file
> fs/cifs/smb2pdu.c: create/open
> fs/cifs/smb2pdu.c: Query Info
> fs/cifs/inode.c: Getting info on \file
> fs/cifs/inode.c: cifs_revalidate_cache: revalidating inode 23949104
> fs/cifs/inode.c: cifs_revalidate_cache: inode 23949104 is unchanged
> fs/cifs/smb2ops.c: RHW Lease granted on inode (____ptrval____)
> fs/cifs/file.c: CIFS VFS: leaving cifs_open (xid = 9) rc = 0
> fs/cifs/ioctl.c: CIFS VFS: in cifs_ioctl as Xid: 10 with uid: 0
> fs/cifs/ioctl.c: cifs ioctl 0xc018cf07
> fs/cifs/ioctl.c: cifs ioctl 0xc010cf07 <--expected
> fs/cifs/ioctl.c: unsupported ioctl
> fs/cifs/ioctl.c: CIFS VFS: leaving cifs_ioctl (xid = 10) rc = -25
> ioctl failed with Inappropriate ioctl for device
> fs/cifs/file.c: Flush inode (____ptrval____) file (____ptrval____) rc 0
> fs/cifs/file.c: closing last open instance for inode (____ptrval____)
> fs/cifs/file.c: CIFS VFS: in cifsFileInfo_put as Xid: 11 with uid: 0
> fs/cifs/smb2pdu.c: Close
>
> $ smbinfo secdesc file
> fs/cifs/file.c: CIFS VFS: in cifs_open as Xid: 12 with uid: 0
> fs/cifs/dir.c: name: \file
> fs/cifs/file.c: inode = 0x(____ptrval____) file flags are 0x8000 for \file
> fs/cifs/smb2pdu.c: create/open
> fs/cifs/smb2pdu.c: Query Info
> fs/cifs/inode.c: Getting info on \file
> fs/cifs/inode.c: cifs_revalidate_cache: revalidating inode 23949104
> fs/cifs/inode.c: cifs_revalidate_cache: inode 23949104 is unchanged
> fs/cifs/smb2ops.c: RHW Lease granted on inode (____ptrval____)
> fs/cifs/file.c: CIFS VFS: leaving cifs_open (xid = 12) rc = 0
> fs/cifs/ioctl.c: CIFS VFS: in cifs_ioctl as Xid: 13 with uid: 0
> fs/cifs/ioctl.c: cifs ioctl 0xc018cf07
> fs/cifs/ioctl.c: cifs ioctl 0xc010cf07 <--expected
> fs/cifs/ioctl.c: unsupported ioctl
> fs/cifs/ioctl.c: CIFS VFS: leaving cifs_ioctl (xid = 13) rc = -25
> ioctl failed with Inappropriate ioctl for device
> fs/cifs/file.c: Flush inode (____ptrval____) file (____ptrval____) rc 0
> fs/cifs/file.c: closing last open instance for inode (____ptrval____)
> fs/cifs/file.c: CIFS VFS: in cifsFileInfo_put as Xid: 14 with uid: 0
> fs/cifs/smb2pdu.c: Close
>
> kernel CIFS_QUERY_INFO  is 0xc010cf07
> smbinfo CIFS_QUERY_INFO is 0xc018cf07
>
> Yet they are defined the same way:
>
> #define CIFS_QUERY_INFO _IOWR(CIFS_IOCTL_MAGIC, 7, struct smb_query_info)
>
> Turns out the reason is because _IOWR uses the size of the struct and
> the struct do not match:
>
> >
> > +struct smb_query_info {
> > +     __u32   info_type;
> > +     __u32   file_info_class;
> > +     __u32   additional_information;
> > +     __u32   flags;
> > +     __u32   input_buffer_length;
> > +     __u32   output_buffer_length;
> > +     /* char buffer[]; */
> > +} __packed;
>
> VS
>
> > +struct smb_query_info {
> > +     __u32   buffer_length;
> > +     __u32   info_type;
> > +     __u32   file_info_class;
> > +     __u32   additional_information;
> > +     /* char buffer[]; */
> > +} __packed;
>
> I think you send the wrong kernel patch? Or you forgot to update something.
>
> Cheers,
> --
> Aurélien Aptel / SUSE Labs Samba Team
> GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
> SUSE Linux GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
> GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)




[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux