Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 625034 - [log-rotate] [rhel6] update of logrotate.status should be atomic
[log-rotate] [rhel6] update of logrotate.status should be atomic
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: logrotate (Show other bugs)
6.1
All Linux
low Severity medium
: rc
: ---
Assigned To: Jan Kaluža
Tomas Dolezal
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-08-18 08:42 EDT by Haim
Modified: 2016-04-06 09:03 EDT (History)
8 users (show)

See Also:
Fixed In Version: logrotate-3.7.8-18.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-07-22 02:19:29 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
proposed patch (2.60 KB, patch)
2010-08-18 11:15 EDT, Jan Kaluža
no flags Details | Diff
proposed patch 2 (4.24 KB, patch)
2010-08-19 08:17 EDT, Jan Kaluža
no flags Details | Diff


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:1293 normal SHIPPED_LIVE logrotate bug fix and enhancement update 2015-07-20 13:54:05 EDT

  None (edit)
Description Haim 2010-08-18 08:42:05 EDT
Description of problem:

in case log rotate tries to write to log, and disk space is consumed, it writes about 4k and stops, when disk space is free, and log rotate tries to 'read' the part that it wrote, it crash, as it contain garbage.

 Aug 16 14:01:02 pele logrotate: ALERT exited abnormally with [1]
Aug 16 15:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 16 16:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 16 17:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 16 18:01:02 pele logrotate: ALERT exited abnormally with [1]
Aug 16 19:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 16 20:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 16 21:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 16 22:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 16 23:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 17 00:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 17 01:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 17 02:01:02 pele logrotate: ALERT exited abnormally with [1]
Aug 17 03:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 17 04:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 17 05:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 17 06:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 17 07:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 17 08:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 17 12:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 17 13:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 17 14:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 17 15:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 17 16:01:02 pele logrotate: ALERT exited abnormally with [1]
Aug 17 17:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 17 18:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 17 19:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 17 20:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 17 21:01:02 pele logrotate: ALERT exited abnormally with [1]
Aug 17 22:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 17 23:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 18 00:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 18 01:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 18 02:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 18 03:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 18 04:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 18 05:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 18 06:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 18 07:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 18 08:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 18 09:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 18 10:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 18 11:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 18 12:01:02 pele logrotate: ALERT exited abnormally with [1]
Aug 18 13:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 18 14:01:01 pele logrotate: ALERT exited abnormally with [1]
Aug 18 15:01:01 pele logrotate: ALERT exited abnormally with [1]

logrotate-3.7.8-12.el6.x86_64
Comment 2 Dan Kenigsberg 2010-08-18 09:29:34 EDT
Only first 4096 bytes have been written to /var/lib/logrotate.status, which makes it unreadable for future lograte processes.

# /usr/sbin/logrotate /etc/logrotate.d/vdsm
error: line 77 too long in state file /var/lib/logrotate.status
error: could not read state file, will not attempt to write into it

When logrotate needs to write to logrotate.status it should probably first write to logrotate.status.tmp and move it to logrotate.status on success.
Comment 3 Jan Kaluža 2010-08-18 11:15:46 EDT
Created attachment 439411 [details]
proposed patch
Comment 4 Jan Kaluža 2010-08-18 11:18:54 EDT
Attached patch fixes this bug for me. It's based on idea from Comment 2.
Comment 5 Dan Kenigsberg 2010-08-18 15:15:47 EDT
Thanks. Not sure if this is the place for code review, but I think you should remove tmpFilename on error (which includes rename error).
Comment 6 Jan Kaluža 2010-08-19 08:16:50 EDT
Yes, you're right. My first patch also didn't work well with SELinux and didn't respect permissions of old logrotate.status file. That's fixed in the newly attached patch.
Comment 7 Jan Kaluža 2010-08-19 08:17:32 EDT
Created attachment 439664 [details]
proposed patch 2
Comment 8 RHEL Product and Program Management 2011-01-07 10:33:20 EST
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 unfortunately unable to
address this request at this time. Red Hat invites you to
ask your support representative to propose this request, if
appropriate and relevant, in the next release of Red Hat
Enterprise Linux. If you would like it considered as an
exception in the current release, please ask your support
representative.
Comment 9 RHEL Product and Program Management 2011-07-05 19:46:15 EDT
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 unfortunately unable to
address this request at this time. Red Hat invites you to
ask your support representative to propose this request, if
appropriate and relevant, in the next release of Red Hat
Enterprise Linux. If you would like it considered as an
exception in the current release, please ask your support
representative.
Comment 11 RHEL Product and Program Management 2013-10-13 21:17:02 EDT
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 17 errata-xmlrpc 2015-07-22 02:19:29 EDT
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.

https://rhn.redhat.com/errata/RHBA-2015-1293.html

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