From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26317 invoked by alias); 1 Sep 2015 14:24:26 -0000 Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org Received: (qmail 26288 invoked by uid 48); 1 Sep 2015 14:24:22 -0000 From: "valery_reznic at yahoo dot com" To: glibc-bugs@sourceware.org Subject: [Bug stdio/18906] New: fopen: ccs value may affect open mode Date: Tue, 01 Sep 2015 14:24:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: stdio X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: valery_reznic at yahoo dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-09/txt/msg00000.txt.bz2 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.