[Bug stdio/18906] New: fopen: ccs value may affect open mode

valery_reznic at yahoo dot com sourceware-bugzilla@sourceware.org
Tue Sep 1 14:24:00 GMT 2015


https://sourceware.org/bugzilla/show_bug.cgi?id=18906

            Bug ID: 18906
           Summary: fopen: ccs value may affect open mode
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: stdio
          Assignee: unassigned at sourceware dot org
          Reporter: valery_reznic at yahoo dot com
  Target Milestone: ---

Created attachment 8569
  --> https://sourceware.org/bugzilla/attachment.cgi?id=8569&action=edit
test program to demonstrate the problem

I fopen mode looks like
"r,ccs=+..."
"r,ccs=x..."
"r,ccs=e..."

Then first symbol from the ccs value will affect open flags.
For example, if mode = "r,ccs=+" then file will be opened with O_RDWR instead
of
O_RDONLY


Here the starce output:

execve("./fopen_test", ["./fopen_test"], [/* 52 vars */]) = 0
brk(0)                                  = 0xb10000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x7f51bf48b000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=143162, ...}) = 0
mmap(NULL, 143162, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f51bf468000
close(3)                                = 0
open("/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p\36\302\2026\0\0\0"...,
832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=2096496, ...}) = 0
mmap(0x3682c00000, 3920480, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3,
0) = 0x3682c00000
mprotect(0x3682db4000, 2093056, PROT_NONE) = 0
mmap(0x3682fb3000, 24576, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1b3000) = 0x3682fb3000
mmap(0x3682fb9000, 16992, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x3682fb9000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x7f51bf467000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x7f51bf465000
arch_prctl(ARCH_SET_FS, 0x7f51bf465740) = 0
mprotect(0x3682fb3000, 16384, PROT_READ) = 0
mprotect(0x600000, 4096, PROT_READ)     = 0
mprotect(0x3682a1f000, 4096, PROT_READ) = 0
munmap(0x7f51bf468000, 143162)          = 0
brk(0)                                  = 0xb10000
brk(0xb31000)                           = 0xb31000
brk(0)                                  = 0xb31000
open("aaa", O_RDWR)                     = -1 ENOENT (No such file or directory)
exit_group(0)                           = ?
+++ exited with 0 +++

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



More information about the Glibc-bugs mailing list