Re: [Intel-gfx] [RFC PATCH] drm/ttm: Fix swapping dereferences of freed memory

2021-05-28 Thread Christian König
Am 28.05.21 um 16:17 schrieb Thomas Hellström: On 5/28/21 4:10 PM, Christian König wrote: Am 28.05.21 um 09:33 schrieb Thomas Hellström: On Fri, 2021-05-28 at 09:16 +0200, Christian König wrote: Am 27.05.21 um 17:51 schrieb Thomas Hellström: On Thu, 2021-05-27 at 17:32 +0200, Christian Kön

Re: [Intel-gfx] [RFC PATCH] drm/ttm: Fix swapping dereferences of freed memory

2021-05-28 Thread Thomas Hellström
On 5/28/21 4:10 PM, Christian König wrote: Am 28.05.21 um 09:33 schrieb Thomas Hellström: On Fri, 2021-05-28 at 09:16 +0200, Christian König wrote: Am 27.05.21 um 17:51 schrieb Thomas Hellström: On Thu, 2021-05-27 at 17:32 +0200, Christian König wrote: Am 27.05.21 um 17:05 schrieb Thomas Hel

Re: [Intel-gfx] [RFC PATCH] drm/ttm: Fix swapping dereferences of freed memory

2021-05-28 Thread Christian König
Am 28.05.21 um 09:33 schrieb Thomas Hellström: On Fri, 2021-05-28 at 09:16 +0200, Christian König wrote: Am 27.05.21 um 17:51 schrieb Thomas Hellström: On Thu, 2021-05-27 at 17:32 +0200, Christian König wrote: Am 27.05.21 um 17:05 schrieb Thomas Hellström: On Thu, 2021-05-27 at 17:01 +0200, T

Re: [Intel-gfx] [RFC PATCH] drm/ttm: Fix swapping dereferences of freed memory

2021-05-28 Thread Thomas Hellström
On Fri, 2021-05-28 at 09:16 +0200, Christian König wrote: > Am 27.05.21 um 17:51 schrieb Thomas Hellström: > > On Thu, 2021-05-27 at 17:32 +0200, Christian König wrote: > > > Am 27.05.21 um 17:05 schrieb Thomas Hellström: > > > > On Thu, 2021-05-27 at 17:01 +0200, Thomas Hellström wrote: > > > > >

Re: [Intel-gfx] [RFC PATCH] drm/ttm: Fix swapping dereferences of freed memory

2021-05-28 Thread Christian König
Am 27.05.21 um 17:51 schrieb Thomas Hellström: On Thu, 2021-05-27 at 17:32 +0200, Christian König wrote: Am 27.05.21 um 17:05 schrieb Thomas Hellström: On Thu, 2021-05-27 at 17:01 +0200, Thomas Hellström wrote: On Thu, 2021-05-27 at 16:54 +0200, Christian König wrote: Am 27.05.21 um 16:19 sch

Re: [Intel-gfx] [RFC PATCH] drm/ttm: Fix swapping dereferences of freed memory

2021-05-27 Thread Thomas Hellström
On Thu, 2021-05-27 at 17:32 +0200, Christian König wrote: > Am 27.05.21 um 17:05 schrieb Thomas Hellström: > > On Thu, 2021-05-27 at 17:01 +0200, Thomas Hellström wrote: > > > On Thu, 2021-05-27 at 16:54 +0200, Christian König wrote: > > > > Am 27.05.21 um 16:19 schrieb Thomas Hellström: > > > > >

Re: [Intel-gfx] [RFC PATCH] drm/ttm: Fix swapping dereferences of freed memory

2021-05-27 Thread Christian König
Am 27.05.21 um 17:05 schrieb Thomas Hellström: On Thu, 2021-05-27 at 17:01 +0200, Thomas Hellström wrote: On Thu, 2021-05-27 at 16:54 +0200, Christian König wrote: Am 27.05.21 um 16:19 schrieb Thomas Hellström: The swapping code was dereference bo->ttm pointers without having the dma-resv lock

Re: [Intel-gfx] [RFC PATCH] drm/ttm: Fix swapping dereferences of freed memory

2021-05-27 Thread Christian König
Am 27.05.21 um 17:01 schrieb Thomas Hellström: On Thu, 2021-05-27 at 16:54 +0200, Christian König wrote: Am 27.05.21 um 16:19 schrieb Thomas Hellström: The swapping code was dereference bo->ttm pointers without having the dma-resv lock held. Also it might try to swap out unpopulated bos. Fix t

Re: [Intel-gfx] [RFC PATCH] drm/ttm: Fix swapping dereferences of freed memory

2021-05-27 Thread Thomas Hellström
On Thu, 2021-05-27 at 17:01 +0200, Thomas Hellström wrote: > On Thu, 2021-05-27 at 16:54 +0200, Christian König wrote: > > Am 27.05.21 um 16:19 schrieb Thomas Hellström: > > > The swapping code was dereference bo->ttm pointers without having > > > the > > > dma-resv lock held. Also it might try to

Re: [Intel-gfx] [RFC PATCH] drm/ttm: Fix swapping dereferences of freed memory

2021-05-27 Thread Thomas Hellström
On Thu, 2021-05-27 at 16:54 +0200, Christian König wrote: > Am 27.05.21 um 16:19 schrieb Thomas Hellström: > > The swapping code was dereference bo->ttm pointers without having > > the > > dma-resv lock held. Also it might try to swap out unpopulated bos. > > > > Fix this by moving the bo->ttm der

Re: [Intel-gfx] [RFC PATCH] drm/ttm: Fix swapping dereferences of freed memory

2021-05-27 Thread Christian König
Am 27.05.21 um 16:19 schrieb Thomas Hellström: The swapping code was dereference bo->ttm pointers without having the dma-resv lock held. Also it might try to swap out unpopulated bos. Fix this by moving the bo->ttm dereference until we have the reservation lock. Check that the ttm_tt is populate

[Intel-gfx] [RFC PATCH] drm/ttm: Fix swapping dereferences of freed memory

2021-05-27 Thread Thomas Hellström
The swapping code was dereference bo->ttm pointers without having the dma-resv lock held. Also it might try to swap out unpopulated bos. Fix this by moving the bo->ttm dereference until we have the reservation lock. Check that the ttm_tt is populated after the swap_notify callback. Signed-off-by: