Re: [Nouveau] [PATCH v2] drm/nouveau/secboot: remove VLA usage

2018-05-23 Thread Kees Cook
On Wed, May 23, 2018 at 5:36 PM, Ben Skeggs  wrote:
> On Thu, May 24, 2018 at 8:48 AM, Kees Cook  wrote:
>> On Thu, Apr 26, 2018 at 4:25 PM, Kees Cook  wrote:
>>> On Thu, Mar 15, 2018 at 7:05 PM, Ben Skeggs  wrote:
 On 14 March 2018 at 21:08, Thierry Reding  wrote:
> On Tue, Mar 13, 2018 at 11:24:11AM -0500, Gustavo A. R. Silva wrote:
>> In preparation to enabling -Wvla, remove VLA. In this particular
>> case directly use macro NVKM_MSGQUEUE_CMDLINE_SIZE instead of local
>> variable cmdline_size. Also, remove cmdline_size as it is not
>> actually useful anymore.
>>
>> The use of stack Variable Length Arrays needs to be avoided, as they
>> can be a vector for stack exhaustion, which can be both a runtime bug
>> or a security flaw. Also, in general, as code evolves it is easy to
>> lose track of how big a VLA can get. Thus, we can end up having runtime
>> failures that are hard to debug.
>>
>> Also, fixed as part of the directive to remove all VLAs from
>> the kernel: https://lkml.org/lkml/2018/3/7/621
>>
>> Signed-off-by: Gustavo A. R. Silva 
>> ---
>> Changes in v2:
>>  - Use sizeof(buf) instead of NVKM_MSGQUEUE_CMDLINE_SIZE. This change
>>is based on the feedback provided by David Laight. Thanks David.
>>
>>  drivers/gpu/drm/nouveau/nvkm/subdev/secboot/ls_ucode_msgqueue.c | 7 
>> +++
>>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> Reviewed-by: Thierry Reding 
 Thanks everyone.  I've taken the patch in my tree.
>>>
>>> Hi!
>>>
>>> Just checking in on this -- I don't see this patch in linux-next. Is
>>> this queued somewhere else?
>>
>> Hi, it's been another month; I still don't see this in linux-next.
>> Daniel, can this go via drm-misc?
> It's already queued in drm-next.

Ah-ha, great, thanks! Looks like I just got unlucky with linux-next
pausing on the 17th and this getting committed on the 18th. :) But,
yes, I see it now:
https://cgit.freedesktop.org/drm/drm/commit/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/ls_ucode_msgqueue.c?id=7bf5b70befd7817b9e42acbd2291b2042ea1bf81

-Kees

-- 
Kees Cook
Pixel Security
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau


Re: [Nouveau] [PATCH v2] drm/nouveau/secboot: remove VLA usage

2018-05-23 Thread Ben Skeggs
On Thu, May 24, 2018 at 8:48 AM, Kees Cook  wrote:
> On Thu, Apr 26, 2018 at 4:25 PM, Kees Cook  wrote:
>> On Thu, Mar 15, 2018 at 7:05 PM, Ben Skeggs  wrote:
>>> On 14 March 2018 at 21:08, Thierry Reding  wrote:
 On Tue, Mar 13, 2018 at 11:24:11AM -0500, Gustavo A. R. Silva wrote:
> In preparation to enabling -Wvla, remove VLA. In this particular
> case directly use macro NVKM_MSGQUEUE_CMDLINE_SIZE instead of local
> variable cmdline_size. Also, remove cmdline_size as it is not
> actually useful anymore.
>
> The use of stack Variable Length Arrays needs to be avoided, as they
> can be a vector for stack exhaustion, which can be both a runtime bug
> or a security flaw. Also, in general, as code evolves it is easy to
> lose track of how big a VLA can get. Thus, we can end up having runtime
> failures that are hard to debug.
>
> Also, fixed as part of the directive to remove all VLAs from
> the kernel: https://lkml.org/lkml/2018/3/7/621
>
> Signed-off-by: Gustavo A. R. Silva 
> ---
> Changes in v2:
>  - Use sizeof(buf) instead of NVKM_MSGQUEUE_CMDLINE_SIZE. This change
>is based on the feedback provided by David Laight. Thanks David.
>
>  drivers/gpu/drm/nouveau/nvkm/subdev/secboot/ls_ucode_msgqueue.c | 7 
> +++
>  1 file changed, 3 insertions(+), 4 deletions(-)

 Reviewed-by: Thierry Reding 
>>> Thanks everyone.  I've taken the patch in my tree.
>>
>> Hi!
>>
>> Just checking in on this -- I don't see this patch in linux-next. Is
>> this queued somewhere else?
>
> Hi, it's been another month; I still don't see this in linux-next.
> Daniel, can this go via drm-misc?
It's already queued in drm-next.

>
> -Kees
>
> --
> Kees Cook
> Pixel Security
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau


Re: [Nouveau] [PATCH v2] drm/nouveau/secboot: remove VLA usage

2018-05-23 Thread Kees Cook
On Thu, Apr 26, 2018 at 4:25 PM, Kees Cook  wrote:
> On Thu, Mar 15, 2018 at 7:05 PM, Ben Skeggs  wrote:
>> On 14 March 2018 at 21:08, Thierry Reding  wrote:
>>> On Tue, Mar 13, 2018 at 11:24:11AM -0500, Gustavo A. R. Silva wrote:
 In preparation to enabling -Wvla, remove VLA. In this particular
 case directly use macro NVKM_MSGQUEUE_CMDLINE_SIZE instead of local
 variable cmdline_size. Also, remove cmdline_size as it is not
 actually useful anymore.

 The use of stack Variable Length Arrays needs to be avoided, as they
 can be a vector for stack exhaustion, which can be both a runtime bug
 or a security flaw. Also, in general, as code evolves it is easy to
 lose track of how big a VLA can get. Thus, we can end up having runtime
 failures that are hard to debug.

 Also, fixed as part of the directive to remove all VLAs from
 the kernel: https://lkml.org/lkml/2018/3/7/621

 Signed-off-by: Gustavo A. R. Silva 
 ---
 Changes in v2:
  - Use sizeof(buf) instead of NVKM_MSGQUEUE_CMDLINE_SIZE. This change
is based on the feedback provided by David Laight. Thanks David.

  drivers/gpu/drm/nouveau/nvkm/subdev/secboot/ls_ucode_msgqueue.c | 7 
 +++
  1 file changed, 3 insertions(+), 4 deletions(-)
>>>
>>> Reviewed-by: Thierry Reding 
>> Thanks everyone.  I've taken the patch in my tree.
>
> Hi!
>
> Just checking in on this -- I don't see this patch in linux-next. Is
> this queued somewhere else?

Hi, it's been another month; I still don't see this in linux-next.
Daniel, can this go via drm-misc?

-Kees

-- 
Kees Cook
Pixel Security
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau


[Nouveau] [PATCH 21/33] drm/nouveau: use match_string() helper

2018-05-23 Thread Yisheng Xie
match_string() returns the index of an array for a matching string,
which can be used intead of open coded variant.

Cc: Ben Skeggs 
Cc: David Airlie 
Cc: dri-de...@lists.freedesktop.org
Cc: nouveau@lists.freedesktop.org
Signed-off-by: Yisheng Xie 
---
 drivers/gpu/drm/nouveau/dispnv04/tvnv17.c | 13 +
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c 
b/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c
index 6d99f11..a6b4c4a 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c
@@ -644,14 +644,11 @@ static int nv17_tv_create_resources(struct drm_encoder 
*encoder,
int i;
 
if (nouveau_tv_norm) {
-   for (i = 0; i < num_tv_norms; i++) {
-   if (!strcmp(nv17_tv_norm_names[i], nouveau_tv_norm)) {
-   tv_enc->tv_norm = i;
-   break;
-   }
-   }
-
-   if (i == num_tv_norms)
+   i = match_string(nv17_tv_norm_names,
+num_tv_norms, nouveau_tv_norm);
+   if (i >= 0)
+   tv_enc->tv_norm = i;
+   else
NV_WARN(drm, "Invalid TV norm setting \"%s\"\n",
nouveau_tv_norm);
}
-- 
1.7.12.4

___
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau


[Nouveau] [Bug 106592] 2nd GPU / screen not detected after driver / xorg update

2018-05-23 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=106592

--- Comment #2 from Atila Neves  ---
It might be the same problem, yes. It definitely looks similar.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau