Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 250419 - HAL fstab-sync zero-bytes /etc/fstab if / is full.
HAL fstab-sync zero-bytes /etc/fstab if / is full.
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: hal (Show other bugs)
All Linux
high Severity high
: ---
: ---
Assigned To: David Zeuthen
Depends On:
Blocks: 246627
  Show dependency treegraph
Reported: 2007-08-01 10:18 EDT by Jose Plans
Modified: 2018-10-19 19:18 EDT (History)
2 users (show)

See Also:
Fixed In Version: RHBA-2008-0734
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-07-24 15:58:52 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Patch from lmacchia@redhat.com (384 bytes, patch)
2007-08-01 10:26 EDT, Jose Plans
no flags Details | Diff

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2008:0734 normal SHIPPED_LIVE hal bug fix update 2008-07-23 12:47:00 EDT

  None (edit)
Description Jose Plans 2007-08-01 10:18:02 EDT
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):

How reproducible:

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@redhat.com>
Comment 1 Jose Plans 2007-08-01 10:26:48 EDT
Created attachment 160416 [details]
Patch from lmacchia@redhat.com
Comment 2 Jose Plans 2007-08-01 10:28:40 EDT
Patched confirmed to work.
Comment 3 Jose Plans 2007-08-01 10:30:26 EDT
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)
Comment 4 RHEL Product and Program Management 2007-11-28 23:16:43 EST
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
Comment 5 David Zeuthen 2008-02-15 16:16:52 EST
Looks like something we should fix. Dev ACK.
Comment 7 David Zeuthen 2008-04-10 18:18:29 EDT
Fix is in hal-0.4.2-8.EL4.
Comment 11 errata-xmlrpc 2008-07-24 15:58:52 EDT
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.


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