Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 790D412D209 for ; Fri, 24 May 2024 15:10:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716563440; cv=none; b=Z11JjozM1PiuLFW80aL4DOpjIVsWFUkc9ulfBs8nMXw4jS5WaqFITBc5lEaHjl3VmVj27Tl1xNyrddvipij8owBA5FxXL3KXYgJh40mMWv+Hf1N1THaAhFQMpTTRUjigahyM5Wi3w9sBoXOZrwtr5StnbjC7kN/j6Ry9pduwa00= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716563440; c=relaxed/simple; bh=VP7gVABDAgW9L5iRuMrp4g9ECfcVrAx+q8+3cUVHVX0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=k+oCRN9Xf4lpxt+r2+swnOVeedX/4aMbpsrHyWgOTxXXK6V8wtBHNnKCu9HKIA2hBiYlZrunnUB50LpKFLQPYUCkdFGyvzEO/uVHlDbiwURaTeY68PTjoiHV1Zdxc9/AqbjGFvochm2PWGjc3p84RGhEVEsYpcirR3xUnX9e2ic= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=kgmpvavQ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="kgmpvavQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B87FC32782; Fri, 24 May 2024 15:10:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1716563439; bh=VP7gVABDAgW9L5iRuMrp4g9ECfcVrAx+q8+3cUVHVX0=; h=From:To:Cc:Subject:Date:Reply-to:From; b=kgmpvavQe+zqAGGT14+JkGbGzDP8xG7FYdWu4bwNtOe+G/KEtIWsSbk5pzGhFxT1t B+5aZ+CTy6Dxh7xUNmH/1TyCmF4LgfOd7IR1UUOs+R6jnyFXEWufUeYzVp0TmHoURP mJsiq82LdCZVcoZlof+etacL0rGwiHeOpUkpKU1w= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2021-47531: drm/msm: Fix mmap to include VM_IO and VM_DONTDUMP Date: Fri, 24 May 2024 17:09:51 +0200 Message-ID: <2024052436-CVE-2021-47531-3ab6@gregkh> X-Mailer: git-send-email 2.45.1 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=4172; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=VP7gVABDAgW9L5iRuMrp4g9ECfcVrAx+q8+3cUVHVX0=; b=owGbwMvMwCRo6H6F97bub03G02pJDGkBaze8DnYOYxTR81X+NSUtoyPTxLg5hl9Y3f1l8cQd7 4w4p6t1xLIwCDIxyIopsnzZxnN0f8UhRS9D29Mwc1iZQIYwcHEKwER8tjDMd49/1bZWd83931f6 S2/embTA9AaDDcM8i24tHn7HI4WG9092Sq5YnRJf2uAHAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit Description =========== In the Linux kernel, the following vulnerability has been resolved: drm/msm: Fix mmap to include VM_IO and VM_DONTDUMP In commit 510410bfc034 ("drm/msm: Implement mmap as GEM object function") we switched to a new/cleaner method of doing things. That's good, but we missed a little bit. Before that commit, we used to _first_ run through the drm_gem_mmap_obj() case where `obj->funcs->mmap()` was NULL. That meant that we ran: vma->vm_flags |= VM_IO | VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP; vma->vm_page_prot = pgprot_writecombine(vm_get_page_prot(vma->vm_flags)); vma->vm_page_prot = pgprot_decrypted(vma->vm_page_prot); ...and _then_ we modified those mappings with our own. Now that `obj->funcs->mmap()` is no longer NULL we don't run the default code. It looks like the fact that the vm_flags got VM_IO / VM_DONTDUMP was important because we're now getting crashes on Chromebooks that use ARC++ while logging out. Specifically a crash that looks like this (this is on a 5.10 kernel w/ relevant backports but also seen on a 5.15 kernel): Unable to handle kernel paging request at virtual address ffffffc008000000 Mem abort info: ESR = 0x96000006 EC = 0x25: DABT (current EL), IL = 32 bits SET = 0, FnV = 0 EA = 0, S1PTW = 0 Data abort info: ISV = 0, ISS = 0x00000006 CM = 0, WnR = 0 swapper pgtable: 4k pages, 39-bit VAs, pgdp=000000008293d000 [ffffffc008000000] pgd=00000001002b3003, p4d=00000001002b3003, pud=00000001002b3003, pmd=0000000000000000 Internal error: Oops: 96000006 [#1] PREEMPT SMP [...] CPU: 7 PID: 15734 Comm: crash_dump64 Tainted: G W 5.10.67 #1 [...] Hardware name: Qualcomm Technologies, Inc. sc7280 IDP SKU2 platform (DT) pstate: 80400009 (Nzcv daif +PAN -UAO -TCO BTYPE=--) pc : __arch_copy_to_user+0xc0/0x30c lr : copyout+0xac/0x14c [...] Call trace: __arch_copy_to_user+0xc0/0x30c copy_page_to_iter+0x1a0/0x294 process_vm_rw_core+0x240/0x408 process_vm_rw+0x110/0x16c __arm64_sys_process_vm_readv+0x30/0x3c el0_svc_common+0xf8/0x250 do_el0_svc+0x30/0x80 el0_svc+0x10/0x1c el0_sync_handler+0x78/0x108 el0_sync+0x184/0x1c0 Code: f8408423 f80008c3 910020c6 36100082 (b8404423) Let's add the two flags back in. While we're at it, the fact that we aren't running the default means that we _don't_ need to clear out VM_PFNMAP, so remove that and save an instruction. NOTE: it was confirmed that VM_IO was the important flag to fix the problem I was seeing, but adding back VM_DONTDUMP seems like a sane thing to do so I'm doing that too. The Linux kernel CVE team has assigned CVE-2021-47531 to this issue. Affected and fixed versions =========================== Issue introduced in 5.15 with commit 510410bfc034 and fixed in 5.15.7 with commit 8e2b7fe5e8a4 Issue introduced in 5.15 with commit 510410bfc034 and fixed in 5.16 with commit 3466d9e217b3 Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2021-47531 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: drivers/gpu/drm/msm/msm_gem.c Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/8e2b7fe5e8a4be5e571561d9afcfbd92097288ba https://git.kernel.org/stable/c/3466d9e217b337bf473ee629c608e53f9f3ab786