Skip to contentSkip to conversation

drm/amdgpu: fix the wrong logic checking when secure buffer is created (v2)

PATCH Superseded Huang Rui 3 participants 8 messages Feb 18, 2020

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Huang Rui

author
#0 lore raw

PATCH v2 1/1 drm/amdgpu: fix the wrong logic checking when secure buffer is created (v2)

While the current amdgpu doesn't support TMZ, it will return the error if user mode would like to allocate secure buffer.

Fixes 17d907c drm/amdgpu: implement TMZ accessor (v3)

v2: we didn't need this checking anymore.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +0 -5
index b51a060..5cbc63a 100644
@@ -235,11 +235,6 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data,
 	if (args->in.domains & ~AMDGPU_GEM_DOMAIN_MASK)
 		return -EINVAL;
 
-	if (amdgpu_is_tmz(adev) && (flags & AMDGPU_GEM_CREATE_ENCRYPTED)) {
-		DRM_ERROR("Cannot allocate secure buffer since TMZ is disabled\n");
-		return -EINVAL;
-	}
-
 	/* create a gem object to contain this object in */
 	if (args->in.domains & (AMDGPU_GEM_DOMAIN_GDS |
 	    AMDGPU_GEM_DOMAIN_GWS | AMDGPU_GEM_DOMAIN_OA)) {
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
maintainer
#1 lore raw

Am 18.02.20 um 09:30 schrieb Huang Rui:

Quoted 6 lines

While the current amdgpu doesn't support TMZ, it will return the error if user mode would like to allocate secure buffer.

Fixes 17d907c drm/amdgpu: implement TMZ accessor (v3)

v2: we didn't need this checking anymore.

You misunderstood me.

Quoted 11 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 5 -----
  1 file changed, 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +0 -0
index b51a060..5cbc63a 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data, · line 239

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +0 -2
@@ -235,11 +235,6 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data,
  	if (args->in.domains & ~AMDGPU_GEM_DOMAIN_MASK)
  		return -EINVAL;
 
-	if (amdgpu_is_tmz(adev) && (flags & AMDGPU_GEM_CREATE_ENCRYPTED)) {
-		DRM_ERROR("Cannot allocate secure buffer since TMZ is disabled\n");

Only the error message should be removed, but we still need to test the flag.

E.g. in general we should never log that userspace sends invalid parameters.

Regards,
Christian.

drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data, · line 240

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +0 -3
-		return -EINVAL;
-	}
-
  	/* create a gem object to contain this object in */
  	if (args->in.domains & (AMDGPU_GEM_DOMAIN_GDS |
  	    AMDGPU_GEM_DOMAIN_GWS | AMDGPU_GEM_DOMAIN_OA)) {

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

author
#2 lore raw
Quoted 10 lines · Christian

Am 18.02.20 um 09:30 schrieb Huang Rui:

Quoted 6 lines

While the current amdgpu doesn't support TMZ, it will return the error if user mode would like to allocate secure buffer.

Fixes 17d907c drm/amdgpu: implement TMZ accessor (v3)

v2: we didn't need this checking anymore.

You misunderstood me.

ok...

Quoted 14 lines
Quoted 14 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 5 -----
  1 file changed, 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +0 -0
index b51a060..5cbc63a 100644
@@ -235,11 +235,6 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data,
  	if (args->in.domains & ~AMDGPU_GEM_DOMAIN_MASK)
  		return -EINVAL;
 
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data, · line 239

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +0 -2
-	if (amdgpu_is_tmz(adev) && (flags & AMDGPU_GEM_CREATE_ENCRYPTED)) {
-		DRM_ERROR("Cannot allocate secure buffer since TMZ is disabled\n");

Only the error message should be removed, but we still need to test the flag.

E.g. in general we should never log that userspace sends invalid parameters.

Why? It probably can help userspace to understand what wrong input it is.

Thanks,
Ray
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#3 lore raw
Quoted 25 lines · Huang Rui
Quoted 9 lines · Christian

Am 18.02.20 um 09:30 schrieb Huang Rui:

Quoted 6 lines

While the current amdgpu doesn't support TMZ, it will return the error if user mode would like to allocate secure buffer.

Fixes 17d907c drm/amdgpu: implement TMZ accessor (v3)

v2: we didn't need this checking anymore.

You misunderstood me.

ok...

Quoted 13 lines
Quoted 13 lines
---
   drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 5 -----
   1 file changed, 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +0 -0
index b51a060..5cbc63a 100644
@@ -235,11 +235,6 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data,
   	if (args->in.domains & ~AMDGPU_GEM_DOMAIN_MASK)
   		return -EINVAL;
 
Quoted 8 lines
Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data, · line 239

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +0 -2
-	if (amdgpu_is_tmz(adev) && (flags & AMDGPU_GEM_CREATE_ENCRYPTED)) {
-		DRM_ERROR("Cannot allocate secure buffer since TMZ is disabled\n");

Only the error message should be removed, but we still need to test the flag.

E.g. in general we should never log that userspace sends invalid parameters.

Why? It probably can help userspace to understand what wrong input it is.

May be we can use some rate limited logger here.

Nirmoy

Quoted 7 lines

Thanks,
Ray
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Cnirmoy.das%40amd.com%7Cc022e81747e446bfe0c208d7b4504a56%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637176129272549986&sdata=drEDHkueArU6KVFCfUIcU3up%2FlmVhQRbXb7y2JZiSdE%3D&reserved=0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

maintainer
#4 lore raw
In reply to Huang Rui

Am 18.02.20 um 09:55 schrieb Huang Rui:

Quoted 25 lines · Christian
Quoted 9 lines

Am 18.02.20 um 09:30 schrieb Huang Rui:

Quoted 6 lines

While the current amdgpu doesn't support TMZ, it will return the error if user mode would like to allocate secure buffer.

Fixes 17d907c drm/amdgpu: implement TMZ accessor (v3)

v2: we didn't need this checking anymore.

You misunderstood me.

ok...

Quoted 13 lines
Quoted 13 lines
---
   drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 5 -----
   1 file changed, 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +0 -0
index b51a060..5cbc63a 100644
@@ -235,11 +235,6 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data,
   	if (args->in.domains & ~AMDGPU_GEM_DOMAIN_MASK)
   		return -EINVAL;
 
Quoted 8 lines
Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data, · line 239

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +0 -2
-	if (amdgpu_is_tmz(adev) && (flags & AMDGPU_GEM_CREATE_ENCRYPTED)) {
-		DRM_ERROR("Cannot allocate secure buffer since TMZ is disabled\n");

Only the error message should be removed, but we still need to test the flag.

E.g. in general we should never log that userspace sends invalid parameters.

Why? It probably can help userspace to understand what wrong input it is.

That's correct, but it also allows userspace to spam the logs with those messages.

While the kernel tools are rather clever and filter out repeated messages this is still considered a bad idea because it might hide more serious error messages.

What we could do is either make this debug severity or use something DRM_NOTE_ONCE() to print it only once.

Regards,
Christian.

Quoted 3 lines

Thanks,
Ray

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

author
#5 lore raw
Quoted 38 lines · Christian

Am 18.02.20 um 09:55 schrieb Huang Rui:

Quoted 25 lines · Christian
Quoted 9 lines

Am 18.02.20 um 09:30 schrieb Huang Rui:

Quoted 6 lines

While the current amdgpu doesn't support TMZ, it will return the error if user mode would like to allocate secure buffer.

Fixes 17d907c drm/amdgpu: implement TMZ accessor (v3)

v2: we didn't need this checking anymore.

You misunderstood me.

ok...

Quoted 13 lines
Quoted 13 lines
---
   drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 5 -----
   1 file changed, 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +0 -0
index b51a060..5cbc63a 100644
@@ -235,11 +235,6 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data,
   	if (args->in.domains & ~AMDGPU_GEM_DOMAIN_MASK)
   		return -EINVAL;
 
Quoted 8 lines
Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data, · line 239

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +0 -2
-	if (amdgpu_is_tmz(adev) && (flags & AMDGPU_GEM_CREATE_ENCRYPTED)) {
-		DRM_ERROR("Cannot allocate secure buffer since TMZ is disabled\n");

Only the error message should be removed, but we still need to test the flag.

E.g. in general we should never log that userspace sends invalid parameters.

Why? It probably can help userspace to understand what wrong input it is.

That's correct, but it also allows userspace to spam the logs with those messages.

Quoted 6 lines

While the kernel tools are rather clever and filter out repeated messages this is still considered a bad idea because it might hide more serious error messages.

What we could do is either make this debug severity or use something DRM_NOTE_ONCE() to print it only once.

I see, make sense. There is no DRM_ERROR_ONCE() and I think this case is not very hard to check. So let's remove the error message only as you suggested.

Thanks,
Ray
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

author
#6 lore raw
Quoted 39 lines · Huang Rui
Quoted 38 lines · Christian

Am 18.02.20 um 09:55 schrieb Huang Rui:

Quoted 25 lines · Christian
Quoted 9 lines

Am 18.02.20 um 09:30 schrieb Huang Rui:

Quoted 6 lines

While the current amdgpu doesn't support TMZ, it will return the error if user mode would like to allocate secure buffer.

Fixes 17d907c drm/amdgpu: implement TMZ accessor (v3)

v2: we didn't need this checking anymore.

You misunderstood me.

ok...

Quoted 13 lines
Quoted 13 lines
---
   drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 5 -----
   1 file changed, 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +0 -0
index b51a060..5cbc63a 100644
@@ -235,11 +235,6 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data,
   	if (args->in.domains & ~AMDGPU_GEM_DOMAIN_MASK)
   		return -EINVAL;
 
Quoted 8 lines
Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data, · line 239

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +0 -2
-	if (amdgpu_is_tmz(adev) && (flags & AMDGPU_GEM_CREATE_ENCRYPTED)) {
-		DRM_ERROR("Cannot allocate secure buffer since TMZ is disabled\n");

Only the error message should be removed, but we still need to test the flag.

E.g. in general we should never log that userspace sends invalid parameters.

Why? It probably can help userspace to understand what wrong input it is.

That's correct, but it also allows userspace to spam the logs with those messages.

Quoted 8 lines
Quoted 6 lines

While the kernel tools are rather clever and filter out repeated messages this is still considered a bad idea because it might hide more serious error messages.

What we could do is either make this debug severity or use something DRM_NOTE_ONCE() to print it only once.

I see, make sense. There is no DRM_ERROR_ONCE() and I think this case is

How about about DRM_ERROR_RATELIMITED()?

Thanks,
Ray
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

maintainer
#7 lore raw

Am 18.02.20 um 10:44 schrieb Huang Rui:

Quoted 39 lines · Huang Rui
Quoted 38 lines · Christian
Quoted 37 lines

Am 18.02.20 um 09:55 schrieb Huang Rui:

Quoted 25 lines · Christian
Quoted 9 lines

Am 18.02.20 um 09:30 schrieb Huang Rui:

Quoted 6 lines

While the current amdgpu doesn't support TMZ, it will return the error if user mode would like to allocate secure buffer.

Fixes 17d907c drm/amdgpu: implement TMZ accessor (v3)

v2: we didn't need this checking anymore.

You misunderstood me.

ok...

Quoted 13 lines
Quoted 13 lines
---
    drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 5 -----
    1 file changed, 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +0 -0
index b51a060..5cbc63a 100644
@@ -235,11 +235,6 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data,
    	if (args->in.domains & ~AMDGPU_GEM_DOMAIN_MASK)
    		return -EINVAL;
 
Quoted 8 lines
Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data, · line 239

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +0 -2
-	if (amdgpu_is_tmz(adev) && (flags & AMDGPU_GEM_CREATE_ENCRYPTED)) {
-		DRM_ERROR("Cannot allocate secure buffer since TMZ is disabled\n");

Only the error message should be removed, but we still need to test the flag.

E.g. in general we should never log that userspace sends invalid parameters.

Why? It probably can help userspace to understand what wrong input it is.

That's correct, but it also allows userspace to spam the logs with those messages.

Quoted 8 lines
Quoted 7 lines
Quoted 6 lines

While the kernel tools are rather clever and filter out repeated messages this is still considered a bad idea because it might hide more serious error messages.

What we could do is either make this debug severity or use something DRM_NOTE_ONCE() to print it only once.

I see, make sense. There is no DRM_ERROR_ONCE() and I think this case is

How about about DRM_ERROR_RATELIMITED()?

That would work, but I think DRM_NOTE_ONCE() is more appropriate since this is not an error caused inside the kernel.

Regards,
Christian.

Quoted 3 lines

Thanks,
Ray

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx