• Daniel Vetter's avatar
    drm: hollow-out GET_CLIENT ioctl · 719524df
    Daniel Vetter authored
    We not only have debugfs files to do pretty much the equivalent of
    lsof, we also have an ioctl. Not that compared to lsof this dumps a
    wee bit more information, but we can still get at that from debugfs
    easily.
    
    I've dug around in mesa, libdrm and ddx histories and the only users
    seem to be drm/tests/dristat.c and drm/tests/getclients.c. The later
    is a testcase for the ioctl itself since up to
    
    commit b018fcda
    Author: Eric Anholt <eric@anholt.net>
    Date:   Thu Nov 22 18:46:54 2007 +1000
    
        drm: Make DRM_IOCTL_GET_CLIENT return EINVAL when it can't find client #idx
    
    there was actually no way at all for userspace to enumerate all
    clients since the kernel just wouldn't tell it when to stop. Which
    completely broke it's only user, dristat -c.
    
    So obviously that ioctl wasn't much use for debugging. Hence I don't
    see any point in keeping support for a tool which was pretty obviously
    never really used, and while we have good replacements in the form of
    equivalent debugfs files.
    
    Still, to keep dristat -c from looping forever again stop it early by
    returning an unconditional -EINVAL. Also add a comment in the code
    about why.
    
    v2: Slightly less hollowed-out implementation. libva uses GET_CLIENTS
    to figure out whether the fd it has is already authenticated or not.
    So we need to keep that part of things working. Simplest way is to
    just return one entry to keep va_drm_is_authenticated in
    libva/va/drm/va_drm_auth.c working.
    
    This is exercised by igt/drm_get_client_auth which contains a
    copypasta of the libva auth check code.
    
    Cc: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
    Cc: David Herrmann <dh.herrmann@gmail.com>
    Reviewed-by: default avatarDavid Herrmann <dh.herrmann@gmail.com>
    Reviewed-by: default avatarEric Anholt <eric@anholt.net>
    Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
    Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
    719524df
drm_ioctl.c 9.41 KB