Re: [Mesa-dev] [PATCH] xf86drm: Fix error path in drmGetDevice2
On 30 July 2018 at 11:23, Michel Dänzer wrote: > On 2018-07-30 12:13 PM, Mariusz Ceier wrote: >> On 30 July 2018 at 11:31, Michel Dänzer wrote: >>> On 2018-07-29 10:20 AM, Mariusz Ceier wrote: In drmGetDevice2 when no local device is found or when drm_device_has_rdev filters out all devices, *device might be left uninitialized causing drmGetDevice2 to not return error - since it's only returned when *device == NULL. Above leads to crash in the firefox in system with amdgpu. With this change firefox displays: libGL error: MESA-LOADER: failed to retrieve device information libGL error: unable to load driver: amdgpu_dri.so libGL error: driver pointer missing libGL error: failed to load driver: amdgpu libGL error: MESA-LOADER: failed to retrieve device information libGL error: unable to load driver: amdgpu_dri.so libGL error: driver pointer missing libGL error: failed to load driver: amdgpu and doesn't crash. Signed-off-by: Mariusz Ceier >>> >>> Good catch. Please add: >>> >>> Bugzilla: https://bugs.freedesktop.org/107384 >>> Reviewed-by: Michel Dänzer >>> >>> Do you need somebody to push this for you? >> >> Yes, I don't have push access :) >> Also should I send v2 patch with the Bugzilla and Reviewed-by tags ? > > No need, I'll add the tags and push it. Thanks! > Thanks Michel, you've beaten me to it by a few minutes. -Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] xf86drm: Fix error path in drmGetDevice2
On 2018-07-30 12:13 PM, Mariusz Ceier wrote: > On 30 July 2018 at 11:31, Michel Dänzer wrote: >> On 2018-07-29 10:20 AM, Mariusz Ceier wrote: >>> In drmGetDevice2 when no local device is found or when >>> drm_device_has_rdev filters out all devices, *device might be left >>> uninitialized causing drmGetDevice2 to not return error - since >>> it's only returned when *device == NULL. >>> >>> Above leads to crash in the firefox in system with amdgpu. >>> >>> With this change firefox displays: >>> >>> libGL error: MESA-LOADER: failed to retrieve device information >>> libGL error: unable to load driver: amdgpu_dri.so >>> libGL error: driver pointer missing >>> libGL error: failed to load driver: amdgpu >>> libGL error: MESA-LOADER: failed to retrieve device information >>> libGL error: unable to load driver: amdgpu_dri.so >>> libGL error: driver pointer missing >>> libGL error: failed to load driver: amdgpu >>> >>> and doesn't crash. >>> >>> Signed-off-by: Mariusz Ceier >> >> Good catch. Please add: >> >> Bugzilla: https://bugs.freedesktop.org/107384 >> Reviewed-by: Michel Dänzer >> >> Do you need somebody to push this for you? > > Yes, I don't have push access :) > Also should I send v2 patch with the Bugzilla and Reviewed-by tags ? No need, I'll add the tags and push it. Thanks! -- Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] xf86drm: Fix error path in drmGetDevice2
On 30 July 2018 at 11:31, Michel Dänzer wrote: > On 2018-07-29 10:20 AM, Mariusz Ceier wrote: >> In drmGetDevice2 when no local device is found or when >> drm_device_has_rdev filters out all devices, *device might be left >> uninitialized causing drmGetDevice2 to not return error - since >> it's only returned when *device == NULL. >> >> Above leads to crash in the firefox in system with amdgpu. >> >> With this change firefox displays: >> >> libGL error: MESA-LOADER: failed to retrieve device information >> libGL error: unable to load driver: amdgpu_dri.so >> libGL error: driver pointer missing >> libGL error: failed to load driver: amdgpu >> libGL error: MESA-LOADER: failed to retrieve device information >> libGL error: unable to load driver: amdgpu_dri.so >> libGL error: driver pointer missing >> libGL error: failed to load driver: amdgpu >> >> and doesn't crash. >> >> Signed-off-by: Mariusz Ceier > > Good catch. Please add: > > Bugzilla: https://bugs.freedesktop.org/107384 > Reviewed-by: Michel Dänzer > > Do you need somebody to push this for you? Yes, I don't have push access :) Also should I send v2 patch with the Bugzilla and Reviewed-by tags ? > > > -- > Earthling Michel Dänzer | http://www.amd.com > Libre software enthusiast | Mesa and X developer ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] xf86drm: Fix error path in drmGetDevice2
On 2018-07-29 10:20 AM, Mariusz Ceier wrote: > In drmGetDevice2 when no local device is found or when > drm_device_has_rdev filters out all devices, *device might be left > uninitialized causing drmGetDevice2 to not return error - since > it's only returned when *device == NULL. > > Above leads to crash in the firefox in system with amdgpu. > > With this change firefox displays: > > libGL error: MESA-LOADER: failed to retrieve device information > libGL error: unable to load driver: amdgpu_dri.so > libGL error: driver pointer missing > libGL error: failed to load driver: amdgpu > libGL error: MESA-LOADER: failed to retrieve device information > libGL error: unable to load driver: amdgpu_dri.so > libGL error: driver pointer missing > libGL error: failed to load driver: amdgpu > > and doesn't crash. > > Signed-off-by: Mariusz Ceier Good catch. Please add: Bugzilla: https://bugs.freedesktop.org/107384 Reviewed-by: Michel Dänzer Do you need somebody to push this for you? -- Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] xf86drm: Fix error path in drmGetDevice2
I think chasing all the invocations of drmGetDevice2 is wrong - since it's drmGetDevice2 that's broken, not the code that uses it. Code that uses drmGetDevice2 expects it to return error when device has not been found. If setting *device in error path is not good, the patch can be modified to not set *device to NULL and return error when it was never assigned in the drmGetDevice2 function - it should also work, though I have not tried it. On 29 July 2018 at 19:20, Christoph Haag wrote: > I've reported this here: > https://bugs.freedesktop.org/show_bug.cgi?id=107384 > > The patch in the comments initializing drmDevicePtr device to NULL makes > it work properly for me. > > I don't think the patch is on the mailing list yet. It's probably a good > idea to check if there are more places where this initialization needs > to be done... > > > On 29.07.2018 10:20, Mariusz Ceier wrote: >> In drmGetDevice2 when no local device is found or when >> drm_device_has_rdev filters out all devices, *device might be left >> uninitialized causing drmGetDevice2 to not return error - since >> it's only returned when *device == NULL. >> >> Above leads to crash in the firefox in system with amdgpu. >> >> With this change firefox displays: >> >> libGL error: MESA-LOADER: failed to retrieve device information >> libGL error: unable to load driver: amdgpu_dri.so >> libGL error: driver pointer missing >> libGL error: failed to load driver: amdgpu >> libGL error: MESA-LOADER: failed to retrieve device information >> libGL error: unable to load driver: amdgpu_dri.so >> libGL error: driver pointer missing >> libGL error: failed to load driver: amdgpu >> >> and doesn't crash. >> >> Signed-off-by: Mariusz Ceier >> --- >> xf86drm.c | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/xf86drm.c b/xf86drm.c >> index 1e621e99..336d64de 100644 >> --- a/xf86drm.c >> +++ b/xf86drm.c >> @@ -3935,6 +3935,8 @@ int drmGetDevice2(int fd, uint32_t flags, drmDevicePtr >> *device) >> >> drmFoldDuplicatedDevices(local_devices, node_count); >> >> +*device = NULL; >> + >> for (i = 0; i < node_count; i++) { >> if (!local_devices[i]) >> continue; >> > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] xf86drm: Fix error path in drmGetDevice2
I've reported this here: https://bugs.freedesktop.org/show_bug.cgi?id=107384 The patch in the comments initializing drmDevicePtr device to NULL makes it work properly for me. I don't think the patch is on the mailing list yet. It's probably a good idea to check if there are more places where this initialization needs to be done... On 29.07.2018 10:20, Mariusz Ceier wrote: > In drmGetDevice2 when no local device is found or when > drm_device_has_rdev filters out all devices, *device might be left > uninitialized causing drmGetDevice2 to not return error - since > it's only returned when *device == NULL. > > Above leads to crash in the firefox in system with amdgpu. > > With this change firefox displays: > > libGL error: MESA-LOADER: failed to retrieve device information > libGL error: unable to load driver: amdgpu_dri.so > libGL error: driver pointer missing > libGL error: failed to load driver: amdgpu > libGL error: MESA-LOADER: failed to retrieve device information > libGL error: unable to load driver: amdgpu_dri.so > libGL error: driver pointer missing > libGL error: failed to load driver: amdgpu > > and doesn't crash. > > Signed-off-by: Mariusz Ceier > --- > xf86drm.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/xf86drm.c b/xf86drm.c > index 1e621e99..336d64de 100644 > --- a/xf86drm.c > +++ b/xf86drm.c > @@ -3935,6 +3935,8 @@ int drmGetDevice2(int fd, uint32_t flags, drmDevicePtr > *device) > > drmFoldDuplicatedDevices(local_devices, node_count); > > +*device = NULL; > + > for (i = 0; i < node_count; i++) { > if (!local_devices[i]) > continue; > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] xf86drm: Fix error path in drmGetDevice2
In drmGetDevice2 when no local device is found or when drm_device_has_rdev filters out all devices, *device might be left uninitialized causing drmGetDevice2 to not return error - since it's only returned when *device == NULL. Above leads to crash in the firefox in system with amdgpu. With this change firefox displays: libGL error: MESA-LOADER: failed to retrieve device information libGL error: unable to load driver: amdgpu_dri.so libGL error: driver pointer missing libGL error: failed to load driver: amdgpu libGL error: MESA-LOADER: failed to retrieve device information libGL error: unable to load driver: amdgpu_dri.so libGL error: driver pointer missing libGL error: failed to load driver: amdgpu and doesn't crash. Signed-off-by: Mariusz Ceier --- xf86drm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xf86drm.c b/xf86drm.c index 1e621e99..336d64de 100644 --- a/xf86drm.c +++ b/xf86drm.c @@ -3935,6 +3935,8 @@ int drmGetDevice2(int fd, uint32_t flags, drmDevicePtr *device) drmFoldDuplicatedDevices(local_devices, node_count); +*device = NULL; + for (i = 0; i < node_count; i++) { if (!local_devices[i]) continue; -- 2.18.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev