vfs/rump: handle split block I/O jobs

This patch fixes a potential data corruption issue that could occur when
issuing large I/O requests to vfs/rump, which don't fit into the default
block I/O buffer of 128 KiB. Note that we haven't observed the problem
in practice (Sculpt hosts vfs/rump in a dedicated vfs server, which
fragments requests) but spotted the issue while reviewing the code. We
could trigger problem by explicitly changing the I/O buffer size to 32
KiB.

Issue #4474
This commit is contained in:
Norman Feske
2022-04-13 11:41:13 +02:00
parent d815322efe
commit 7d6c592417

View File

@@ -121,16 +121,16 @@ class Backend
struct Update_jobs_policy
{
void produce_write_content(Job &job, Block::seek_off_t offset,
void produce_write_content(Job &job, off_t offset,
char *dst, size_t length)
{
Genode::memcpy(dst, job.ptr, length);
Genode::memcpy(dst, (char const *)job.ptr + offset, length);
}
void consume_read_result(Job &job, Block::seek_off_t offset,
void consume_read_result(Job &job, off_t offset,
char const *src, size_t length)
{
Genode::memcpy(job.ptr, src, length);
Genode::memcpy((char *)job.ptr + offset, src, length);
}
void completed(Job &job, bool success)