Bug 13729 - write() to a disk device returns success although kernel function has failed
Summary: write() to a disk device returns success although kernel function has failed
Status: RESOLVED INVALID
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: 2.11
: P2 critical
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-23 15:57 UTC by Vic
Modified: 2014-06-13 14:09 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vic 2012-02-23 15:57:05 UTC
This code line

if ( write(fd,buf,sectsize*i) != (sectsize*i) ) error(1,errno,"fill_blocks write failed");

never throws an error, although nothing gets written to the disk.

The Linux kernel knows the problem. It just doesn't get reported through to my user space program.

Syslog excerpt:
Feb 22 18:55:29 linux-xyf6 kernel: [   99.981245] sd 1:0:0:0: [sdb] Unhandled error code
Feb 22 18:55:29 linux-xyf6 kernel: [   99.981248] sd 1:0:0:0: [sdb]  Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
Feb 22 18:55:29 linux-xyf6 kernel: [   99.981251] sd 1:0:0:0: [sdb] CDB: Write(10): 2a 00 00 38 8a 30 00 01 00 00
Feb 22 18:55:29 linux-xyf6 kernel: [   99.981258] end_request: I/O error, dev sdb, sector 3705392
Comment 1 Andreas Schwab 2012-02-23 16:01:01 UTC
This is a kernel issue.