drm/i915: shorten i915_next_seqno debugfs output
Subsystems (2)
PATCH 1/1 drm/i915: shorten i915_next_seqno debugfs output
commit 647416f9eefe7699754b01b9fc82758fde83248c
Author: Kees Cook <[email protected]> Date: Sun Mar 10 14:10:06 2013 -0700
drm/i915: use simple attribute in debugfs routines
made i915_next_seqno debugfs entry to crop it's output if returned value was large enough. Using simple_attr will limit the output to 24 bytes. Fix this by returning only the value and nothing else.
--- drivers/gpu/drm/i915/i915_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_debugfs.c +1 -1
@@ -901,7 +901,7 @@ i915_next_seqno_set(void *data, u64 val)DEFINE_SIMPLE_ATTRIBUTE (i915_next_seqno_fops, i915_next_seqno_get, i915_next_seqno_set, -"next_seqno : 0x%llx\n" ); +"0x%llx\n" );static int i915_rstdby_delays (struct seq_file *m,void *unused) {
Signature · 1 line
1.7.9.5
Quoted 6 lines · Mika Kuoppala
commit
647416f9eefe7699754b01b9fc82758fde83248cAuthor: Kees Cook <[email protected]> Date: Sun Mar 10 14:10:06 2013 -0700drm/i915: use simple attribute in debugfs routines
Quoted 7 lines
made
i915_next_seqnodebugfs entry to crop it's output if returned value was large enough. Usingsimple_attrwill limit the output to 24 bytes. Fix this by returning only the value and nothing else.Cc Kees Cook <[email protected]>Signed-off-by Mika Kuoppala <[email protected]>
Oh! Thanks for catching that. What a weird limitation.
What about max freq, min freq, and wedged? Do those run the risk of truncation too?
-Kees
Quoted 18 lines
--- drivers/gpu/drm/i915/i915_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/i915/i915_debugfs.c +1
-2@@ -901,7 +901,7 @@ i915_next_seqno_set(void *data, u64 val)DEFINE_SIMPLE_ATTRIBUTE (i915_next_seqno_fops, i915_next_seqno_get, i915_next_seqno_set, -"next_seqno : 0x%llx\n" ); +"0x%llx\n" );static int i915_rstdby_delays (struct seq_file *m,void *unused) { --
Quoted 2 lines
1.7.9.5
--
Kees Cook
Chrome OS Security
Quoted 13 lines · Kees Cook
Quoted 11 lines · Mika Kuoppala
commit
647416f9eefe7699754b01b9fc82758fde83248cAuthor: Kees Cook <[email protected]> Date: Sun Mar 10 14:10:06 2013 -0700drm/i915: use simple attribute in debugfs routines
made
i915_next_seqnodebugfs entry to crop it's output if returned value was large enough. Usingsimple_attrwill limit the output to 24 bytes. Fix this by returning only the value and nothing else.
Quoted 7 lines
Quoted 2 lines
Cc Kees Cook <[email protected]>Signed-off-by Mika Kuoppala <[email protected]>Oh! Thanks for catching that. What a weird limitation.
What about max freq, min freq, and wedged? Do those run the risk of truncation too?
max and min freq should be safe, and wedged too on 32bit platforms. But if gpu is declared wedged on host with 64bit atomic_t, it will crop the output.
-Mika
Quoted 18 lines · Mika Kuoppala
Quoted 16 lines · Kees Cook
Quoted 13 lines · Mika Kuoppala
commit
647416f9eefe7699754b01b9fc82758fde83248cAuthor: Kees Cook <[email protected]> Date: Sun Mar 10 14:10:06 2013 -0700drm/i915: use simple attribute in debugfs routines
made
i915_next_seqnodebugfs entry to crop it's output if returned value was large enough. Usingsimple_attrwill limit the output to 24 bytes. Fix this by returning only the value and nothing else.Cc Kees Cook <[email protected]>Signed-off-by Mika Kuoppala <[email protected]>
Quoted 8 lines
Quoted 4 lines
Oh! Thanks for catching that. What a weird limitation.
What about max freq, min freq, and wedged? Do those run the risk of truncation too?
max and min freq should be safe, and wedged too on 32bit platforms. But if gpu is declared wedged on host with 64bit
atomic_t, it will crop the output.
Should we consider proposing an increase in the size of the simple attr buffer? It seems silly to provide an arbitrary format string but leave the buffer so small.
-Kees
--
Kees Cook
Chrome OS Security
Quoted 25 lines · Kees Cook
Quoted 23 lines · Mika Kuoppala
Quoted 20 lines · Kees Cook
Quoted 6 lines · Mika Kuoppala
commit
647416f9eefe7699754b01b9fc82758fde83248cAuthor: Kees Cook <[email protected]> Date: Sun Mar 10 14:10:06 2013 -0700drm/i915: use simple attribute in debugfs routines
Quoted 7 lines
made
i915_next_seqnodebugfs entry to crop it's output if returned value was large enough. Usingsimple_attrwill limit the output to 24 bytes. Fix this by returning only the value and nothing else.Cc Kees Cook <[email protected]>Signed-off-by Mika Kuoppala <[email protected]>Oh! Thanks for catching that. What a weird limitation.
What about max freq, min freq, and wedged? Do those run the risk of truncation too?
Quoted 7 lines
Quoted 3 lines
max and min freq should be safe, and wedged too on 32bit platforms. But if gpu is declared wedged on host with 64bit
atomic_t, it will crop the output.Should we consider proposing an increase in the size of the simple attr buffer? It seems silly to provide an arbitrary format string but leave the buffer so small.
That or dynamic allocation to attr->get_buf. But that would need extra pass with snprintf and I don't know if that qualifies as 'simple' anymore.
I have posted a patch which fixes all i915 debugfs simple attributes to fit into the simple_attr by removing everything except the fmt to value. I didn't find any testcases which would rely on preample being there.
--Mika
Kees Cook
Acked-byQuoted 35 lines · Mika Kuoppala
Quoted 25 lines · Kees Cook
Quoted 23 lines · Mika Kuoppala
Quoted 20 lines · Kees Cook
Quoted 6 lines · Mika Kuoppala
commit
647416f9eefe7699754b01b9fc82758fde83248cAuthor: Kees Cook <[email protected]> Date: Sun Mar 10 14:10:06 2013 -0700drm/i915: use simple attribute in debugfs routines
Quoted 7 lines
made
i915_next_seqnodebugfs entry to crop it's output if returned value was large enough. Usingsimple_attrwill limit the output to 24 bytes. Fix this by returning only the value and nothing else.Cc Kees Cook <[email protected]>Signed-off-by Mika Kuoppala <[email protected]>Oh! Thanks for catching that. What a weird limitation.
What about max freq, min freq, and wedged? Do those run the risk of truncation too?
Quoted 7 lines
Quoted 3 lines
max and min freq should be safe, and wedged too on 32bit platforms. But if gpu is declared wedged on host with 64bit
atomic_t, it will crop the output.Should we consider proposing an increase in the size of the simple attr buffer? It seems silly to provide an arbitrary format string but leave the buffer so small.
Quoted 8 lines
That or dynamic allocation to
attr->get_buf. But that would need extra pass with snprintf and I don't know if that qualifies as 'simple' anymore.I have posted a patch which fixes all i915 debugfs simple attributes to fit into the
simple_attrby removing everything except the fmt to value. I didn't find any testcases which would rely on preample being there.
That works too. :) If you want, consider them:
:)
Thanks!
-Kees
--
Kees Cook
Chrome OS Security
PATCH 1/1 drm/i915: shorten debugfs output simple attributes
In reply to Mika Kuoppalacommit 647416f9eefe7699754b01b9fc82758fde83248c
Author: Kees Cook <[email protected]> Date: Sun Mar 10 14:10:06 2013 -0700
drm/i915: use simple attribute in debugfs routines
made i915_next_seqno debugfs entry to crop it's output if returned value was large enough. Using simple_attr will limit the output to 24 bytes.
Fix is to strip out preamples on all simple attributes that have one.
v2: Fix all simple attributes (Daniel Vetter)
--- drivers/gpu/drm/i915/i915_debugfs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +4 -4
@@ -901,7 +901,7 @@ i915_next_seqno_set(void *data, u64 val)DEFINE_SIMPLE_ATTRIBUTE (i915_next_seqno_fops, i915_next_seqno_get, i915_next_seqno_set, -"next_seqno : 0x%llx\n" ); +"0x%llx\n" );static int i915_rstdby_delays (struct seq_file *m,void *unused) {
@@ -1687,7 +1687,7 @@ i915_wedged_set(void *data, u64 val)DEFINE_SIMPLE_ATTRIBUTE (i915_wedged_fops, i915_wedged_get, i915_wedged_set, -"wedged : %llu\n" ); +"%llu\n" );static int i915_ring_stop_get (void *data,u64 *val)
@@ -1841,7 +1841,7 @@ i915_max_freq_set(void *data, u64 val)DEFINE_SIMPLE_ATTRIBUTE (i915_max_freq_fops, i915_max_freq_get, i915_max_freq_set, -"max freq: %llu\n" ); +"%llu\n" );static int i915_min_freq_get (void *data,u64 *val)
@@ -1892,7 +1892,7 @@ i915_min_freq_set(void *data, u64 val)DEFINE_SIMPLE_ATTRIBUTE (i915_min_freq_fops, i915_min_freq_get, i915_min_freq_set, -"min freq: %llu\n" ); +"%llu\n" );static int i915_cache_sharing_get (void *data,u64 *val)
Signature · 1 line
1.7.9.5
Re: [PATCH] drm/i915: shorten debugfs output simple attributes
Quoted 10 lines · Mika Kuoppala
commit
647416f9eefe7699754b01b9fc82758fde83248cAuthor: Kees Cook <[email protected]> Date: Sun Mar 10 14:10:06 2013 -0700drm/i915: use simple attribute in debugfs routines
made
i915_next_seqnodebugfs entry to crop it's output if returned value was large enough. Usingsimple_attrwill limit the output to 24 bytes.
Quoted 7 lines
Fix is to strip out preamples on all simple attributes that have one.
v2: Fix all simple attributes (Daniel Vetter)
Cc Kees Cook <[email protected]>Signed-off-by Mika Kuoppala <[email protected]>
Signature · 2 lines
Kees Cook Chrome OS Security
Daniel Vetter
AppliedRe: [PATCH] drm/i915: shorten debugfs output simple attributes
Quoted 15 lines · Kees Cook
Quoted 13 lines · Mika Kuoppala
commit
647416f9eefe7699754b01b9fc82758fde83248cAuthor: Kees Cook <[email protected]> Date: Sun Mar 10 14:10:06 2013 -0700drm/i915: use simple attribute in debugfs routines
made
i915_next_seqnodebugfs entry to crop it's output if returned value was large enough. Usingsimple_attrwill limit the output to 24 bytes.Fix is to strip out preamples on all simple attributes that have one.
Quoted 6 lines
Quoted 4 lines
v2: Fix all simple attributes (Daniel Vetter)
Cc Kees Cook <[email protected]>Signed-off-by Mika Kuoppala <[email protected]>Acked-by Kees Cook <[email protected]>
Queued for -next, thanks for the patch.
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch