lkml.org 
[lkml]   [2015]   [Dec]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectAccessing user-land memory without safe functions
Date
I Have been auditing a few drivers and have found some of them are
accessing user-land memory without either mapping the pages in, or
copying the data via the safe user access apis.

The thing I have mostly been seeing is something along the lines of:

ioctl(etc, etc, arg) {

char buf[32];
__user *some_struct = (type cast) arg;

size_t amount = some_struct->amount;

** do size check on amount **

copy_from_user(buf, some_struct->some_uland_addr, amount);

}


Above you see 2 unsafe user-land dereferences, the
some_struct->amount and some_struct->some_uland_addr.


Since I've seen this a couple times now I'm wondering if my
understanding of touching user-land memory is flawed.

For the above example Ioctl, the proper way to get access to those fields
through the safe copy_from_user or get_user() functions, correct?

I'm wondering if I should submit patches to fix the issues I've found,
but now I'm doubting whether they're really issues at all.

Thanks,
Scotty


\
 
 \ /
  Last update: 2015-12-03 22:21    [W:0.055 / U:0.176 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site