[lkml]   [2018]   [Jul]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH upstream] KASAN: slab-out-of-bounds Read in getname_kernel

I've looked into this issue found by Syzbot and I made a patch:

The autofs subsystem does not check that the "path" parameter is present
within the "param" struct passed by the userspace in case the
AUTOFS_DEV_IOCTL_OPENMOUNT_CMD command is passed. Indeed, it assumes a
path is always provided (though a path is not always present, as per how
the struct is defined:
Skipping the check provokes an oob read in "strlen", called by
"getname_kernel", in turn called by the autofs to assess the length of
the non-existing path.

To solve it, modify the "validate_dev_ioctl" function to check also that
a path has been provided if the command is AUTOFS_DEV_IOCTL_OPENMOUNT_CMD.

--- b/fs/autofs/dev-ioctl.c    2018-07-01 23:10:16.059728621 +0200
+++ a/fs/autofs/dev-ioctl.c    2018-07-01 23:10:24.311792133 +0200
@@ -136,6 +136,9 @@ static int validate_dev_ioctl(int cmd, s
             goto out;
+    /* AUTOFS_DEV_IOCTL_OPENMOUNT_CMD without path */
+        return -EINVAL;
     err = 0;

Tested and solves the issue on Linus' main git tree.


 \ /
  Last update: 2018-07-02 00:05    [W:0.107 / U:4.484 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site