Current-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
write(2) and >=4GB buffer ... ubc_uiomove: error=14
Hi,
I noticed a few copies of the same log message on one of my -current
NetBSD/amd64 boxes: `ubc_uiomove: error=14'.
After some researches, i discovered that they appear with write(2)
calls + large buffers (>=4GB). It does not seems to be a write(2)
syscall limitation (up to SSIZE_MAX), but rather a filesystem problem.
The attached testcase, fails for if writing to a `dummy.big' file on
ffs; but succeed if writing to the `/dev/null' device.
575 1 bigwrite CALL open(0x400bbf,0x602,0x1b6)
575 1 bigwrite NAMI "dummy.big"
575 1 bigwrite RET open 3
575 1 bigwrite CALL write(3,0x7f7efdb00000,0x100000000)
575 1 bigwrite RET write -1 errno 14 Bad address
558 1 bigwrite CALL open(0x400bbf,0x602,0x1b6)
558 1 bigwrite NAMI "/dev/null"
558 1 bigwrite RET open 3
558 1 bigwrite CALL write(3,0x7f7efdb00000,0x100000000)
558 1 bigwrite RET write 4294967296/0x100000000
I'm convinced that trying to write such many bytes at once is not
ideal, but at the same time i wonder if we support such cases ...
Thanks in advance,
Regards.
NB: Linux/x86_64 has no problems with this testcase on ext3.
--
Nicolas Joly
Biological Software and Databanks.
Institut Pasteur, Paris.
#include <err.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
int main() {
int fd, res;
size_t len;
ssize_t cnt;
void *buf;
len = 4L * 1024 * 1024 * 1024;
buf = malloc(len);
if (buf == NULL)
err(1, "malloc failed");
fd = open("dummy.big", O_RDWR|O_CREAT|O_TRUNC, 0666);
if (fd == -1)
err(1, "open failed");
cnt = write(fd, buf, len);
if (cnt == -1)
err(1, "write failed");
if ((size_t)cnt != len)
err(1, "write bogus data");
res = close(fd);
if (res == -1)
err(1, "close failed");
return 0; }
Home |
Main Index |
Thread Index |
Old Index