[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug binutils/15545] BFD cache modifies cacheable flag
From: |
nickc at redhat dot com |
Subject: |
[Bug binutils/15545] BFD cache modifies cacheable flag |
Date: |
Thu, 03 Aug 2023 10:04:22 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=15545
--- Comment #7 from Nick Clifton <nickc at redhat dot com> ---
(In reply to Tom Tromey from comment #6)
> Actually it seems to me that the flags essentially already
> have to be saved
The problem with the flags passed to bfd_fopen is that they
do not include all of the information that was used to open
the original file descriptor. For example, from your test
case:
fd = open (argv[1], O_RDONLY | O_CLOEXEC, 0);
So if the bfd library closes and then reopens this file, it
is not going to have the O_CLOEXEC flag set.
Additionally there is a possible disconnect in the paths to
the file. Suppose for example that the test code did this:
fd = open (argv[1], O_RDONLY | O_CLOEXEC, 0);
abfd = bfd_fopen ("/usr/bin/ld", NULL, "r", fd);
This is obviously a bug in the test code, but it would only
be exposed if the close/reopen sequence happened. Maybe
bdf_fopen should check for this case (if it is possible).
> Also maybe gdb is safe here anyway because I see now
> that it explicitly calls bfd_set_cacheable in various spots.
So - do you want to close this PR for now and see if a real problem
ever turns up in the future ?
--
You are receiving this mail because:
You are on the CC list for the bug.