[PATCH#2][2nd REVIEW?] fake data io module for samba

Jeremy Allison jra at samba.org
Fri Oct 31 16:26:16 MDT 2014


On Thu, Oct 30, 2014 at 04:50:38PM +0100, Peter Somogyi wrote:
> Hi Jeremy,
> 
> Please find the next attempt of fake io module.
> 
> Missing calls: as stated later, they either do what is expected (ftrunc,
> falloc) or unsupported (aio) or not called (read/write).
> 
> Streams: not supported (documented now), I have no valid business use case for
> it.
> However, increased the error to level from 1 to 10 not to get hurt (though I
> haven't met any during my tests).
> 
> 
> Added documentation (man page).
> 
> 
> Review appreciated.

The only thing that worries me is this:

+static ssize_t vfs_fake_io_pread(vfs_handle_struct *handle, files_struct *fsp,
+                            void *data, size_t n, off_t offset)
+{
+       return n;
+}
+

That means any read return is sending uninitialized allocated
server memory contents out onto the wire.

Now that might be OK, as this is a test module - but at the
very least that needs to be documented I think.

Would it be possible to add an additional module specific
parameter, on by default, that changes vfs_fake_io_pread()
to be:

static ssize_t vfs_fake_io_pread(vfs_handle_struct *handle, files_struct *fsp,
                            void *data, size_t n, off_t offset)
{
	if (!lp_parm_bool(SNUM(handle->conn),
			"fake_io",
			"expose server memory contents",
			false)) {
		memset(data, '\0', n);
	}
	return n;
}

That way you have to set:

	"fake_io:expose server memory contents = true"

to be insecure (but correctly measure smbd performace).

Just a thought.

Jeremy.


More information about the samba-technical mailing list