Re: [PATCH] tracing: Fix out-of-range read in trace_stack_print()
From: Eiichi Tsukata
Date: Sun Jun 30 2019 - 05:04:18 EST
On 2019/06/15 5:31, Steven Rostedt wrote:
...
>
>>
>> Fixes: 4a9bd3f134dec ("tracing: Have dynamic size event stack traces")
>
> Actually it fixes:
>
> 4285f2fcef80 ("tracing: Remove the ULONG_MAX stack trace hackery")
>
> Because before that, a ULONG_MAX was inserted into the buffer.
>
> -- Steve
Thank you for the advice.
Now there is no ULONG_MAX marker, so I should have fixed it by just
removing `*p != ULONG_MAX` check, right?
Thanks
Eiichi
>
>> Signed-off-by: Eiichi Tsukata <devel@xxxxxxxxxxxx>
>> ---
>> kernel/trace/trace_output.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
>> index 54373d93e251..ba751f993c3b 100644
>> --- a/kernel/trace/trace_output.c
>> +++ b/kernel/trace/trace_output.c
>> @@ -1057,7 +1057,7 @@ static enum print_line_t trace_stack_print(struct trace_iterator *iter,
>>
>> trace_seq_puts(s, "<stack trace>\n");
>>
>> - for (p = field->caller; p && *p != ULONG_MAX && p < end; p++) {
>> + for (p = field->caller; p && p < end && *p != ULONG_MAX; p++) {
>>
>> if (trace_seq_has_overflowed(s))
>> break;
>