From patchwork Sun Apr 7 08:12:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13620044 Return-Path: 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 423B7CD1292 for ; Sun, 7 Apr 2024 08:12:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9BA116B0093; Sun, 7 Apr 2024 04:12:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8AECB6B0096; Sun, 7 Apr 2024 04:12:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 68C416B009B; Sun, 7 Apr 2024 04:12:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 435296B0096 for ; Sun, 7 Apr 2024 04:12:26 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 0609E1608CC for ; Sun, 7 Apr 2024 08:12:26 +0000 (UTC) X-FDA: 81982018692.09.40B4F3D Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by imf05.hostedemail.com (Postfix) with ESMTP id 59C35100011 for ; Sun, 7 Apr 2024 08:12:22 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf05.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712477544; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ULNBkPgbSEHebVTZpMnjhm/VZsW9ZzTVVDCMVJEkNg0=; b=WK2XvD+pjP5bUr+Gb7VRjjHVYzK9BIXvXz0CM1HkMjYMpIleHpEy16Lyyv/1Bjv2HuyHHU sHoh+KvWdR915bqGRsh7h3TeXsBHHpFYNvHnIm71M0AOUcAWHvR+lhqnzaWG7br1RXqm2e t2j7sJFlecRcUgaToxY6kLRcOQ99vnU= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf05.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712477544; a=rsa-sha256; cv=none; b=1KcM+bF8eWagL/iMHB34yKHrxiqW6PX63wq69Qv8WEYzTGEr/n/dZBaKLtIrykA/WkPAdl PY8y8hYciZZMOtcfCu/Y3Z6QrQuQeKLgUloOTfY3wFzcGGC5Q8dzv1CjTBFCYYwqfWhgWj ktJ/rbfZYWxS3nRca5okENXdTXZXhL4= Received: from mail.maildlp.com (unknown [172.19.163.44]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4VC4dq2PdDz1ymJp; Sun, 7 Apr 2024 16:10:07 +0800 (CST) Received: from dggpemm100001.china.huawei.com (unknown [7.185.36.93]) by mail.maildlp.com (Postfix) with ESMTPS id A06811400D3; Sun, 7 Apr 2024 16:12:19 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Sun, 7 Apr 2024 16:12:19 +0800 From: Kefeng Wang To: Andrew Morton , Russell King , Catalin Marinas , Will Deacon CC: , , Kefeng Wang Subject: [PATCH 1/2] arm64: mm: drop VM_FAULT_BADMAP/VM_FAULT_BADACCESS Date: Sun, 7 Apr 2024 16:12:10 +0800 Message-ID: <20240407081211.2292362-2-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20240407081211.2292362-1-wangkefeng.wang@huawei.com> References: <20240407081211.2292362-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm100001.china.huawei.com (7.185.36.93) X-Rspamd-Queue-Id: 59C35100011 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 6fo14dk3bt8ech1zd54f51a1wifqqx93 X-HE-Tag: 1712477542-996464 X-HE-Meta: U2FsdGVkX18w6UYVfQmVL0OPjT/zyn9V8BKJ7BJcMmZ/Yk12TgXLVMLB4vi2akmLqXTJP65KKotQk6pxqrCTr7sSIf7FXfXhZ7JkBNYrr3YwEjNHHFbfBPJr7rJytvdh/iCUHxYn3H0Bn/4KNTpgqFAwCa2/L7796Jqkaga5rZA4aDPta88UgxQrM680dhQ/I05/b//q82HKpMvqmkKlrOWgJN0tJ1shYDP0fNQk0u05XyJxdwtlICmMgfjvTZA/zOJCzckbF3rWvwFSidG3Td4xnFh6vsgaLyP/biljBqavmIoh2fpQ7IXekz6NLfHu1wtf0vjNY0Oe1INhDNDKPCVF38A8kqEBec59wrjED9qrN9UZ3pKEbJOQDQi684KUjGE9ENQ/e3fjbRtxLTpTemoYPLmu8AbESzJVWHdK46lOOtIGTo7RaFhW6vsV52b639ZFSyxuZrRW01HBAoZPGzXML49T9uiKvfkjQnFOjWpG3RASOQtjiNV1KzhzJDx2S+Kqf+/3OpQZoqtvKQjLboFermAlyIZpAYu/26+G7HyyGcqkF1gTpfNpLkYgXbMBPPfZ/KI/Y5wES9AepS5J5Eb+xzfkMW2+6i+WXiTVIP2vWI9tKS7bfyEUntgGCCgo6/ZWDoLQmicylByAA9u8y5PJ7MZqCt/vbL4EXRNI6yn9sZFY7YB0S1PONLX5Zs0OUUM4Coq8eQ9nLvFUR73LMHxxRjpjTzMpoKtI5Ec28OkWqFTk6AYFG3hlOuZR4qrPIjp25HFhkHvtSTRYvQCQ8+E8q2quyeGq3ym4y5oDA7C9gUUH2HLIiSc1ZH6F+2mXUOroCFd1HYTPCT+isUQTMYqf2jHJANtl7Qz9D4K2VFCFPruePUyRtHQo3eXxWCHQticD554XWBgmhbmhddnVwaVo4AiAnnVX0BK0kdwFMnuS/Uh+vbDcCEyZOa+1KQ3YQGQGi1r8ZJTCQXKcOkc KKmHFbe6 vRKqBsGE3SUM/9Tenvi5G/nTYmJr2pytb/m4jxs02UZg38+u7TgdBWFZt+IBeKjMZP9whhQirMTGRIo8n2mFC8yU+TjMiQIZJRSKn8VCu0fN3j8CNcp+IfSBxLWE0N0yTFobnIqC6UcBmZw1L1hVASMsnbfTWbMCk6VMRhMkBx1ONplvWxr7lDc/3Hmh+fX/fQk2v X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: If bad map or access, directly set si_code to SEGV_MAPRR or SEGV_ACCERR, also set fault to 0 and goto error handling, which make us to drop the arch's special vm fault reason. Signed-off-by: Kefeng Wang --- arch/arm64/mm/fault.c | 41 ++++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c index 405f9aa831bd..61a2acae0dca 100644 --- a/arch/arm64/mm/fault.c +++ b/arch/arm64/mm/fault.c @@ -500,9 +500,6 @@ static bool is_write_abort(unsigned long esr) return (esr & ESR_ELx_WNR) && !(esr & ESR_ELx_CM); } -#define VM_FAULT_BADMAP ((__force vm_fault_t)0x010000) -#define VM_FAULT_BADACCESS ((__force vm_fault_t)0x020000) - static int __kprobes do_page_fault(unsigned long far, unsigned long esr, struct pt_regs *regs) { @@ -513,6 +510,7 @@ static int __kprobes do_page_fault(unsigned long far, unsigned long esr, unsigned int mm_flags = FAULT_FLAG_DEFAULT; unsigned long addr = untagged_addr(far); struct vm_area_struct *vma; + int si_code; if (kprobe_page_fault(regs, esr)) return 0; @@ -572,9 +570,10 @@ static int __kprobes do_page_fault(unsigned long far, unsigned long esr, if (!(vma->vm_flags & vm_flags)) { vma_end_read(vma); - fault = VM_FAULT_BADACCESS; + fault = 0; + si_code = SEGV_ACCERR; count_vm_vma_lock_event(VMA_LOCK_SUCCESS); - goto done; + goto bad_area; } fault = handle_mm_fault(vma, addr, mm_flags | FAULT_FLAG_VMA_LOCK, regs); if (!(fault & (VM_FAULT_RETRY | VM_FAULT_COMPLETED))) @@ -599,15 +598,18 @@ static int __kprobes do_page_fault(unsigned long far, unsigned long esr, retry: vma = lock_mm_and_find_vma(mm, addr, regs); if (unlikely(!vma)) { - fault = VM_FAULT_BADMAP; - goto done; + fault = 0; + si_code = SEGV_MAPERR; + goto bad_area; } - if (!(vma->vm_flags & vm_flags)) - fault = VM_FAULT_BADACCESS; - else - fault = handle_mm_fault(vma, addr, mm_flags, regs); + if (!(vma->vm_flags & vm_flags)) { + fault = 0; + si_code = SEGV_ACCERR; + goto bad_area; + } + fault = handle_mm_fault(vma, addr, mm_flags, regs); /* Quick path to respond to signals */ if (fault_signal_pending(fault, regs)) { if (!user_mode(regs)) @@ -626,13 +628,11 @@ static int __kprobes do_page_fault(unsigned long far, unsigned long esr, mmap_read_unlock(mm); done: - /* - * Handle the "normal" (no error) case first. - */ - if (likely(!(fault & (VM_FAULT_ERROR | VM_FAULT_BADMAP | - VM_FAULT_BADACCESS)))) + /* Handle the "normal" (no error) case first. */ + if (likely(!(fault & VM_FAULT_ERROR))) return 0; +bad_area: /* * If we are in kernel mode at this point, we have no context to * handle this fault with. @@ -667,13 +667,8 @@ static int __kprobes do_page_fault(unsigned long far, unsigned long esr, arm64_force_sig_mceerr(BUS_MCEERR_AR, far, lsb, inf->name); } else { - /* - * Something tried to access memory that isn't in our memory - * map. - */ - arm64_force_sig_fault(SIGSEGV, - fault == VM_FAULT_BADACCESS ? SEGV_ACCERR : SEGV_MAPERR, - far, inf->name); + /* Something tried to access memory that out of memory map */ + arm64_force_sig_fault(SIGSEGV, si_code, far, inf->name); } return 0; From patchwork Sun Apr 7 08:12:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13620045 Return-Path: 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 B66F1CD11C2 for ; Sun, 7 Apr 2024 08:12:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D25096B0096; Sun, 7 Apr 2024 04:12:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AAA8B6B009B; Sun, 7 Apr 2024 04:12:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 79D1F6B0098; Sun, 7 Apr 2024 04:12:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 49FB96B0098 for ; Sun, 7 Apr 2024 04:12:26 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 1751E1A0896 for ; Sun, 7 Apr 2024 08:12:26 +0000 (UTC) X-FDA: 81982018692.07.66976CD Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) by imf28.hostedemail.com (Postfix) with ESMTP id 70859C000A for ; Sun, 7 Apr 2024 08:12:23 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=none; spf=pass (imf28.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.32 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712477544; a=rsa-sha256; cv=none; b=NJHP0QoASy81b+rbGLMEKIJmUGCaTHTKrzCcvleISmkd5ZJklMAsOPNPO3rs9/LkxMCWMX G5oWnlMDSw0egqMuYDlmiNXlrMTaFc2D8/dpaFebpmhGkPYikEU4VuTdneR1f/3GHQYaeh 0vZdfwQEqCtFp70nSCyYcQ2nfQXhsaY= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=none; spf=pass (imf28.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.32 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712477544; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ygusvHhx/DBi0dVHeZXtU7T8FdMMILKbB7MvlnNHhD4=; b=Udm3SW8Bulc7TJ3t+5QfGPaLfW6LZ0l/GTtRXAhitwx4X0uXQ1Kr3B6aTYmI/EvV0xculM LbfMaEf91PwxOMQ5wqQeI5WNk1xmObeQBvxQvQS0m+R3IqLdwRKe4JMMiO6G6Pv963Az4N ZKWgWTeDo16DMSGILPESo2P1gT7nLTY= Received: from mail.maildlp.com (unknown [172.19.163.44]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4VC4gL06Yzz1wqMK; Sun, 7 Apr 2024 16:11:26 +0800 (CST) Received: from dggpemm100001.china.huawei.com (unknown [7.185.36.93]) by mail.maildlp.com (Postfix) with ESMTPS id 1B7B61400D3; Sun, 7 Apr 2024 16:12:20 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Sun, 7 Apr 2024 16:12:19 +0800 From: Kefeng Wang To: Andrew Morton , Russell King , Catalin Marinas , Will Deacon CC: , , Kefeng Wang Subject: [PATCH 2/2] arm: mm: drop VM_FAULT_BADMAP/VM_FAULT_BADACCESS Date: Sun, 7 Apr 2024 16:12:11 +0800 Message-ID: <20240407081211.2292362-3-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20240407081211.2292362-1-wangkefeng.wang@huawei.com> References: <20240407081211.2292362-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm100001.china.huawei.com (7.185.36.93) X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 70859C000A X-Stat-Signature: 4x8dacxypj7hr15yasf4nyk59su89j6a X-HE-Tag: 1712477543-535490 X-HE-Meta: U2FsdGVkX1+zOpoIWJebinAri7TI6Qo9Dyof6ubx87wkmI7HEVyENLdHQ6h2a6pLfNhoRLD89Ir4OW27TEiQYp9VO2KwTvkaghZtVv5h/8//UqXtRH9EM1pJT7AJnq2/xB1VobGcXK0xiPsr8d3M4mNX3XZWX/3ZVCeGmKFkBOR18XttzdF62WEWJKh6W3XzQjvbNvV7sV4wEDGCFjDhq/T7ydKHmfnuw0Xy7/qYdTjGql7vXZekJpJcrShGM83G7MXcCRPgyw7sPEB252RQe0XqEqZtIRgIC4bFz5wIZ5PkEWrQ8D8bxNHdk9snXisTKZ5TgqaqGc+iXUfm900tWbUUebaYrW9y83kcn4AGYnxtjLvs7iVF0vXVen5SbZfoOHZekgKl5iLQMpjezoe3eBwRajb4W3vog9XW86hRukzwBQZZG6TvFu9/Ydhp8z+Srtaj7fJ0jhNnkV/B5jIEDNwtlxenN+MRH28EBsnj/AkC7TxnhHdspo1w0qIUkgCzD3uUkYGi1jSgBYUtoTft6y8O8yI3KStj9j0XDeqzDntz0fVbWZGR4vQOeXHUZ6PSIm+vczZlRrRN7Yb2xraIqp/Uqe0AIuCiVS2CdmB+TVCwwMb7KZq3jvTSwlelXJdFbTctY4ij5Yf62cKJBBQyJ7Ttw1KZ6w6zZ15lAB+9Q8HmppTeT0HzHZKnyYhoetqyTr7BoxjIfKvsgcjgMo2Ko58cLRYM6kVwCkA+/zpS0CiQEG5FwWKgw6u3gME5Ji7abho1XQ+LearfFtGdC7yutMIfyLYLD6ZldXSuy74P93ipCoVHr5n/+eemlfnYPEO4fwCxS7uAuWgV/cxJCAqSFY05l1ZezCeOJGAC1hAIj2EOQdYSw2/9akGy4w3odQ9Cz86At3+i2t0ALm6H/5OWhEMc5dq2UCg1aXiUrlGuIqWZ3poS87yDA8XzABZhVsfhANLjV4y8fP/JIwhQCdn 4bmCX4fK pqgkILbkYsfEbxHcn7RVMEaJOKQyDRgw+DKs9TtECguZpmWVz3wkfKeMLs1eueS2PaBSeDhcm24aSpX5Uc4Nk31hWPsXZJSa/fGZbWVoSE0E7bUbTZy7hs+kDooTj680Mb57cNxhbkN/1DUZJClUM22ZDGGNKMl+Qys5nzMB9uEATAjZZKi7qtq+e0AA6tp4xxIzy X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: If bad map or access, directly set si_code to SEGV_MAPRR or SEGV_ACCERR, also set fault to 0 and goto error handling, which make us to drop the arch's special vm fault reason. Signed-off-by: Kefeng Wang --- arch/arm/mm/fault.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c index 5c4b417e24f9..cab24fb17c4b 100644 --- a/arch/arm/mm/fault.c +++ b/arch/arm/mm/fault.c @@ -226,9 +226,6 @@ void do_bad_area(unsigned long addr, unsigned int fsr, struct pt_regs *regs) } #ifdef CONFIG_MMU -#define VM_FAULT_BADMAP ((__force vm_fault_t)0x010000) -#define VM_FAULT_BADACCESS ((__force vm_fault_t)0x020000) - static inline bool is_permission_fault(unsigned int fsr) { int fs = fsr_fs(fsr); @@ -295,7 +292,8 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs) if (!(vma->vm_flags & vm_flags)) { vma_end_read(vma); count_vm_vma_lock_event(VMA_LOCK_SUCCESS); - fault = VM_FAULT_BADACCESS; + fault = 0; + code = SEGV_ACCERR; goto bad_area; } fault = handle_mm_fault(vma, addr, flags | FAULT_FLAG_VMA_LOCK, regs); @@ -321,7 +319,8 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs) retry: vma = lock_mm_and_find_vma(mm, addr, regs); if (unlikely(!vma)) { - fault = VM_FAULT_BADMAP; + fault = 0; + code = SEGV_MAPERR; goto bad_area; } @@ -329,10 +328,13 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs) * ok, we have a good vm_area for this memory access, check the * permissions on the VMA allow for the fault which occurred. */ - if (!(vma->vm_flags & vm_flags)) - fault = VM_FAULT_BADACCESS; - else - fault = handle_mm_fault(vma, addr & PAGE_MASK, flags, regs); + if (!(vma->vm_flags & vm_flags)) { + fault = 0; + code = SEGV_ACCERR; + goto bad_area; + } + + fault = handle_mm_fault(vma, addr & PAGE_MASK, flags, regs); /* If we need to retry but a fatal signal is pending, handle the * signal first. We do not need to release the mmap_lock because @@ -358,10 +360,8 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs) mmap_read_unlock(mm); done: - /* - * Handle the "normal" case first - VM_FAULT_MAJOR - */ - if (likely(!(fault & (VM_FAULT_ERROR | VM_FAULT_BADMAP | VM_FAULT_BADACCESS)))) + /* Handle the "normal" case first */ + if (likely(!(fault & VM_FAULT_ERROR))) return 0; bad_area: @@ -395,8 +395,6 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs) * isn't in our memory map.. */ sig = SIGSEGV; - code = fault == VM_FAULT_BADACCESS ? - SEGV_ACCERR : SEGV_MAPERR; } __do_user_fault(addr, fsr, sig, code, regs);