This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/15763] shm_open/unlink let you write outside SHMDIR


http://sourceware.org/bugzilla/show_bug.cgi?id=15763

--- Comment #4 from Andrea Corbellini <corbellini.andrea at gmail dot com> ---
I agree with you about EISDIR being a bad error number.

I raised the problem of directories because I do have a directory in my
/dev/shm. It's a directory created by Byobu (http://byobu.co/) used as cache.
Byobu is written in Bash, so it's not affected by the behavior of shm_open().
However it shows that the possibility of encountering directories in /dev/shm
is not remote and also shows that such directories aren't created maliciously
(although we might say Byobu is buggy).

Whether it makes sense to create directories in /dev/shm or not, I still think
that shm_open() with O_RDONLY should not open them: otherwise every call to
read() will fail with EISDIR (which, as you noted, is not a good error number).
If we allow shm_open() to return directories, then we are returning broken file
descriptors.

About fstat: you might use it just for O_RDONLY. I think this is a feasible
approach as people expect some delay when accessing resources. Also, fstat
should not be noticeably slow.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]