mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
xentop parses -d/--delay and -i/--iterations with atoi(), so invalid input is silently accepted with surprising results: a fractional delay such as "-d 2.5" is truncated to 2; "-d abc" parses as 0, which in batch mode turns the output loop into a busy loop; "-d -1" wraps to an effective delay of about 136 years; and "-i 0" (or any unparsable iterations count) decrements an unsigned counter from zero, running for about 2^32 iterations. atoi() also has undefined behaviour on out-of-range input. Parse both options with strtoull() instead, and reject anything that is not a plain decimal integer in range: a sign, a fractional part, trailing junk or overflow now produce an error and exit rather than a silently wrong value. Compatibility considerations: "--delay 0" remains accepted, since updating as fast as possible is a plausible deliberate choice and works today; "--iterations 0" is rejected, since running the loop 2^32 times cannot be what the caller meant. The interactive 'D' prompt already validates its input and is unchanged. The only previously useful invocation this breaks is a fractional delay, which now fails loudly instead of silently rounding down - which is the point of the change. A patch documenting the --delay truncation was posted in 2010 but never applied: Link: https://lore.kernel.org/xen-devel/01ea26d2420e3562eb30.1292604768@chilopoda.uk.xensource.com/ Signed-off-by: Matthias Goergens <matthias.goergens@gmail.com> Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
Sphinx documentation:
All source rendered by Sphinx is licensed under CC-BY-4.0.
You are free to:
Share:
Copy and redistribute the material in any medium or format.
Adapt:
Remix, transform, and build upon the material for any purpose, even
commercially.
Under the following terms:
Attribution:
You must give appropriate credit, provide a link to the license, and
indicate if changes were made. You may do so in any reasonable manner, but
not in any way that suggests the licensor endorses you or your use.
No additional restrictions:
You may not apply legal terms or technological measures that legally
restrict others from doing anything the license permits.
See https://creativecommons.org/licenses/by/4.0/ for full details.
This includes:
* All ReStructured Text files: docs/*/*.rst
* The Sphinx configuration file: docs/conf.py
* Content in Sphinx-exclusive subdirs: docs/*-guide/*
Other documentation:
There are a variety of text documents in various formats. These, given no
explicit license guidance, fall under Xen's default GPL-2.0 license.