Subject: Re: linux compat mknod(2) bogon
To: Simon Burge <simonb@wasabisystems.com>
From: Jaromir Dolecek <jdolecek@netbsd.org>
List: tech-kern
Date: 12/17/2002 12:08:44
"Oops". Thanks, looks right.

Jaromir

Simon Burge wrote:
> Hi folks,
> 
> In linux_sys_mknod(), we seem to go to the trouble of hand-crafting a
> native syscall args struct then happily ignore it (for both the mknod
> and mkfifo case).  Does the following diff look right?
> 
> Simon.
> --
> Simon Burge                                   <simonb@wasabisystems.com>
> NetBSD Development, Support and Service:   http://www.wasabisystems.com/
> 
> 
> Index: compat/linux/common/linux_file.c
> ===================================================================
> RCS file: /cvsroot/syssrc/sys/compat/linux/common/linux_file.c,v
> retrieving revision 1.54
> diff -d -p -u -u -6 -r1.54 linux_file.c
> --- compat/linux/common/linux_file.c	2002/12/11 19:30:39	1.54
> +++ compat/linux/common/linux_file.c	2002/12/17 10:42:15
> @@ -684,26 +684,26 @@ linux_sys_mknod(p, v, retval)
>  	 */
>  	if (SCARG(uap, mode) & S_IFIFO) {
>  		struct sys_mkfifo_args bma;
>  
>  		SCARG(&bma, path) = SCARG(uap, path);
>  		SCARG(&bma, mode) = SCARG(uap, mode);
> -		return sys_mkfifo(p, uap, retval);
> +		return sys_mkfifo(p, &bma, retval);
>  	} else {
>  		struct sys_mknod_args bma;
>  
>  		SCARG(&bma, path) = SCARG(uap, path);
>  		SCARG(&bma, mode) = SCARG(uap, mode);
>  		/*
>  		 * Linux device numbers uses 8 bits for minor and 8 bits
>  		 * for major. Due to how we map our major and minor,
>  		 * this just fints into our dev_t. Just mask off the
>  		 * upper 16bit to remove any random junk.
>  		 */
>  		SCARG(&bma, dev) = SCARG(uap, dev) & 0xffff;
> -		return sys_mknod(p, uap, retval);
> +		return sys_mknod(p, &bma, retval);
>  	}
>  }
>  
>  int
>  linux_sys_chmod(p, v, retval)
>  	struct proc *p;
> 


-- 
Jaromir Dolecek <jdolecek@NetBSD.org>            http://www.NetBSD.org/
-=- We should be mindful of the potential goal, but as the tantric    -=-
-=- Buddhist masters say, ``You may notice during meditation that you -=-
-=- sometimes levitate or glow.   Do not let this distract you.''     -=-