All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/2] init: make sure syscall arguments are marked __user where needed
@ 2012-04-17  0:33 H Hartley Sweeten
  2012-04-20 23:00 ` Andrew Morton
  0 siblings, 1 reply; 5+ messages in thread
From: H Hartley Sweeten @ 2012-04-17  0:33 UTC (permalink / raw)
  To: Linux Kernel; +Cc: akpm

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.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Andrew Morton <akpm@linux-foundation.org>

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(-)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC PATCH 0/2] init: make sure syscall arguments are marked __user where needed
  2012-04-17  0:33 [RFC PATCH 0/2] init: make sure syscall arguments are marked __user where needed H Hartley Sweeten
@ 2012-04-20 23:00 ` Andrew Morton
  2012-04-21  0:05   ` H Hartley Sweeten
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2012-04-20 23:00 UTC (permalink / raw)
  To: H Hartley Sweeten; +Cc: Linux Kernel

On Mon, 16 Apr 2012 17:33:23 -0700
H Hartley Sweeten <hartleys@visionengravers.com> wrote:

> 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.

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?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [RFC PATCH 0/2] init: make sure syscall arguments are marked __user where needed
  2012-04-20 23:00 ` Andrew Morton
@ 2012-04-21  0:05   ` H Hartley Sweeten
  2012-04-21  0:43     ` Andrew Morton
  0 siblings, 1 reply; 5+ messages in thread
From: H Hartley Sweeten @ 2012-04-21  0:05 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linux Kernel

In Friday, April 20, 2012 4:01 PM, Andrew Morton wrote:
> 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 __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.
>
> This makes rather a mess of do_mounts.c for pretty marginal benefit.

Well... That's why it was a RFC... ;-)

> 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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC PATCH 0/2] init: make sure syscall arguments are marked __user where needed
  2012-04-21  0:05   ` H Hartley Sweeten
@ 2012-04-21  0:43     ` Andrew Morton
  2012-04-21  0:46       ` H Hartley Sweeten
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2012-04-21  0:43 UTC (permalink / raw)
  To: H Hartley Sweeten; +Cc: Linux Kernel

On Fri, 20 Apr 2012 19:05:46 -0500 H Hartley Sweeten <hartleys@visionengravers.com> wrote:

> > 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.

That looks nice and explicit.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [RFC PATCH 0/2] init: make sure syscall arguments are marked __user where needed
  2012-04-21  0:43     ` Andrew Morton
@ 2012-04-21  0:46       ` H Hartley Sweeten
  0 siblings, 0 replies; 5+ messages in thread
From: H Hartley Sweeten @ 2012-04-21  0:46 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linux Kernel

On Friday, April 20, 2012 5:43 PM, Andrew Morton wrote:
> On Fri, 20 Apr 2012 19:05:46 -0500 H Hartley Sweeten wrote:
>
>>> 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.
>
> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-04-21  0:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-17  0:33 [RFC PATCH 0/2] init: make sure syscall arguments are marked __user where needed H Hartley Sweeten
2012-04-20 23:00 ` Andrew Morton
2012-04-21  0:05   ` H Hartley Sweeten
2012-04-21  0:43     ` Andrew Morton
2012-04-21  0:46       ` H Hartley Sweeten

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.