lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210407012746.16082-1-songqiang@uniontech.com>
Date:   Wed,  7 Apr 2021 09:27:46 +0800
From:   songqiang <songqiang@...ontech.com>
To:     christian.koenig@....com, ray.huang@....com, airlied@...ux.ie,
        daniel@...ll.ch
Cc:     dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
        songqiang <songqiang@...ontech.com>
Subject: [PATCH] drivers/gpu/drm/ttm/ttm_page_allo.c: adjust ttm pages refcount fix the bug: Feb  6 17:13:13 aaa-PC kernel: [  466.271034] BUG: Bad page state in process blur_image  pfn:7aee2 Feb  6 17:13:13 aaa-PC kernel: [  466.271037] page:980000025fca4170 count:0 mapcount:0 mapping:980000025a0dca60 index:0x0 Feb  6 17:13:13 aaa-PC kernel: [  466.271039] flags: 0x1e01fff000000() Feb  6 17:13:13 aaa-PC kernel: [  466.271042] raw: 0001e01fff000000 0000000000000100 0000000000000200 980000025a0dca60 Feb  6 17:13:13 aaa-PC kernel: [  466.271044] raw: 0000000000000000 0000000000000000 00000000ffffffff Feb  6 17:13:13 aaa-PC kernel: [  466.271046] page dumped because: non-NULL mapping Feb  6 17:13:13 aaa-PC kernel: [  466.271047] Modules linked in: bnep fuse bluetooth ecdh_generic sha256_generic cfg80211 rfkill vfat fat serio_raw uio_pdrv_genirq binfmt_misc ip_tables amdgpu chash radeon r8168 loongson gpu_sched Feb  6 17:13:13 aaa-PC kernel: [  466.271059] CPU: 3 PID: 9554 Comm: 
 blur_image Tainted: G    B             4.19.0-loongson-3-desktop #3036 Feb  6 17:13:13 aaa-PC kernel: [  466.271061] Hardware name: Haier Kunlun-LS3A4000-LS7A-desktop/Kunlun-LS3A4000-LS7A-desktop, BIOS Kunlun-V4.0.12V4.0 LS3A4000 03/19/2020 Feb  6 17:13:13 aaa-PC kernel: [  466.271063] Stack : 000000000000007b 000000007400cce0 0000000000000000 0000000000000007 Feb  6 17:13:13 aaa-PC kernel: [  466.271067]         0000000000000000 0000000000000000 0000000000002a82 ffffffff8202c910 Feb  6 17:13:13 aaa-PC kernel: [  466.271070]         0000000000000000 0000000000002a82 0000000000000000 ffffffff81e20000 Feb  6 17:13:13 aaa-PC kernel: [  466.271074]         0000000000000000 ffffffff8021301c ffffffff82040000 6e754b20534f4942 Feb  6 17:13:13 aaa-PC kernel: [  466.271078]         ffff000000000000 0000000000000000 000000007400cce0 0000000000000000 Feb  6 17:13:13 aaa-PC kernel: [  466.271082]         9800000007155d40 ffffffff81cc5470 0000000000000005 6db6db6db6db0000 Feb  6 17:13:13 
 aaa-PC kernel: [  466.271086]         0000000000000003 fffffffffffffffb 0000000000006000 98000002559f4000 Feb  6 17:13:13 aaa-PC kernel: [  466.271090]         980000024a448000 980000024a44b7f0 9800000007155d50 ffffffff819f5158 Feb  6 17:13:13 aaa-PC kernel: [  466.271094]         0000000000000000 0000000000000000 0000000000000000 0000000000000000 Feb  6 17:13:13 aaa-PC kernel: [  466.271097]         9800000007155d40 ffffffff802310c4 ffffffff81e70000 ffffffff819f5158 Feb  6 17:13:13 aaa-PC kernel: [  466.271101]         ... Feb  6 17:13:13 aaa-PC kernel: [  466.271103] Call Trace: Feb  6 17:13:13 aaa-PC kernel: [  466.271107] [<ffffffff802310c4>] show_stack+0x44/0x1c0 Feb  6 17:13:13 aaa-PC kernel: [  466.271110] [<ffffffff819f5158>] dump_stack+0x1d8/0x240 Feb  6 17:13:13 aaa-PC kernel: [  466.271113] [<ffffffff80491c10>] bad_page+0x210/0x2c0 Feb  6 17:13:13 aaa-PC kernel: [  466.271116] [<ffffffff804931c8>] free_pcppages_bulk+0x708/0x900 Feb  6 17:13:13 aaa-PC kernel: [  46
 6.271119] [<ffffffff804980cc>] free_unref_page_list+0x1cc/0x2c0 Feb  6 17:13:13 aaa-PC kernel: [  466.271122] [<ffffffff804ad2c8>] release_pages+0x648/0x900 Feb  6 17:13:13 aaa-PC kernel: [  466.271125] [<ffffffff804f3b48>] tlb_flush_mmu_free+0x88/0x100 Feb  6 17:13:13 aaa-PC kernel: [  466.271128] [<ffffffff804f8a24>] zap_pte_range+0xa24/0x1480 Feb  6 17:13:13 aaa-PC kernel: [  466.271132] [<ffffffff804f98b0>] unmap_page_range+0x1f0/0x500 Feb  6 17:13:13 aaa-PC kernel: [  466.271135] [<ffffffff804fa054>] unmap_vmas+0x154/0x200 Feb  6 17:13:13 aaa-PC kernel: [  466.271138] [<ffffffff8051190c>] exit_mmap+0x20c/0x380 Feb  6 17:13:13 aaa-PC kernel: [  466.271142] [<ffffffff802bb9c8>] mmput+0x148/0x300 Feb  6 17:13:13 aaa-PC kernel: [  466.271145] [<ffffffff802c80d8>] do_exit+0x6d8/0x1900 Feb  6 17:13:13 aaa-PC kernel: [  466.271148] [<ffffffff802cb288>] do_group_exit+0x88/0x1c0 Feb  6 17:13:13 aaa-PC kernel: [  466.271151] [<ffffffff802cb3d8>] sys_exit_group+0x18/0x40 Feb  6 17
 :13:13 aaa-PC kernel: [  466.271155] [<ffffffff8023f954>] syscall_common+0x34/0xa4

Signed-off-by: songqiang <songqiang@...ontech.com>
---
 drivers/gpu/drm/ttm/ttm_page_alloc.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c
index 14660f723f71..f3698f0ad4d7 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c
@@ -736,8 +736,16 @@ static void ttm_put_pages(struct page **pages, unsigned npages, int flags,
 					if (++p != pages[i + j])
 					    break;
 
-				if (j == HPAGE_PMD_NR)
+				if (j == HPAGE_PMD_NR) {
 					order = HPAGE_PMD_ORDER;
+					for (j = 1; j < HPAGE_PMD_NR; ++j)
+						page_ref_dec(pages[i+j]);
+				}
 			}
 #endif
 
@@ -868,10 +876,12 @@ static int ttm_get_pages(struct page **pages, unsigned npages, int flags,
 				p = alloc_pages(huge_flags, HPAGE_PMD_ORDER);
 				if (!p)
 					break;
-
-				for (j = 0; j < HPAGE_PMD_NR; ++j)
+				for (j = 0; j < HPAGE_PMD_NR; ++j) {
 					pages[i++] = p++;
-
+					if (j > 0)
+						page_ref_inc(pages[i-1]);
+				}
 				npages -= HPAGE_PMD_NR;
 			}
 		}



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ