linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/7] t_next should increase position index
@ 2020-01-24  7:02 Vasily Averin
  2020-01-29 17:12 ` Steven Rostedt
  0 siblings, 1 reply; 3+ messages in thread
From: Vasily Averin @ 2020-01-24  7:02 UTC (permalink / raw)
  To: linux-kernel
  Cc: Andrew Morton, NeilBrown, Waiman Long, Steven Rostedt,
	Ingo Molnar, Peter Oberparleiter

if seq_file .next fuction does not change position index,
read after some lseek can generate unexpected output.

https://bugzilla.kernel.org/show_bug.cgi?id=206283
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
 kernel/trace/ftrace.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 9bf1f2c..ca25210 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -3442,8 +3442,10 @@ static void *t_mod_start(struct seq_file *m, loff_t *pos)
 	loff_t l = *pos; /* t_probe_start() must use original pos */
 	void *ret;
 
-	if (unlikely(ftrace_disabled))
+	if (unlikely(ftrace_disabled)) {
+		(*pos)++;
 		return NULL;
+	}
 
 	if (iter->flags & FTRACE_ITER_PROBE)
 		return t_probe_next(m, pos);
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 3/7] t_next should increase position index
  2020-01-24  7:02 [PATCH 3/7] t_next should increase position index Vasily Averin
@ 2020-01-29 17:12 ` Steven Rostedt
  2020-01-30  7:17   ` Vasily Averin
  0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2020-01-29 17:12 UTC (permalink / raw)
  To: Vasily Averin
  Cc: linux-kernel, Andrew Morton, NeilBrown, Waiman Long, Ingo Molnar,
	Peter Oberparleiter

On Fri, 24 Jan 2020 10:02:51 +0300
Vasily Averin <vvs@virtuozzo.com> wrote:

> if seq_file .next fuction does not change position index,
> read after some lseek can generate unexpected output.
> 
> https://bugzilla.kernel.org/show_bug.cgi?id=206283
> Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
> ---
>  kernel/trace/ftrace.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index 9bf1f2c..ca25210 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -3442,8 +3442,10 @@ static void *t_mod_start(struct seq_file *m, loff_t *pos)
>  	loff_t l = *pos; /* t_probe_start() must use original pos */
>  	void *ret;
>  
> -	if (unlikely(ftrace_disabled))
> +	if (unlikely(ftrace_disabled)) {
> +		(*pos)++;
>  		return NULL;
> +	}

This isn't needed. If ftrace_disabled is set, we shouldn't be printing
anything. This case isn't the same as the report in the bugzilla.

-- Steve

>  
>  	if (iter->flags & FTRACE_ITER_PROBE)
>  		return t_probe_next(m, pos);


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 3/7] t_next should increase position index
  2020-01-29 17:12 ` Steven Rostedt
@ 2020-01-30  7:17   ` Vasily Averin
  0 siblings, 0 replies; 3+ messages in thread
From: Vasily Averin @ 2020-01-30  7:17 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: linux-kernel, Andrew Morton, NeilBrown, Waiman Long, Ingo Molnar,
	Peter Oberparleiter

On 1/29/20 8:12 PM, Steven Rostedt wrote:
> On Fri, 24 Jan 2020 10:02:51 +0300
> Vasily Averin <vvs@virtuozzo.com> wrote:
> 
>> if seq_file .next fuction does not change position index,
>> read after some lseek can generate unexpected output.
>>
>> https://bugzilla.kernel.org/show_bug.cgi?id=206283
>> Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
>> ---
>>  kernel/trace/ftrace.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
>> index 9bf1f2c..ca25210 100644
>> --- a/kernel/trace/ftrace.c
>> +++ b/kernel/trace/ftrace.c
>> @@ -3442,8 +3442,10 @@ static void *t_mod_start(struct seq_file *m, loff_t *pos)
>>  	loff_t l = *pos; /* t_probe_start() must use original pos */
>>  	void *ret;
>>  
>> -	if (unlikely(ftrace_disabled))
>> +	if (unlikely(ftrace_disabled)) {
>> +		(*pos)++;
>>  		return NULL;
>> +	}
> 
> This isn't needed. If ftrace_disabled is set, we shouldn't be printing
> anything. This case isn't the same as the report in the bugzilla.

I'm agree, thank you, let's drop this patch.

Vasily Averin

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-01-30  7:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-24  7:02 [PATCH 3/7] t_next should increase position index Vasily Averin
2020-01-29 17:12 ` Steven Rostedt
2020-01-30  7:17   ` Vasily Averin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).