Skip to content
  • Arnd Bergmann's avatar
    4184da4f
    staging: vchiq: fix __user annotations · 4184da4f
    Arnd Bergmann authored
    
    
    My earlier patches caused some new sparse warnings, but it turns out
    that a number of those are actual bugs, or at least suspicous code.
    
    Adding __user annotations to the data structures that are defined in
    uapi headers helps avoid the new warnings, but that causes a different
    set of warnings to show up, as some of these structures are used both
    inside of the kernel and at the user interface but storing pointers to
    different things there.
    
    Duplicating the vchiq_service_params and vchiq_completion_data structures
    in turn takes care of most of those, and then it turns out that there
    is a 'data' pointer that can be any of a __user address, a dmd_addr_t
    and a kernel pointer in vmalloc space at times.
    
    I'm trying to annotate these as best I can without changing behavior,
    but there still seems to be a serious bug when user space passes
    a valid vmalloc space address instead of a user pointer. Adding
    comments in the code there, and leaving the warnings in place that
    seem to correspond to actual bugs.
    
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    Link: https://lore.kernel.org/r/20200925114424.2647144-1-arnd@arndb.de
    
    
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    4184da4f
    staging: vchiq: fix __user annotations
    Arnd Bergmann authored
    
    
    My earlier patches caused some new sparse warnings, but it turns out
    that a number of those are actual bugs, or at least suspicous code.
    
    Adding __user annotations to the data structures that are defined in
    uapi headers helps avoid the new warnings, but that causes a different
    set of warnings to show up, as some of these structures are used both
    inside of the kernel and at the user interface but storing pointers to
    different things there.
    
    Duplicating the vchiq_service_params and vchiq_completion_data structures
    in turn takes care of most of those, and then it turns out that there
    is a 'data' pointer that can be any of a __user address, a dmd_addr_t
    and a kernel pointer in vmalloc space at times.
    
    I'm trying to annotate these as best I can without changing behavior,
    but there still seems to be a serious bug when user space passes
    a valid vmalloc space address instead of a user pointer. Adding
    comments in the code there, and leaving the warnings in place that
    seem to correspond to actual bugs.
    
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    Link: https://lore.kernel.org/r/20200925114424.2647144-1-arnd@arndb.de
    
    
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Loading