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-next>] [day] [month] [year] [list]
Date:	Wed, 29 Jul 2009 19:17:00 +0300
From:	Alexander Shishkin <alexander.shishckin@...il.com>
To:	linux-fsdevel@...r.kernel.org
Cc:	Alexander Shishkin <alexander.shishckin@...il.com>,
	akpm@...ux-foundation.org, viro@...iv.linux.org.uk,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] [RFC] List per-process file descriptor consumption when 
	hitting file-max

2009/6/8  <alexander.shishckin@...il.com>:
> From: Alexander Shishkin <alexander.shishckin@...il.com>
>
> When a file descriptor limit is hit, it might be useful to see all the
> users to be able to identify those that leak descriptors.
Is there anything dramatically wrong with this one, or could someone
please review this?

> Signed-off-by: Alexander Shishkin <alexander.shishckin@...il.com>
> ---
>  fs/file_table.c |   27 +++++++++++++++++++++++++++
>  1 files changed, 27 insertions(+), 0 deletions(-)
>
> diff --git a/fs/file_table.c b/fs/file_table.c
> index 54018fe..9e53167 100644
> --- a/fs/file_table.c
> +++ b/fs/file_table.c
> @@ -136,8 +136,35 @@ struct file *get_empty_filp(void)
>  over:
>        /* Ran out of filps - report that */
>        if (get_nr_files() > old_max) {
> +               struct task_struct *p;
> +               struct files_struct *files;
> +               struct fdtable *fdt;
> +               int i, count = 0;
> +
>                printk(KERN_INFO "VFS: file-max limit %d reached\n",
>                                        get_max_files());
> +
> +               read_lock(&tasklist_lock);
> +               for_each_process(p) {
> +                       files = get_files_struct(p);
> +                       if (!files)
> +                               continue;
> +
> +                       spin_lock(&files->file_lock);
> +                       fdt = files_fdtable(files);
> +
> +                       /* we have to actually *count* the fds */
> +                       for (count = i = 0; i < fdt->max_fds; i++)
> +                               count += !!fcheck_files(files, i);
> +
> +                       printk(KERN_INFO "=> %s [%d]: %d\n", p->comm,
> +                                       p->pid, count);
> +
> +                       spin_unlock(&files->file_lock);
> +                       put_files_struct(files);
> +               }
> +               read_unlock(&tasklist_lock);
> +
>                old_max = get_nr_files();
>        }
>        goto fail;
> --
> 1.6.1.3
>
>

TIA,
--
Alex

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ