Bug 24946 - printing hex sequences causes crash
Summary: printing hex sequences causes crash
Status: RESOLVED FIXED
Alias: None
Product: systemtap
Classification: Unclassified
Component: bpf (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-28 21:30 UTC by Sagar Patel
Modified: 2019-09-03 20:10 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sagar Patel 2019-08-28 21:30:42 UTC
The use of hex sequences is causing stapbpf to crash and produce a segmentation fault. For example, the following script exhibits such behaviour:

stap --bpf -e 'probe oneshot { print("\x40") }'
Comment 1 Sagar Patel 2019-08-30 20:20:10 UTC
The translation in stapbpf causes the iterator to reach the end of the string after building the hex number, and then loop increments the iterator again and misses the stopping condition. This causes the loop to go out of range and eventually run into a segmentation fault.

Additionally, the building of the hex number doesn't account for digits '8' and '9', and as mentioned in PR24947 there is no check for valid hex sequences.
Comment 2 Sagar Patel 2019-09-03 20:08:29 UTC
Fixed in commit 728bbc1ac. 

This is a temporary patch, and will be reverted after PR13371 is fixed.
Comment 3 Sagar Patel 2019-09-03 20:10:04 UTC
(In reply to Sagar Patel from comment #2)
> Fixed in commit 728bbc1ac. 
> 
> This is a temporary patch, and will be reverted after PR13371 is fixed.

The portion of the patch dealing with this PR will not be reverted, only the portion dealing with PR24947 will be reverted.