public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "valery_reznic at yahoo dot com" <sourceware-bugzilla@sourceware.org>
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	[thread overview]
Message-ID: <bug-18906-131@http.sourceware.org/bugzilla/> (raw)

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.


             reply	other threads:[~2015-09-01 14:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-01 14:24 valery_reznic at yahoo dot com [this message]
2015-09-04  9:48 ` [Bug stdio/18906] " fweimer at redhat dot com
2023-07-12 13:12 ` josimmon at redhat dot com
2023-07-12 13:33 ` schwab@linux-m68k.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-18906-131@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).