lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 27 Jun 2011 10:19:44 +0900
From:	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
To:	"FJCL) 荻野 大輔" 
	<ogino.daisuke@...fujitsu.com>
Cc:	linux-kernel@...r.kernel.org, linux-pci@...r.kernel.org,
	adobriyan@...il.com, linux-fsdevel@...r.kernel.org
Subject: Re: [patch] procfs: returns ENOENT on opening the being-removed
 proc entry

On Fri, 24 Jun 2011 10:48:08 +0900
"FJCL) 荻野 大輔" <ogino.daisuke@...fujitsu.com> wrote:

> From: Daisuke Ohino <ogino.daisuke@...fujitsu.com>
> 
> opening the proc entry may return EINVAL if the entry is being removed, for
> example open("/proc/bus/pci/XX/YY") during the corresponding device is being
> hot-removed. The return value is inappropriate and should return ENOENT.
> 
> This return value comes from proc_reg_open().
> 
> fs/proc/inode.c:
> -----------------------------------------------------------
> static int proc_reg_open(struct inode *inode, struct file *file)
> {
> (snip)
>         if (!pde->proc_fops) {
>                 spin_unlock(&pde->pde_unload_lock);
>                 kfree(pdeo);
>                 return -EINVAL;
>         }
> (snip)
> -----------------------------------------------------------
> 
> pde->proc_fops is NULL iff the proc entry is being removed. It
> is set by remove_proc_entry().
> 
> -----------------------------------------------------------
> void remove_proc_entry(const char *name, struct proc_dir_entry*parent)
> {
> (snip)
>         /*
>          * Stop accepting new callers into module. If you're
>          * dynamically allocating ->proc_fops, save a pointer somewhere.
>          */
>         de->proc_fops = NULL;
> (snip)
> -----------------------------------------------------------
> 
> But POSIX says:
> 
> -----------------------------------------------------------
> [EINVAL]
>     The implementation does not support synchronized I/O for this file.
> -----------------------------------------------------------
> 
> Since removing proc entry is apparently not related to synchronized I/O,
> this function should return ENOENT in this case.
> 
> Signed-off-by: Daisuke Ogino <ogino.daisuke@...fujitsu.com>

It makes sense to me. 

Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>

Add fsdevel to CC.

> ---
>  fs/proc/inode.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/proc/inode.c b/fs/proc/inode.c
> index 74b48cf..7ed72d6 100644
> --- a/fs/proc/inode.c
> +++ b/fs/proc/inode.c
> @@ -319,7 +319,7 @@ static int proc_reg_open(struct inode *inode, struct file *file)
>  	if (!pde->proc_fops) {
>  		spin_unlock(&pde->pde_unload_lock);
>  		kfree(pdeo);
> -		return -EINVAL;
> +		return -ENOENT;
>  	}
>  	pde->pde_users++;
>  	open = pde->proc_fops->open;
> --
> 
> Since I don't subscribe LKML, please Cc me if you have any comment.
> 
> Thanks,
> Daisuke
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ