Message ID | 20230306154244.17560-1-ldufour@linux.ibm.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D04EC6FA99 for <linux-mm@archiver.kernel.org>; Mon, 6 Mar 2023 15:42:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AE4966B007D; Mon, 6 Mar 2023 10:42:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A94BD6B0080; Mon, 6 Mar 2023 10:42:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 95D4B280001; Mon, 6 Mar 2023 10:42:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 869ED6B007D for <linux-mm@kvack.org>; Mon, 6 Mar 2023 10:42:56 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 63956AA5DA for <linux-mm@kvack.org>; Mon, 6 Mar 2023 15:42:56 +0000 (UTC) X-FDA: 80538891552.29.7F4F001 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf20.hostedemail.com (Postfix) with ESMTP id 286DC1C0018 for <linux-mm@kvack.org>; Mon, 6 Mar 2023 15:42:52 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=RwF+WS2s; spf=pass (imf20.hostedemail.com: domain of ldufour@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=ldufour@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1678117373; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=gRD8JJYANQoaDeDDLwQmfnykMhkvwfwnnj9U9gA27mA=; b=1XOgvx6RpjAQEG7edjkq3lbuNK+HuWQqu7H1/VWxtQO+knjjlwQJuy13bvG68J4Zt6IS/f 1WW/m78pqJ0CY/ut1lE3rSjYRSY+CpabvVufCL7RDM/OjpfO17g1QzdelrvagYFwfC+nNq LGluglGUjDtDFkecyRn5vrWfM+Vqejo= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=RwF+WS2s; spf=pass (imf20.hostedemail.com: domain of ldufour@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=ldufour@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1678117373; a=rsa-sha256; cv=none; b=YDyJ1VD5dpvF7ghWmZms0rJpTxMRjMHuHWEju9sGnpD4wOiSQQr4wLUzFO6n4pdXiajUin peLkt4BwQ4A6WoaoxAg9KJn4OoqttX7TH3aE6pj/Mr1f7YzS3qJAT4Hdt2e7a8i/ETgfTo mfKnW3bggFgsBp+hrDqxKCOubhyVwxI= Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 326E4LLY001767; Mon, 6 Mar 2023 15:42:52 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : mime-version; s=pp1; bh=gRD8JJYANQoaDeDDLwQmfnykMhkvwfwnnj9U9gA27mA=; b=RwF+WS2sbs3pY6qpfiH/Mg/AiGkJtDL8Szo/CPP7ILaGTWas7c2TsmUOBH8lsq/xJoLk 9hMlK1/JvSePnTiOkaPypLnXdW1ylzqjK/9AMyWCkkFpGxrMkIEeU3z+iu5G2CnV1uRw ruu5QY5uc9tZ366jnawo0hd5shRT73Ps7Eesp27mOXB1aQ6ZrfHdoceqr29se8/q6H4i QQo5Kc5FiH/dmfFKAFaMJuGjLiPTq/hkpkoyFJfzwQYT8YJCgvu4MX9sSAZJMTzU8eT3 Uh1k+v6Wfko4XGThcQ14+6LL8eyUZNJlVcuSEub/7ND/rFaV5tTJflpY/ofF0ZG8yctt 0A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3p507nyvs5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 06 Mar 2023 15:42:51 +0000 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 326Ce6F2002185; Mon, 6 Mar 2023 15:42:51 GMT Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3p507nyvrp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 06 Mar 2023 15:42:51 +0000 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 326ChqkM030497; Mon, 6 Mar 2023 15:42:49 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma03ams.nl.ibm.com (PPS) with ESMTPS id 3p418ctwy5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 06 Mar 2023 15:42:49 +0000 Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 326FgjHX60948904 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 6 Mar 2023 15:42:45 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B6E5A2004B; Mon, 6 Mar 2023 15:42:45 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6F73420040; Mon, 6 Mar 2023 15:42:45 +0000 (GMT) Received: from localhost.localdomain (unknown [9.101.4.33]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 6 Mar 2023 15:42:45 +0000 (GMT) From: Laurent Dufour <ldufour@linux.ibm.com> To: Suren Baghdasaryan <surenb@google.com> Cc: linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Sachin Sant <sachinp@linux.ibm.com> Subject: [PATCH] powerpc/mm: fix mmap_lock bad unlock Date: Mon, 6 Mar 2023 16:42:44 +0100 Message-Id: <20230306154244.17560-1-ldufour@linux.ibm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230227173632.3292573-32-surenb@google.com> References: <20230227173632.3292573-32-surenb@google.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: TOFUYNI1VTUM3RFw2H_83gmSy3TZcZN8 X-Proofpoint-ORIG-GUID: mnzNAchC0gIq82GWAbKWIQCKzlMizBE8 Content-Transfer-Encoding: 8bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-06_08,2023-03-06_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 adultscore=0 phishscore=0 mlxlogscore=999 bulkscore=0 lowpriorityscore=0 suspectscore=0 clxscore=1015 impostorscore=0 mlxscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303060137 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 286DC1C0018 X-Stat-Signature: 1dfjbi1u9dnewsg8691swwcbx3wu3iof X-Rspam-User: X-HE-Tag: 1678117372-636155 X-HE-Meta: U2FsdGVkX19FjCv7/28O9Ix3EpENR8uerkVUO4oCGxZq3TOAFcxYrkh3Fv+sDhJExZO4xBgK9NmWf0WUVMbCPONQmuyyK+LEbTX3uOvh9LCW3XNOY/n6zDqbK1dbIs1rpQKffFawLNnOYyS8NBSFuyWv28yZiaDWlr8s2GZfGl+dAU8Ygd9sm3mi4sfl9wuOFWYVBDdv9S2BsFzQHsVqqv+ITMlJuTBfg3+rmoBbvQELg5pnwM12wst4xOXq0RVqsIV137I/yB/YGtRhmH2iA3BiDv6eJr3iMj/0aFMR15HUohfOuSqg3xJZyh/7UVvnL0JiwGA7rlN42egBo2c2Yt0gIKhS4A3nN3m0nPTQjAdfj5qhdLxKCwcoBFqV4AFd56jf88a1qgeRa+tU57jH+kCSXc+T3Z2RmYKQb+FFjjZO8YfNO2Y9+YTclQFll3tnzEds/BCYrlS7govoE3/970CNu4O7E6cJ+npg/2Qsb8u2PiPoaTCK4PGS0NfFtCCA+kDJX07Khz8N9x/8BPcdnbKlFzu04ogRbYtgvDFTVAMXh3K3y4y6R8sX4rJFIsqB8u9XwPX195S64kCIntg04gfyE8oyrwHvyXyXc9I8KlF2SeB7W5/xswCBSMJ2W+qMVo8g+lF9TK/sLwBDVXpb/Xd2mjCOXE4YVbZOvOBzMAMcTpYk/4Qvk+U6SB62zN4DDTubWvrobJM4SXEqzzxg6nUA/WDttfIYHkJbX+pj4mfIQVilcmqZdlsxb8Kcw3fwsNvm+7jQHYxNnUWABevHgMbqDuhEubgKn6uWjgl9yDTTjc5jhOSDc5K/tP5B0McLzlgTavAleZ3WeVWIPv60DQAj1QbRara9w7NA8Uf1mPH24qNoSIxuLpjz3Qz0dlnTvoz3/h0d9o+m9z+RumejJEm/zdjpE/Lapfkk5aZw32I1G4PTLlnSOqAyS/EEOarB2gJFRdro0C+zdLjQA1O FcWtekf0 6GO4TDseCaTpiZMwjU7fcKJwh6XfO+Kr5DDhTLW0dpeietx0bsqhTGHEGlauhNrZL054aM99O8oC2mR8OhGwKsYbTVc5foNSFT8H389WVulrAGlgj4roNnvpCHYIdbM5pll17D2V0xPfFUbjdvpkhVtTcW2qN1T9s9e3ljuiTxFrA3c77Iyb2asOslqIBjAs7u+kTGGkgTMFyClwbkxy3JL6QqG10XyBcKt7qa2Ji3J1cdlqG9cmU7M4T2ce5YIXDE+Bm0iMpm1zhb4DSI7RyXWQT3SIasW9Qp3Y6 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> |
Series |
powerpc/mm: fix mmap_lock bad unlock
|
expand
|
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c index c7ae86b04b8a..e191b3ebd8d6 100644 --- a/arch/powerpc/mm/fault.c +++ b/arch/powerpc/mm/fault.c @@ -479,17 +479,13 @@ static int ___do_page_fault(struct pt_regs *regs, unsigned long address, if (unlikely(access_pkey_error(is_write, is_exec, (error_code & DSISR_KEYFAULT), vma))) { - int rc = bad_access_pkey(regs, address, vma); - vma_end_read(vma); - return rc; + goto lock_mmap; } if (unlikely(access_error(is_write, is_exec, vma))) { - int rc = bad_access(regs, address); - vma_end_read(vma); - return rc; + goto lock_mmap; } fault = handle_mm_fault(vma, address, flags | FAULT_FLAG_VMA_LOCK, regs);
When page fault is tried holding the per VMA lock, bad_access_pkey() and bad_access() should not be called because it is assuming the mmap_lock is held. In the case a bad access is detected, fall back to the default path, grabbing the mmap_lock to handle the fault and report the error. Fixes: 169db3bb4609 ("powerc/mm: try VMA lock-based page fault handling first") Reported-by: Sachin Sant <sachinp@linux.ibm.com> Link: https://lore.kernel.org/linux-mm/842502FB-F99C-417C-9648-A37D0ECDC9CE@linux.ibm.com Cc: Suren Baghdasaryan <surenb@google.com> Signed-off-by: Laurent Dufour <ldufour@linux.ibm.com> --- arch/powerpc/mm/fault.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)