Bug 625034 - [log-rotate] [rhel6] update of logrotate.status should be atomic
Summary: [log-rotate] [rhel6] update of logrotate.status should be atomic
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: logrotate (Show other bugs)
(Show other bugs)
Version: 6.1
Hardware: All Linux
low
medium
Target Milestone: rc
: ---
Assignee: Jan Kaluža
QA Contact: Tomas Dolezal
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-08-18 12:42 UTC by Haim
Modified: 2016-04-06 13:03 UTC (History)
8 users (show)

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 06:19:29 UTC
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 15:15 UTC, Jan Kaluža
no flags Details | Diff
proposed patch 2 (4.24 KB, patch)
2010-08-19 12:17 UTC, 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 17:54:05 UTC

Description Haim 2010-08-18 12:42:05 UTC
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 13:29:34 UTC
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 15:15:46 UTC
Created attachment 439411 [details]
proposed patch

Comment 4 Jan Kaluža 2010-08-18 15:18:54 UTC
Attached patch fixes this bug for me. It's based on idea from Comment 2.

Comment 5 Dan Kenigsberg 2010-08-18 19:15:47 UTC
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 12:16:50 UTC
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 12:17:32 UTC
Created attachment 439664 [details]
proposed patch 2

Comment 8 RHEL Product and Program Management 2011-01-07 15:33:20 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 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 23:46:15 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 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-14 01:17:02 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 17 errata-xmlrpc 2015-07-22 06:19:29 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.

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.