Merge lp://staging/~cbehrens/agent-smith/short-read-fix into lp://staging/agent-smith

Proposed by Chris Behrens
Status: Merged
Merged at revision: 70
Proposed branch: lp://staging/~cbehrens/agent-smith/short-read-fix
Merge into: lp://staging/agent-smith
Diff against target: 57 lines (+14/-5)
1 file modified
src/spool.c (+14/-5)
To merge this branch: bzr merge lp://staging/~cbehrens/agent-smith/short-read-fix
Reviewer Review Type Date Requested Status
Agent Smith devs Pending
Review via email: mp+33473@code.staging.launchpad.net

Description of the change

From commit:

1) when processing spool event, there was a potential access past end of buffer
2) also, if a 2nd read() succeeds when processing an spool event, 'i' was not reset so the buffer was accessed at the wrong location

This corrects the current behavior, although I'm not sure the current behavior is entirely accurate. Is it possible to get short read()s where a single event could span multiple read() calls? If so, we'll need to keep some state between calls to spool_process_pending_events() (keep the buffer and next read position, etc). Might be safest to do that, and I can do that as a part of combining the polling on spool and xenstore.

To post a comment you must log in.
Revision history for this message
Soren Hansen (soren) wrote :

I'm happy with more anal error handling and have merged this branch now.

However, the way I read the kernel code, a single event cannot span multiple reads:
 * If the size of the buffer passed to read isn't large enough to hold the event, read returns -1 and sets errno to EAGAIN.
 * If copying the data to userspace fails for some reason, read returns -1 and sets errno to EFAULT.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches