AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] drm/amdgpu: Adjust debugfs register access permissions
@ 2024-10-23 21:03 Alex Deucher
  2024-10-23 21:03 ` [PATCH 2/3] drm/amdgpu: Adjust debugfs eviction and IB " Alex Deucher
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Alex Deucher @ 2024-10-23 21:03 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

Regular users shouldn't have read access.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
index 6e6092916d4e..e44a44405266 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
@@ -1654,7 +1654,7 @@ int amdgpu_debugfs_regs_init(struct amdgpu_device *adev)
 
 	for (i = 0; i < ARRAY_SIZE(debugfs_regs); i++) {
 		ent = debugfs_create_file(debugfs_regs_names[i],
-					  S_IFREG | 0444, root,
+					  S_IFREG | 0400, root,
 					  adev, debugfs_regs[i]);
 		if (!i && !IS_ERR_OR_NULL(ent))
 			i_size_write(ent->d_inode, adev->rmmio_size);
-- 
2.46.2


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

* [PATCH 2/3] drm/amdgpu: Adjust debugfs eviction and IB access permissions
  2024-10-23 21:03 [PATCH 1/3] drm/amdgpu: Adjust debugfs register access permissions Alex Deucher
@ 2024-10-23 21:03 ` Alex Deucher
  2024-10-23 21:03 ` [PATCH 3/3] drm/amdgpu: add missing size check in amdgpu_debugfs_gprwave_read() Alex Deucher
  2024-10-28 14:42 ` [PATCH 1/3] drm/amdgpu: Adjust debugfs register access permissions Alex Deucher
  2 siblings, 0 replies; 8+ messages in thread
From: Alex Deucher @ 2024-10-23 21:03 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

Users should not be able to run these.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
index e44a44405266..2ef7bcfdb2e2 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
@@ -2108,11 +2108,11 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)
 	amdgpu_securedisplay_debugfs_init(adev);
 	amdgpu_fw_attestation_debugfs_init(adev);
 
-	debugfs_create_file("amdgpu_evict_vram", 0444, root, adev,
+	debugfs_create_file("amdgpu_evict_vram", 0400, root, adev,
 			    &amdgpu_evict_vram_fops);
-	debugfs_create_file("amdgpu_evict_gtt", 0444, root, adev,
+	debugfs_create_file("amdgpu_evict_gtt", 0400, root, adev,
 			    &amdgpu_evict_gtt_fops);
-	debugfs_create_file("amdgpu_test_ib", 0444, root, adev,
+	debugfs_create_file("amdgpu_test_ib", 0400, root, adev,
 			    &amdgpu_debugfs_test_ib_fops);
 	debugfs_create_file("amdgpu_vm_info", 0444, root, adev,
 			    &amdgpu_debugfs_vm_info_fops);
-- 
2.46.2


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

* [PATCH 3/3] drm/amdgpu: add missing size check in amdgpu_debugfs_gprwave_read()
  2024-10-23 21:03 [PATCH 1/3] drm/amdgpu: Adjust debugfs register access permissions Alex Deucher
  2024-10-23 21:03 ` [PATCH 2/3] drm/amdgpu: Adjust debugfs eviction and IB " Alex Deucher
@ 2024-10-23 21:03 ` Alex Deucher
  2024-10-28 14:42 ` [PATCH 1/3] drm/amdgpu: Adjust debugfs register access permissions Alex Deucher
  2 siblings, 0 replies; 8+ messages in thread
From: Alex Deucher @ 2024-10-23 21:03 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

Avoid a possible buffer overflow if size is larger than 4K.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
index 2ef7bcfdb2e2..3a118645b4bb 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
@@ -402,7 +402,7 @@ static ssize_t amdgpu_debugfs_gprwave_read(struct file *f, char __user *buf, siz
 	int r;
 	uint32_t *data, x;
 
-	if (size & 0x3 || *pos & 0x3)
+	if (size > 4096 || size & 0x3 || *pos & 0x3)
 		return -EINVAL;
 
 	r = pm_runtime_get_sync(adev_to_drm(adev)->dev);
-- 
2.46.2


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

* Re: [PATCH 1/3] drm/amdgpu: Adjust debugfs register access permissions
  2024-10-23 21:03 [PATCH 1/3] drm/amdgpu: Adjust debugfs register access permissions Alex Deucher
  2024-10-23 21:03 ` [PATCH 2/3] drm/amdgpu: Adjust debugfs eviction and IB " Alex Deucher
  2024-10-23 21:03 ` [PATCH 3/3] drm/amdgpu: add missing size check in amdgpu_debugfs_gprwave_read() Alex Deucher
@ 2024-10-28 14:42 ` Alex Deucher
  2024-10-30 16:02   ` Alex Deucher
  2 siblings, 1 reply; 8+ messages in thread
From: Alex Deucher @ 2024-10-28 14:42 UTC (permalink / raw)
  To: Alex Deucher; +Cc: amd-gfx

Ping on this series?

Alex

On Wed, Oct 23, 2024 at 5:04 PM Alex Deucher <alexander.deucher@amd.com> wrote:
>
> Regular users shouldn't have read access.
>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> index 6e6092916d4e..e44a44405266 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> @@ -1654,7 +1654,7 @@ int amdgpu_debugfs_regs_init(struct amdgpu_device *adev)
>
>         for (i = 0; i < ARRAY_SIZE(debugfs_regs); i++) {
>                 ent = debugfs_create_file(debugfs_regs_names[i],
> -                                         S_IFREG | 0444, root,
> +                                         S_IFREG | 0400, root,
>                                           adev, debugfs_regs[i]);
>                 if (!i && !IS_ERR_OR_NULL(ent))
>                         i_size_write(ent->d_inode, adev->rmmio_size);
> --
> 2.46.2
>

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

* Re: [PATCH 1/3] drm/amdgpu: Adjust debugfs register access permissions
  2024-10-28 14:42 ` [PATCH 1/3] drm/amdgpu: Adjust debugfs register access permissions Alex Deucher
@ 2024-10-30 16:02   ` Alex Deucher
  2024-10-31  2:23     ` Wang, Yang(Kevin)
  0 siblings, 1 reply; 8+ messages in thread
From: Alex Deucher @ 2024-10-30 16:02 UTC (permalink / raw)
  To: Alex Deucher; +Cc: amd-gfx

Ping on this series?

Alex

On Mon, Oct 28, 2024 at 10:42 AM Alex Deucher <alexdeucher@gmail.com> wrote:
>
> Ping on this series?
>
> Alex
>
> On Wed, Oct 23, 2024 at 5:04 PM Alex Deucher <alexander.deucher@amd.com> wrote:
> >
> > Regular users shouldn't have read access.
> >
> > Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> > ---
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> > index 6e6092916d4e..e44a44405266 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> > @@ -1654,7 +1654,7 @@ int amdgpu_debugfs_regs_init(struct amdgpu_device *adev)
> >
> >         for (i = 0; i < ARRAY_SIZE(debugfs_regs); i++) {
> >                 ent = debugfs_create_file(debugfs_regs_names[i],
> > -                                         S_IFREG | 0444, root,
> > +                                         S_IFREG | 0400, root,
> >                                           adev, debugfs_regs[i]);
> >                 if (!i && !IS_ERR_OR_NULL(ent))
> >                         i_size_write(ent->d_inode, adev->rmmio_size);
> > --
> > 2.46.2
> >

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

* RE: [PATCH 1/3] drm/amdgpu: Adjust debugfs register access permissions
  2024-10-30 16:02   ` Alex Deucher
@ 2024-10-31  2:23     ` Wang, Yang(Kevin)
  2024-10-31  2:58       ` Alex Deucher
  0 siblings, 1 reply; 8+ messages in thread
From: Wang, Yang(Kevin) @ 2024-10-31  2:23 UTC (permalink / raw)
  To: Alex Deucher, Deucher, Alexander; +Cc: amd-gfx@lists.freedesktop.org

[AMD Official Use Only - AMD Internal Distribution Only]

Reviewed-by: Yang Wang <kevinyang.wang@amd.com>

Best Regards,
Kevin

-----Original Message-----
From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Alex Deucher
Sent: Thursday, October 31, 2024 12:03 AM
To: Deucher, Alexander <Alexander.Deucher@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/3] drm/amdgpu: Adjust debugfs register access permissions

Ping on this series?

Alex

On Mon, Oct 28, 2024 at 10:42 AM Alex Deucher <alexdeucher@gmail.com> wrote:
>
> Ping on this series?
>
> Alex
>
> On Wed, Oct 23, 2024 at 5:04 PM Alex Deucher <alexander.deucher@amd.com> wrote:
> >
> > Regular users shouldn't have read access.
> >
> > Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> > ---
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> > index 6e6092916d4e..e44a44405266 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> > @@ -1654,7 +1654,7 @@ int amdgpu_debugfs_regs_init(struct amdgpu_device *adev)
> >
> >         for (i = 0; i < ARRAY_SIZE(debugfs_regs); i++) {
> >                 ent = debugfs_create_file(debugfs_regs_names[i],
> > -                                         S_IFREG | 0444, root,
> > +                                         S_IFREG | 0400, root,
> >                                           adev, debugfs_regs[i]);
> >                 if (!i && !IS_ERR_OR_NULL(ent))
> >                         i_size_write(ent->d_inode, adev->rmmio_size);
> > --
> > 2.46.2
> >

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

* Re: [PATCH 1/3] drm/amdgpu: Adjust debugfs register access permissions
  2024-10-31  2:23     ` Wang, Yang(Kevin)
@ 2024-10-31  2:58       ` Alex Deucher
  2024-10-31  3:31         ` Wang, Yang(Kevin)
  0 siblings, 1 reply; 8+ messages in thread
From: Alex Deucher @ 2024-10-31  2:58 UTC (permalink / raw)
  To: Wang, Yang(Kevin); +Cc: Deucher, Alexander, amd-gfx@lists.freedesktop.org

On Wed, Oct 30, 2024 at 10:23 PM Wang, Yang(Kevin)
<KevinYang.Wang@amd.com> wrote:
>
> [AMD Official Use Only - AMD Internal Distribution Only]
>
> Reviewed-by: Yang Wang <kevinyang.wang@amd.com>

Is this for the whole series or just the first patch?

Thanks,

Alex

>
> Best Regards,
> Kevin
>
> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Alex Deucher
> Sent: Thursday, October 31, 2024 12:03 AM
> To: Deucher, Alexander <Alexander.Deucher@amd.com>
> Cc: amd-gfx@lists.freedesktop.org
> Subject: Re: [PATCH 1/3] drm/amdgpu: Adjust debugfs register access permissions
>
> Ping on this series?
>
> Alex
>
> On Mon, Oct 28, 2024 at 10:42 AM Alex Deucher <alexdeucher@gmail.com> wrote:
> >
> > Ping on this series?
> >
> > Alex
> >
> > On Wed, Oct 23, 2024 at 5:04 PM Alex Deucher <alexander.deucher@amd.com> wrote:
> > >
> > > Regular users shouldn't have read access.
> > >
> > > Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> > > ---
> > >  drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> > > index 6e6092916d4e..e44a44405266 100644
> > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> > > @@ -1654,7 +1654,7 @@ int amdgpu_debugfs_regs_init(struct amdgpu_device *adev)
> > >
> > >         for (i = 0; i < ARRAY_SIZE(debugfs_regs); i++) {
> > >                 ent = debugfs_create_file(debugfs_regs_names[i],
> > > -                                         S_IFREG | 0444, root,
> > > +                                         S_IFREG | 0400, root,
> > >                                           adev, debugfs_regs[i]);
> > >                 if (!i && !IS_ERR_OR_NULL(ent))
> > >                         i_size_write(ent->d_inode, adev->rmmio_size);
> > > --
> > > 2.46.2
> > >

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

* RE: [PATCH 1/3] drm/amdgpu: Adjust debugfs register access permissions
  2024-10-31  2:58       ` Alex Deucher
@ 2024-10-31  3:31         ` Wang, Yang(Kevin)
  0 siblings, 0 replies; 8+ messages in thread
From: Wang, Yang(Kevin) @ 2024-10-31  3:31 UTC (permalink / raw)
  To: Alex Deucher; +Cc: Deucher, Alexander, amd-gfx@lists.freedesktop.org

[AMD Official Use Only - AMD Internal Distribution Only]

-----Original Message-----
From: Alex Deucher <alexdeucher@gmail.com>
Sent: Thursday, October 31, 2024 10:59 AM
To: Wang, Yang(Kevin) <KevinYang.Wang@amd.com>
Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/3] drm/amdgpu: Adjust debugfs register access permissions

On Wed, Oct 30, 2024 at 10:23 PM Wang, Yang(Kevin) <KevinYang.Wang@amd.com> wrote:
>
> [AMD Official Use Only - AMD Internal Distribution Only]
>
> Reviewed-by: Yang Wang <kevinyang.wang@amd.com>

Is this for the whole series or just the first patch?

Thanks,

Alex

[Kevin]:

the whole patch set is looks good to me.

Series is
Reviewed-by: Yang Wang <kevinyang.wang@amd.com>

Best Regards,
Kevin

>
> Best Regards,
> Kevin
>
> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of
> Alex Deucher
> Sent: Thursday, October 31, 2024 12:03 AM
> To: Deucher, Alexander <Alexander.Deucher@amd.com>
> Cc: amd-gfx@lists.freedesktop.org
> Subject: Re: [PATCH 1/3] drm/amdgpu: Adjust debugfs register access
> permissions
>
> Ping on this series?
>
> Alex
>
> On Mon, Oct 28, 2024 at 10:42 AM Alex Deucher <alexdeucher@gmail.com> wrote:
> >
> > Ping on this series?
> >
> > Alex
> >
> > On Wed, Oct 23, 2024 at 5:04 PM Alex Deucher <alexander.deucher@amd.com> wrote:
> > >
> > > Regular users shouldn't have read access.
> > >
> > > Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> > > ---
> > >  drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> > > b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> > > index 6e6092916d4e..e44a44405266 100644
> > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> > > @@ -1654,7 +1654,7 @@ int amdgpu_debugfs_regs_init(struct
> > > amdgpu_device *adev)
> > >
> > >         for (i = 0; i < ARRAY_SIZE(debugfs_regs); i++) {
> > >                 ent = debugfs_create_file(debugfs_regs_names[i],
> > > -                                         S_IFREG | 0444, root,
> > > +                                         S_IFREG | 0400, root,
> > >                                           adev, debugfs_regs[i]);
> > >                 if (!i && !IS_ERR_OR_NULL(ent))
> > >                         i_size_write(ent->d_inode,
> > > adev->rmmio_size);
> > > --
> > > 2.46.2
> > >

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

end of thread, other threads:[~2024-10-31  3:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-23 21:03 [PATCH 1/3] drm/amdgpu: Adjust debugfs register access permissions Alex Deucher
2024-10-23 21:03 ` [PATCH 2/3] drm/amdgpu: Adjust debugfs eviction and IB " Alex Deucher
2024-10-23 21:03 ` [PATCH 3/3] drm/amdgpu: add missing size check in amdgpu_debugfs_gprwave_read() Alex Deucher
2024-10-28 14:42 ` [PATCH 1/3] drm/amdgpu: Adjust debugfs register access permissions Alex Deucher
2024-10-30 16:02   ` Alex Deucher
2024-10-31  2:23     ` Wang, Yang(Kevin)
2024-10-31  2:58       ` Alex Deucher
2024-10-31  3:31         ` Wang, Yang(Kevin)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox