lkml.org 
[lkml]   [2005]   [Aug]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Subjectopen("foo", 3)
From
Date
Linus et Al,

Access mode of 3 is undocumented but it does do something halfway sane
on all linuxes (checked back to 2.0.X).

The open requires both read and write permission to succeed, but the
resulting file descriptor can neither be read nor written.

The responsible code in filp_open() is this:

namei_flags = flags;
if ((namei_flags+1) & O_ACCMODE)
namei_flags++;

/* ... */

error = open_namei(filename, namei_flags, mode, &nd);
if (!error)
return dentry_open(nd.dentry, nd.mnt, flags);

And in dentry_open():

f->f_mode = ((flags+1) & O_ACCMODE) | /* ... */

Note, that open_namei() is checking permissions, and dentry_open()
sets f->f_mode, but calculates it differently.

My question is: is this deliberate or accidental? Wouldn't it be more
logical to not require any permission to open such file? Or is there
some security concern with that?

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

\
 
 \ /
  Last update: 2005-08-20 18:31    [W:0.084 / U:24.320 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site