init: make sure syscall arguments are marked __user where needed
cover init: make sure syscall arguments are marked __user where needed
When using syscall routines in the kernel, some of the arguments should be user pointers but are missing the __user markup. This produces a number of sparse warnings of the format:
warning: incorrect type in argument 1 (different address spaces)
expected char [noderef] <asn:1>*dev_name
got char *name
Wrap the syscall routines in the private do_mounts.h header so that the appropriate __user markups are added for the init mount code.
init: introduce private syscall wrappers for non-user space pointers
init: use private syscall wrappers for non-user space pointers
init/do_mounts.c | 14 +++--- init/do_mounts.h | 107 ++++++++++++++++++++++++++++++++++++++++++++++- init/do_mounts_initrd.c | 28 ++++++------ init/do_mounts_md.c | 6 +- init/do_mounts_rd.c | 22 +++++----- init/initramfs.c | 54 ++++++++++++----------- init/noinitramfs.c | 9 ++-- 7 files changed, 173 insertions(+), 67 deletions(-)
Quoted 10 lines · On Mon, 16 Apr 2012 17:33:23 -0700 H Hartley Sweeten…
When using syscall routines in the kernel, some of the arguments should be user pointers but are missing the
__usermarkup. This produces a number of sparse warnings of the format:warning: incorrect type in argument 1 (different address spaces)
expected char [noderef] <asn:1>*dev_name
got char *nameWrap the syscall routines in the private
do_mounts.hheader so that the appropriate__usermarkups are added for the init mount code.
This makes rather a mess of do_mounts.c for pretty marginal benefit.
Can we just make "make C=1" skip that file or something?
Quoted 6 lines · Andrew Morton
Quoted 4 lines · On Mon, 16 Apr 2012 17:33:23 -0700 H Hartley Sweeten wrote:
When using syscall routines in the kernel, some of the arguments should be user pointers but are missing the
__usermarkup. This produces a number of sparse warnings of the format:
Quoted 8 lines
Quoted 6 lines
warning: incorrect type in argument 1 (different address spaces)
expected char [noderef] <asn:1>*dev_name
got char *nameWrap the syscall routines in the private
do_mounts.hheader so that the appropriate__usermarkups are added for the init mount code.This makes rather a mess of
do_mounts.cfor pretty marginal benefit.
Well... That's why it was a RFC... ;-)
Quoted 1 line
Can we just make "make C=1" skip that file or something?
What about putting something like this at the top of the files:
/*
* Many of the syscalls used in this file expect some of the arguments
* to be __user pointers not __kernel pointers. To limit the sparse
* noise, turn off sparse checking for this file.
*/
#ifdef __CHECKER__
#undef __CHECKER__
#warning "Sparse checking disabled for this file"
#endif
Maybe without the warning if it doesn't seem necessary.
This keeps <linux/compiler.h> from defining the __attribute__* checks.
Regards,
Hartley
Quoted 16 lines · On Fri, 20 Apr 2012 19:05:46 -0500 H Hartley Sweeten…
Quoted 1 line
Can we just make "make C=1" skip that file or something?
What about putting something like this at the top of the files:
/*
* Many of the syscalls used in this file expect some of the arguments
* to be__userpointers not__kernelpointers. To limit the sparse
* noise, turn off sparse checking for this file.
*/
#ifdef__CHECKER__
#undef__CHECKER__
#warning "Sparse checking disabled for this file"
#endif
Quoted 3 lines
Maybe without the warning if it doesn't seem necessary.
This keeps <
linux/compiler.h> from defining the __attribute__* checks.
That looks nice and explicit.
Quoted 18 lines · Andrew Morton
Quoted 16 lines · On Fri, 20 Apr 2012 19:05:46 -0500 H Hartley Sweeten wrote:
Quoted 1 line
Can we just make "make C=1" skip that file or something?
What about putting something like this at the top of the files:
/*
* Many of the syscalls used in this file expect some of the arguments
* to be__userpointers not__kernelpointers. To limit the sparse
* noise, turn off sparse checking for this file.
*/
#ifdef__CHECKER__
#undef__CHECKER__
#warning "Sparse checking disabled for this file"
#endif
Quoted 5 lines
Quoted 3 lines
Maybe without the warning if it doesn't seem necessary.
This keeps <
linux/compiler.h> from defining the __attribute__* checks.That looks nice and explicit.
Another option would be to just undef the __user and __kernel checks. That way the other sparse checks should still work.
I'll post an updated patch with the #undef __CHECKER__ method shortly.
Regards,
Hartley