Bug 250419
| Summary: | HAL fstab-sync zero-bytes /etc/fstab if / is full. | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 4 | Reporter: | Jose Plans <jplans> | ||||
| Component: | hal | Assignee: | David Zeuthen <davidz> | ||||
| Status: | CLOSED ERRATA | QA Contact: | desktop-bugs <desktop-bugs> | ||||
| Severity: | high | Docs Contact: | |||||
| Priority: | high | ||||||
| Version: | 4.5 | CC: | mclasen, tao | ||||
| Target Milestone: | --- | ||||||
| Target Release: | --- | ||||||
| Hardware: | All | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | RHBA-2008-0734 | Doc Type: | Bug Fix | ||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2008-07-24 19:58:52 UTC | Type: | --- | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Bug Depends On: | |||||||
| Bug Blocks: | 246627 | ||||||
| Attachments: |
|
||||||
Created attachment 160416 [details]
Patch from lmacchia
Patched confirmed to work. Hmm typo on #c0 : - size_t bytes_written, bytes_to_write; + ssize_t bytes_written, bytes_to_write; <--- signed for error handling on write(2) This request was evaluated by Red Hat Product Management for inclusion in a Red Hat Enterprise Linux maintenance release. Product Management has requested further review of this request by Red Hat Engineering, for potential inclusion in a Red Hat Enterprise Linux Update release for currently deployed products. This request is not yet committed for inclusion in an Update release. Looks like something we should fix. Dev ACK. Fix is in hal-0.4.2-8.EL4. An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHBA-2008-0734.html |
Description of problem: fstab-sync from hal doesn't detect properly write(2) as the error "-1" is stored on a signed size_t instead of ssize_t. This has made some systems to lose their /etc/fstab and therfore provide some serious impacts on boot. static boolean add_udi (const char *udi) { [...] if (!fs_table_write (fs_table, fd)) <-- fs_table_write will always return 1 [1] goto error; [...] if (rename (temp_filename, _PATH_FSTAB) < 0) <- rename will report ENOSPC but.. it was too late. { [..] } [...] } [1] return will always be TRUE as size_t is unsigned: static boolean fs_table_write (FSTable *table, int fd) { char *fstab_contents; - size_t bytes_written, bytes_to_write; + size_t bytes_written, bytes_to_write; <--- signed for error handling on write(2) [...] while ((bytes_written = write (fd, fstab_contents + bytes_written, bytes_to_write)) < bytes_to_write) { if (bytes_written < 0) <--- with size_t this will never happen. [...] return TRUE; <--- return 1. } Version-Release number of selected component (if applicable): hal-0.4.2* How reproducible: Always. Steps to Reproduce: - fill the root partition to 100% - crash - system starts - it mounts all the file system according to fstab - it runs fstab-sync and NOW corrupts it (as per strace) Actual results: /etc/fstab empty. Expected results: /etc/fstab not empty. Additional info: Patch attached from Leo Macchia <lmacchia>