aboutsummaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/sched-migration.py
diff options
context:
space:
mode:
authorfrank zago <[email protected]>2017-01-28 19:04:43 -0500
committerGreg Kroah-Hartman <[email protected]>2017-02-03 13:01:37 +0100
commit22aadb91c0a0055935109c175f5446abfb130702 (patch)
treee4c7e44040db95c914c7478a69c512c0d463d557 /tools/perf/scripts/python/sched-migration.py
parent30af99db7ab3483f5ce83ccb890533c9378c2ced (diff)
staging: lustre: hsm: stack overrun in hai_dump_data_field
The function hai_dump_data_field will do a stack buffer overrun when cat'ing /sys/fs/lustre/.../hsm/actions if an action has some data in it. hai_dump_data_field uses snprintf. But there is no check for truncation, and the value returned by snprintf is used as-is. The coordinator code calls hai_dump_data_field with 12 bytes in the buffer. The 6th byte of data is printed incompletely to make room for the terminating NUL. However snprintf still returns 2, so when hai_dump_data_field writes the final NUL, it does it outside the reserved buffer, in the 13th byte of the buffer. This stack buffer overrun hangs my VM. Fix by checking that there is enough room for the next 2 characters plus the NUL terminator. Don't print half bytes. Change the format to 02X instead of .2X, which makes more sense. Signed-off-by: frank zago <[email protected]> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8171 Reviewed-on: http://review.whamcloud.com/20338 Reviewed-by: John L. Hammond <[email protected]> Reviewed-by: Jean-Baptiste Riaux <[email protected]> Reviewed-by: Oleg Drokin <[email protected]> Signed-off-by: James Simmons <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/sched-migration.py')
0 files changed, 0 insertions, 0 deletions