Re: When booting a 16TB system, unix_create1 fails due to integer overflow.

Dipankar Sarma
2010-09-23T14:10:46Z

On Thu, Sep 23, 2010 at 02:53:04PM +0200, Eric Dumazet wrote:
> Le jeudi 23 septembre 2010 à 07:17 -0500, Robin Holt a écrit :
> > I do not know which direction to take, but here is the summary of the
> > problem.
> >
> > We recently started trying to boot a customer's two new machines which
> > are configured with 384GB short of 16TB of memory.
> >
> > We were seeing a failure which prevented boot. The kernel was incapable
> > of creating either a named pipe or unix domain socket. This comes down
> > to a common kernel function called unix_create1() which does:
> >
> > atomic_inc(&unix_nr_socks);
> > if (atomic_read(&unix_nr_socks) > 2 * get_max_files())
> > goto out;
> >
>
> Hi Robin
>
> I would say : We can use atomic_long_t instead of atomic_t
>
> And make get_max_files(void) return a long ?
>
> Something like :
>
>
> fs/file_table.c | 10 +++++-----
> include/linux/fs.h | 2 +-
> net/unix/af_unix.c | 14 +++++++-------
> 3 files changed, 13 insertions(+), 13 deletions(-)
>
> diff --git a/fs/file_table.c b/fs/file_table.c
>
> n = (mempages * (PAGE_SIZE / 1024)) / 10;
> - files_stat.max_files = n;
> + files_stat.max_files = min(n, 0x7FFFFFFFUL);

It may be cleaner to just convert both the file counters and
the file limits to usnsigned long.

Other than that, this seems like a reasonable thing to do.

Thanks
Dipankar