Bug 497429 - pwritev writes ramdom junk
pwritev writes ramdom junk
Product: Fedora
Classification: Fedora
Component: glibc (Show other bugs)
All Linux
high Severity urgent
: ---
: ---
Assigned To: Jakub Jelinek
Fedora Extras Quality Assurance
Depends On:
Blocks: F11Blocker/F11FinalBlocker
  Show dependency treegraph
Reported: 2009-04-23 16:49 EDT by Gerd Hoffmann
Modified: 2009-04-27 16:13 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-04-27 16:13:27 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
/usr/src/debug/glibc-20090416T1610/sysdeps/posix/pwritev.c (3.09 KB, text/plain)
2009-04-23 16:49 EDT, Gerd Hoffmann
no flags Details
glibc-pwritev.patch (7.25 KB, patch)
2009-04-23 17:25 EDT, Jakub Jelinek
no flags Details | Diff

  None (edit)
Description Gerd Hoffmann 2009-04-23 16:49:26 EDT
Created attachment 341009 [details]

Description of problem:
__atomic_pwritev_replacement is broken.

Version-Release number of selected component (if applicable):

How reproducible:
Grab a qemu git checkout, build it, try to use it.
Don't use a valuable guest image.

Actual results:
pwritev writes random data.

Expected results:
pwritev acts as documented.
Comment 1 Gerd Hoffmann 2009-04-23 16:54:07 EDT
Just look at the source code, it is obvious.

pwritev was copyed from preadv with a simple s/read/write/.  That isn't correct though, the buffer copying must be adjusted.

preadv has to do (and does that correctly):
  * alloc buffer
  * pread()
  * copy data to iovec
  * free buffer

pwritev has to do:
  * alloc buffer
  * copy data from iovec
  * pwrite()
  * free buffer.

pwritev actually does:
  * alloc buffer
  * pwritev()             <= writes random data
  * copy data to iovec    <= fills iovec with random data
  * free buffer.
Comment 2 Jakub Jelinek 2009-04-23 17:25:26 EDT
Created attachment 341021 [details]

Patch I'm about to test.
Comment 3 Gerd Hoffmann 2009-04-23 17:48:36 EDT
Patch looks good to me.
Comment 4 Mark McLoughlin 2009-04-24 04:49:19 EDT
Nice catch

Adding to F11Blocker - it doesn't affect F11 qemu, but we still shouldn't ship with a completely broken pwritev()
Comment 5 Mark McLoughlin 2009-04-27 11:33:03 EDT
Fix is in rpms/glibc/F-11 but not yet dist-f11:

* Fri Apr 24 2009 Jakub Jelinek <jakub@redhat.com> 2.9.90-20
- update from trunk
  - fix p{read,write}v{,64} (#497429, #497434)
  - fix strfmon (#496386)
Comment 6 Jakub Jelinek 2009-04-27 16:13:27 EDT
Should be fixed in glibc-2.9.90-22.

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