Skip to contentSkip to conversation

Overflow issue in trans_stat_show

DISCUSSION Jiazi.Li 2 participants 2 messages Sep 12, 2023

lore
Share & tools
lore

Jiazi.Li

author
#0 lore raw

Hi,

In trans_stat_show, if there are more than 19 states, len will be greater than 4096, causing overflow write issue:

[  702.286732] cat: dev_attr_show: trans_stat_show.cfi_jt+0x0/0x8 returned bad count
[  702.287867] cat: fill_read_buffer: dev_attr_show.cfi_jt+0x0/0x8 returned bad count

And then system oops due to memory corruption.

It seems difficult to read more than PAGE_SIZE bytes through sysfs, could we move trans_stat to debugfs?
For example, in the following dir:
debugfs_root/devfreq/device_name/trans_stat

Best regards

#1 lore raw


Quoted 13 lines

--------- Original Message ---------
Sender : Jiazi.Li <[email protected]>
Date : 2023-09-12 18:08 (GMT+9)
Title : Overflow issue in trans_stat_show

Hi,

In trans_stat_show, if there are more than 19 states, len will be greater than 4096, causing overflow write issue:
[  702.286732] cat: dev_attr_show: trans_stat_show.cfi_jt+0x0/0x8 returned bad count [  702.287867] cat: fill_read_buffer: dev_attr_show.cfi_jt+0x0/0x8 returned bad count And then system oops due to memory corruption.

Quoted 4 lines

It seems difficult to read more than PAGE_SIZE bytes through sysfs, could we move trans_stat to debugfs?
For example, in the following dir:
debugfs_root/devfreq/device_name/trans_stat

Yes, it'd be better if
1) let sysfs trans_stat_show show in shorter form for such cases
2) create a debugfs entry for performance statistics (trans_stat).

Cheers,
MyungJoo