[Rpm-maint] [rpm-software-management/rpm] Fix race condition in rpmioMkpath (PR #3509)

Florian Festi notifications at github.com
Wed Jan 8 09:43:49 UTC 2025


Fix race condition in rpmioMkpath
The previous implementation did stat the directory and created it if not
there. This allowed for a race condition where other rpm instances could
create the directory inbetween. This was observed in the wild for
%{_tmppath}.

Do create the directory unconditionally and if that fails see if the
directory is there already.

Not adding a test case as rpmioMkpath is heavily used all over the the
code base and tests for race conditions don't really fit in the test suite.

Resolves: https://github.com/rpm-software-management/rpm/issues/3508
You can view, comment on, or merge this pull request online at:

  https://github.com/rpm-software-management/rpm/pull/3509

-- Commit Summary --

  * urlOpen: Set errno to ENOTDIR on error
  * Fix race condition in rpmioMkpath

-- File Changes --

    M rpmio/rpmfileutil.cc (18)
    M rpmio/rpmio.cc (1)

-- Patch Links --

https://github.com/rpm-software-management/rpm/pull/3509.patch
https://github.com/rpm-software-management/rpm/pull/3509.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/3509
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/pull/3509 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20250108/ebf8fb80/attachment.htm>


More information about the Rpm-maint mailing list