Bug 847339 - logrotate ACL fix race condition
Summary: logrotate ACL fix race condition
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: logrotate
Version: 6.3
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: ---
Assignee: Jan Kaluža
QA Contact: Tomas Dolezal
Depends On:
TreeView+ depends on / blocked
Reported: 2012-08-10 15:31 UTC by Daniel Crisman
Modified: 2014-01-30 09:21 UTC (History)
4 users (show)

Fixed In Version: logrotate-3.7.8-17.el6
Doc Type: Bug Fix
Doc Text:
Cause: Both acl_set_fd() and fchmod() functions has been called to set the log files permissions. Consequence: There was a race condition where the log file could have unsafe permissions for short time during its creation. Fix: Only one of those functions is called now depending on directives combination used in configuration file. Result: Race condition between these two functions is not possible anymore.
Clone Of:
Last Closed: 2013-07-18 09:35:14 UTC
Target Upstream Version:

Attachments (Terms of Use)
patch (3.97 KB, patch)
2012-08-13 12:07 UTC, Jan Kaluža
no flags Details | Diff

System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:1095 0 normal SHIPPED_LIVE logrotate bug fix update 2013-07-18 13:34:25 UTC

Description Daniel Crisman 2012-08-10 15:31:37 UTC
Description of problem:
Looks like a race condition in ACL change.

Version-Release number of selected component (if applicable):
From logrotate-3.7.8-15.el6.src.rpm

In logrotate.c between
    Inside Line 1259 at line 258
        rename() inside createOutputFile()
    Line 1266 acl_set_fd
Has the same style of race condition as
bug 680798 (CVE-2011-1098)

Might be similar issues before the other uses of acl_set_fd.

Comment 2 Jan Kaluža 2012-08-13 12:06:56 UTC
Proposed patch should fix this issue if I'm right. It just moves acl_set_fd before the rename. I will do something like that in logrotate upstream version too and merge it with patch Bug 847338 patch.

Comment 3 Jan Kaluža 2012-08-13 12:07:27 UTC
Created attachment 603970 [details]

Comment 4 Daniel Crisman 2012-08-13 21:18:04 UTC
That patch reverses the race to between the line 256 acl_set_fd and the line 267 fchmod.  But it still has a race condition.

Also acl_set_fd will never get seen outside that race period so the ACL fix will not be there.

Comment 5 Jan Kaluža 2012-08-14 08:02:50 UTC
I'm not sure I see the race condition in the patched code. Can you please explain it more?

Comment 6 Daniel Crisman 2012-08-14 17:35:11 UTC
chmod and setfacl change overlapping data.  If you do one and then the other in either order it is possible to have between the first call and the second more permissions then then end file has.

Comment 7 Jan Kaluža 2012-09-03 11:45:16 UTC
This is fixed upstream and the patches can be backported. If "create" directive is used, fchmod is used. Otherwise, acl_set_fd is used.


Comment 8 RHEL Program Management 2012-09-07 05:12:03 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unable to address this
request at this time.

Red Hat invites you to ask your support representative to
propose this request, if appropriate, in the next release of
Red Hat Enterprise Linux.

Comment 15 errata-xmlrpc 2013-07-18 09:35:14 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.