lkml.org 
[lkml]   [2000]   [Dec]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Broken NR_RESERVED_FILES
On Thu, 7 Dec 2000, Szabolcs Szakacsits wrote:
> again. The failed logic is also clear from the kernel code [user
> happily allocates when freelist < NR_RESERVED_FILES].

is it clear to you? it is not clear to me, or rather the opposite seems
clear. This is what the code looks like (in 2.4):

struct file * get_empty_filp(void)
{
static int old_max = 0;
struct file * f;

file_list_lock();
if (files_stat.nr_free_files > NR_RESERVED_FILES) {
used_one:
f = list_entry(free_list.next, struct file, f_list);
list_del(&f->f_list);
files_stat.nr_free_files--;

so, a normal user is only allowed to allocate from the freelist when the
number of elements on the freelist is > NR_RESERVED_FILES. I do not see
how you are able to take elements from the freelist when the number is <
NR_RESERVED_FILES unless you are a super-user, i.e. current->euid == 0.

Btw, while you are there (in 2.2 kernel) you may want to fix the
/proc/sys/fs/file-nr -- it is broken because it assumes that nr_files,
nr_free_files, max_files are allocated by the compiler at consecutive
addresses. I have fixed this for 2.4 ages ago but couldn't be bothered
with 2.2.x...

Regards,
Tigran


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

\
 
 \ /
  Last update: 2005-03-22 12:51    [W:0.032 / U:14.952 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site