diff options
author | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2006-05-16 14:07:56 +0100 |
---|---|---|
committer | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2006-05-16 14:07:56 +0100 |
commit | eca207adce3e1b0f7aadb9caf1751c93adcaa1ca (patch) | |
tree | f8b8e21d752d1d4d21c25a66a6d31aefe2cddeb9 /extras/mini-os/console | |
parent | f00a6868cfd386f62ab1b621c17914087bdf7207 (diff) | |
download | xen-eca207adce3e1b0f7aadb9caf1751c93adcaa1ca.tar.gz xen-eca207adce3e1b0f7aadb9caf1751c93adcaa1ca.tar.bz2 xen-eca207adce3e1b0f7aadb9caf1751c93adcaa1ca.zip |
Fixes to the xenoprofile Linux driver.
The active_domains code has race conditions:
* oprofile_set_active() calls set_active() method without holding
start_sem. This is clearly wrong, as xenoprof_set_active() makes
several hypercalls. oprofile_start(), for instance, could run in
the middle of xenoprof_set_active().
* adomain_write(), adomain_read() and xenoprof_set_active() access
global active_domains[] and adomains without synchronization. I
went for a simple, obvious fix and created another mutex. Instead,
one could move the shared data into oprof.c and protect it with
start_sem, but that's more invasive.
Also clean up the code dealing with /dev/oprofile/active_domains:
* Use parameters instead of global variables to pass domain ids
around. Give those globals internal linkage.
* Allocate buffers dynamically to conserve stack space.
* Treat writes with size zero exactly like a write containing no
domain id. Before, zero-sized write was ignored, which is not the
same.
* Parse domain ids as unsigned numbers. Before, the first one was
parsed as signed number.
Because ispunct()-punctuation is ignored between domain ids, signs
are still silently ignored except for the first number. Hmm.
* Make parser accept whitespace as domain separator, because that's
what you get when reading the file.
* EINVAL on domain ids overflowing domid_t. Before, they were
silently truncated.
* EINVAL on too many domain ids. Before, the excess ones were
silently ignored.
* Reset active domains on failure halfway through setting them.
* Fix potential buffer overflow in adomain_read(). Couldn't really
happen because buffer was sufficient for current value of
MAX_OPROF_DOMAINS.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'extras/mini-os/console')
0 files changed, 0 insertions, 0 deletions