* [PATCH 1/1] drm/i915: shorten i915_next_seqno debugfs output
@ 2013-04-11 13:22 Mika Kuoppala
2013-04-11 16:02 ` Kees Cook
2013-04-12 9:10 ` [PATCH] drm/i915: shorten debugfs output simple attributes Mika Kuoppala
0 siblings, 2 replies; 9+ messages in thread
From: Mika Kuoppala @ 2013-04-11 13:22 UTC (permalink / raw)
To: intel-gfx; +Cc: Kees Cook
commit 647416f9eefe7699754b01b9fc82758fde83248c
Author: Kees Cook <keescook@chromium.org>
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.
Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
---
drivers/gpu/drm/i915/i915_debugfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index be88532..afe9421 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -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)
{
--
1.7.9.5
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/1] drm/i915: shorten i915_next_seqno debugfs output
2013-04-11 13:22 [PATCH 1/1] drm/i915: shorten i915_next_seqno debugfs output Mika Kuoppala
@ 2013-04-11 16:02 ` Kees Cook
2013-04-11 16:15 ` Mika Kuoppala
2013-04-12 9:10 ` [PATCH] drm/i915: shorten debugfs output simple attributes Mika Kuoppala
1 sibling, 1 reply; 9+ messages in thread
From: Kees Cook @ 2013-04-11 16:02 UTC (permalink / raw)
To: Mika Kuoppala; +Cc: intel-gfx
On Thu, Apr 11, 2013 at 6:22 AM, Mika Kuoppala
<mika.kuoppala@linux.intel.com> wrote:
> commit 647416f9eefe7699754b01b9fc82758fde83248c
> Author: Kees Cook <keescook@chromium.org>
> 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.
>
> Cc: Kees Cook <keescook@chromium.org>
> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
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
> ---
> drivers/gpu/drm/i915/i915_debugfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index be88532..afe9421 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -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)
> {
> --
> 1.7.9.5
>
--
Kees Cook
Chrome OS Security
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/1] drm/i915: shorten i915_next_seqno debugfs output
2013-04-11 16:02 ` Kees Cook
@ 2013-04-11 16:15 ` Mika Kuoppala
2013-04-11 16:42 ` Kees Cook
0 siblings, 1 reply; 9+ messages in thread
From: Mika Kuoppala @ 2013-04-11 16:15 UTC (permalink / raw)
To: Kees Cook; +Cc: intel-gfx
Kees Cook <keescook@chromium.org> writes:
> On Thu, Apr 11, 2013 at 6:22 AM, Mika Kuoppala
> <mika.kuoppala@linux.intel.com> wrote:
>> commit 647416f9eefe7699754b01b9fc82758fde83248c
>> Author: Kees Cook <keescook@chromium.org>
>> 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.
>>
>> Cc: Kees Cook <keescook@chromium.org>
>> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
>
> 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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/1] drm/i915: shorten i915_next_seqno debugfs output
2013-04-11 16:15 ` Mika Kuoppala
@ 2013-04-11 16:42 ` Kees Cook
2013-04-12 9:15 ` Mika Kuoppala
0 siblings, 1 reply; 9+ messages in thread
From: Kees Cook @ 2013-04-11 16:42 UTC (permalink / raw)
To: Mika Kuoppala; +Cc: intel-gfx
On Thu, Apr 11, 2013 at 9:15 AM, Mika Kuoppala
<mika.kuoppala@linux.intel.com> wrote:
> Kees Cook <keescook@chromium.org> writes:
>
>> On Thu, Apr 11, 2013 at 6:22 AM, Mika Kuoppala
>> <mika.kuoppala@linux.intel.com> wrote:
>>> commit 647416f9eefe7699754b01b9fc82758fde83248c
>>> Author: Kees Cook <keescook@chromium.org>
>>> 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.
>>>
>>> Cc: Kees Cook <keescook@chromium.org>
>>> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
>>
>> 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
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH] drm/i915: shorten debugfs output simple attributes
2013-04-11 13:22 [PATCH 1/1] drm/i915: shorten i915_next_seqno debugfs output Mika Kuoppala
2013-04-11 16:02 ` Kees Cook
@ 2013-04-12 9:10 ` Mika Kuoppala
2013-04-12 18:00 ` Kees Cook
1 sibling, 1 reply; 9+ messages in thread
From: Mika Kuoppala @ 2013-04-12 9:10 UTC (permalink / raw)
To: intel-gfx; +Cc: Kees Cook
commit 647416f9eefe7699754b01b9fc82758fde83248c
Author: Kees Cook <keescook@chromium.org>
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)
Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
---
drivers/gpu/drm/i915/i915_debugfs.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index be88532..7e60bb5 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -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)
--
1.7.9.5
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/1] drm/i915: shorten i915_next_seqno debugfs output
2013-04-11 16:42 ` Kees Cook
@ 2013-04-12 9:15 ` Mika Kuoppala
2013-04-12 17:57 ` Kees Cook
0 siblings, 1 reply; 9+ messages in thread
From: Mika Kuoppala @ 2013-04-12 9:15 UTC (permalink / raw)
To: Kees Cook; +Cc: intel-gfx
Kees Cook <keescook@chromium.org> writes:
> On Thu, Apr 11, 2013 at 9:15 AM, Mika Kuoppala
> <mika.kuoppala@linux.intel.com> wrote:
>> Kees Cook <keescook@chromium.org> writes:
>>
>>> On Thu, Apr 11, 2013 at 6:22 AM, Mika Kuoppala
>>> <mika.kuoppala@linux.intel.com> wrote:
>>>> commit 647416f9eefe7699754b01b9fc82758fde83248c
>>>> Author: Kees Cook <keescook@chromium.org>
>>>> 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.
>>>>
>>>> Cc: Kees Cook <keescook@chromium.org>
>>>> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
>>>
>>> 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.
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/1] drm/i915: shorten i915_next_seqno debugfs output
2013-04-12 9:15 ` Mika Kuoppala
@ 2013-04-12 17:57 ` Kees Cook
0 siblings, 0 replies; 9+ messages in thread
From: Kees Cook @ 2013-04-12 17:57 UTC (permalink / raw)
To: Mika Kuoppala; +Cc: intel-gfx
On Fri, Apr 12, 2013 at 2:15 AM, Mika Kuoppala
<mika.kuoppala@linux.intel.com> wrote:
> Kees Cook <keescook@chromium.org> writes:
>
>> On Thu, Apr 11, 2013 at 9:15 AM, Mika Kuoppala
>> <mika.kuoppala@linux.intel.com> wrote:
>>> Kees Cook <keescook@chromium.org> writes:
>>>
>>>> On Thu, Apr 11, 2013 at 6:22 AM, Mika Kuoppala
>>>> <mika.kuoppala@linux.intel.com> wrote:
>>>>> commit 647416f9eefe7699754b01b9fc82758fde83248c
>>>>> Author: Kees Cook <keescook@chromium.org>
>>>>> 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.
>>>>>
>>>>> Cc: Kees Cook <keescook@chromium.org>
>>>>> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
>>>>
>>>> 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.
>
> 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.
That works too. :) If you want, consider them:
Acked-by: Kees Cook <keescook@chromium.org>
:)
Thanks!
-Kees
--
Kees Cook
Chrome OS Security
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] drm/i915: shorten debugfs output simple attributes
2013-04-12 9:10 ` [PATCH] drm/i915: shorten debugfs output simple attributes Mika Kuoppala
@ 2013-04-12 18:00 ` Kees Cook
2013-04-16 7:33 ` Daniel Vetter
0 siblings, 1 reply; 9+ messages in thread
From: Kees Cook @ 2013-04-12 18:00 UTC (permalink / raw)
To: Mika Kuoppala; +Cc: intel-gfx
On Fri, Apr 12, 2013 at 2:10 AM, Mika Kuoppala
<mika.kuoppala@linux.intel.com> wrote:
> commit 647416f9eefe7699754b01b9fc82758fde83248c
> Author: Kees Cook <keescook@chromium.org>
> 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)
>
> Cc: Kees Cook <keescook@chromium.org>
> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Acked-by: Kees Cook <keescook@chromium.org>
--
Kees Cook
Chrome OS Security
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] drm/i915: shorten debugfs output simple attributes
2013-04-12 18:00 ` Kees Cook
@ 2013-04-16 7:33 ` Daniel Vetter
0 siblings, 0 replies; 9+ messages in thread
From: Daniel Vetter @ 2013-04-16 7:33 UTC (permalink / raw)
To: Kees Cook; +Cc: intel-gfx
On Fri, Apr 12, 2013 at 11:00:20AM -0700, Kees Cook wrote:
> On Fri, Apr 12, 2013 at 2:10 AM, Mika Kuoppala
> <mika.kuoppala@linux.intel.com> wrote:
> > commit 647416f9eefe7699754b01b9fc82758fde83248c
> > Author: Kees Cook <keescook@chromium.org>
> > 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)
> >
> > Cc: Kees Cook <keescook@chromium.org>
> > Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
>
> Acked-by: Kees Cook <keescook@chromium.org>
Queued for -next, thanks for the patch.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2013-04-16 7:30 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-11 13:22 [PATCH 1/1] drm/i915: shorten i915_next_seqno debugfs output Mika Kuoppala
2013-04-11 16:02 ` Kees Cook
2013-04-11 16:15 ` Mika Kuoppala
2013-04-11 16:42 ` Kees Cook
2013-04-12 9:15 ` Mika Kuoppala
2013-04-12 17:57 ` Kees Cook
2013-04-12 9:10 ` [PATCH] drm/i915: shorten debugfs output simple attributes Mika Kuoppala
2013-04-12 18:00 ` Kees Cook
2013-04-16 7:33 ` Daniel Vetter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.