From: Jerry DeLisle <jvdelisle@charter.net>
To: Tobias Burnus <burnus@net-b.de>,
gcc-patches <gcc-patches@gcc.gnu.org>,
fortran <fortran@gcc.gnu.org>,
mscfd@gmx.net
Subject: Re: [Patch] Fortran: Fix libgfortran I/O race with newunit_free [PR99529]
Date: Thu, 11 Mar 2021 17:35:47 -0800 [thread overview]
Message-ID: <14a334fb-c586-25d5-93b5-dbe2fd90971e@charter.net> (raw)
In-Reply-To: <9b6fa121-a5ea-4d2c-9924-fcdfe7d6d560@net-b.de>
Looks good Tobias, OK,
Odd about that line in set_internal_unit. Probably leftover from a
copy/paste. I see in comment #5 of the PR that you mentioned trying the
assert to make sure it is useless code.
Thanks for the patch,
Jerry
On 3/11/21 2:38 AM, Tobias Burnus wrote:
> Revised version – the previous had a lock inversion, which could lead
> to a deadlock, found by -fsanitize=thread. See transfer.c for the
> changes.
>
> OK?
>
> Tobias
>
> On 11.03.21 10:42, Tobias Burnus wrote:
>> Hi all,
>>
>> as found by Martin (thanks!) there is a race for newunit_free.
>> While that call is within the unitlock for the calls in io/unit.c,
>> the call in transfer.c did not use locks.
>>
>> Additionally,
>> unit = get_gfc_unit (dtp->common.unit, do_create);
>> set_internal_unit (dtp, unit, kind);
>> gets first the unit (with proper locking when using the unit number
>> dtp->common.unit) but then in set_internal_unit it re-sets the
>> unit number to the same number without locking. That causes
>> race warnings and if the assignment is not atomic it is a true race.
>>
>> OK for mainline? What about GCC 10?
>>
>> As Martin notes in the email thread and in the PR there are more
>> race warnings (and likely true race issues).
>>
>> Tobias
>>
prev parent reply other threads:[~2021-03-12 1:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-11 9:42 Tobias Burnus
2021-03-11 10:38 ` Tobias Burnus
2021-03-11 11:43 ` Martin Stein
2021-03-12 1:35 ` Jerry DeLisle [this message]
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=14a334fb-c586-25d5-93b5-dbe2fd90971e@charter.net \
--to=jvdelisle@charter.net \
--cc=burnus@net-b.de \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=mscfd@gmx.net \
/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).