From patchwork Wed Mar 14 14:27:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juerg Haefliger X-Patchwork-Id: 885819 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 401Yvx07BGz9sVk; Thu, 15 Mar 2018 01:27:25 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1ew7NB-0007F0-DW; Wed, 14 Mar 2018 14:27:21 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1ew7N5-0007DP-Oi for kernel-team@lists.ubuntu.com; Wed, 14 Mar 2018 14:27:15 +0000 Received: from mail-wr0-f198.google.com ([209.85.128.198]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1ew7N5-0002Qs-H6 for kernel-team@lists.ubuntu.com; Wed, 14 Mar 2018 14:27:15 +0000 Received: by mail-wr0-f198.google.com with SMTP id k6so2067565wre.21 for ; Wed, 14 Mar 2018 07:27:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=Y64/IKcgEbyiz18m+X86YFoLd/mvCE7GWShwqqwAlyI=; b=tJlG8JBlrBB55k/lcs6pQqTR5/gJ6gwnAXnERv9L9QDy7K+aFZtDzwYdnlo4V4c6VY M0v89T0NNXfN8eTs0lS+3FZ/do4Qsvae/bK8uJWELPjmrtqMz3CTLfWZB01vNGr/P254 ayBxfV59+sRUR0zx4daAhMtaFH8hwmarrAL3FQXDxqiK1Bg8+9PpCOBVyKJTC1GJlOna lWYdQg7Q+2DinnaACTJ3iU3wi1ZrhbxeEcYWouSuuqDPlWZq5O5+0cR/4Nci/7/YQDh0 21P9xm2/BywGsp4C7ouWU5gI+PC7wbLDx6Xb1U1sp16pJgKNIkvqTqzez2uBhec2ELRq k8WA== X-Gm-Message-State: AElRT7EcE/xM+H6vfq8p1IPMszriVeCfIYMFME8neQ4xtFdHG9g9HWXo 6FxCyvFn/g6U5vBnv54w9BddIbFZtyM/uRBMyCT++5iU3Bhc9crML2AFZmazFFboACjFBrfybU6 NaYQxIm9QIG8a0KwUnserKLVDHnOL6zMKtoNytNgOzg== X-Received: by 10.80.132.5 with SMTP id 5mr5098985edp.139.1521037634879; Wed, 14 Mar 2018 07:27:14 -0700 (PDT) X-Google-Smtp-Source: AG47ELteGR79WYAm8IacQhlYP9TY77tYdOs/sQJrq9FM/A+fVY+xt4vixC0gMJpdfagtmdMUoFg/Vg== X-Received: by 10.80.132.5 with SMTP id 5mr5098966edp.139.1521037634618; Wed, 14 Mar 2018 07:27:14 -0700 (PDT) Received: from gollum.fritz.box ([81.221.205.149]) by smtp.gmail.com with ESMTPSA id b7sm218279eda.71.2018.03.14.07.27.13 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Mar 2018 07:27:13 -0700 (PDT) From: Juerg Haefliger X-Google-Original-From: Juerg Haefliger To: kernel-team@lists.ubuntu.com Subject: [SRU][Trusty][PATCH 1/2] Revert "UBUNTU: SAUCE: x86, extable: fix uaccess fixup detection" Date: Wed, 14 Mar 2018 15:27:11 +0100 Message-Id: <20180314142712.14541-2-juergh@canonical.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180314142712.14541-1-juergh@canonical.com> References: <20180314142712.14541-1-juergh@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: http://bugs.launchpad.net/bugs/1750786 This reverts commit 56764fdc3a847371531b8044155c70412fc5be76. juergh: This commit causes the below kernel crash during boot in my local testing, so revert it and instead pull in the upstream commit 548acf19234d ("x86/mm: Expand the exception table logic to allow new handling options") [ 0.127637] BUG: unable to handle kernel paging request at ffffffff01719db1 [ 0.128276] IP: [] 0xffffffff01719db1 [ 0.128476] PGD 1c0f067 PUD 0 [ 0.128476] Oops: 0010 [#1] SMP [ 0.128476] Modules linked in: [ 0.128476] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.13.11-ckt39-trusty+ #3 [ 0.128476] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014 [ 0.128476] task: ffff88003e36c000 ti: ffff88003e36a000 task.ti: ffff88003e36a000 [ 0.128476] RIP: 0010:[] [] 0xffffffff01719db1 [ 0.128476] RSP: 0000:ffff88003e36be98 EFLAGS: 00050246 [ 0.128476] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000 [ 0.128476] RDX: 0000000000000000 RSI: ffff88003d833af4 RDI: ffffffff81cfea36 [ 0.128476] RBP: ffff88003e36be98 R08: 0000000000000000 R09: ffff88003fa15180 [ 0.128476] R10: ffffffff81339098 R11: ffffea0000f6b400 R12: ffffffff81cfea36 [ 0.128476] R13: 0000000000000129 R14: 0000000000000000 R15: 0000000000000000 [ 0.128476] FS: 0000000000000000(0000) GS:ffff88003fa00000(0000) knlGS:0000000000000000 [ 0.128476] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 0.128476] CR2: ffffffff01719db1 CR3: 0000000001c0c000 CR4: 0000000000360770 [ 0.128476] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 0.128476] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 0.128476] Stack: [ 0.128476] ffff88003e36bf08 ffffffff8100040a ffff88003e36bf00 ffffffff810b2398 [ 0.128476] ffff88003e36bef0 ffff88003fd497a1 ffffffff81afbe48 0000012900060006 [ 0.128476] ffffffff81a78639 ffffffff81e011a8 ffffffff81e012e0 0000000000000006 [ 0.128476] Call Trace: [ 0.128476] [] do_one_initcall+0xfa/0x150 [ 0.128476] [] ? parse_args+0x1f8/0x330 [ 0.128476] [] kernel_init_freeable+0x15f/0x1e4 [ 0.128476] [] ? do_early_param+0x88/0x88 [ 0.128476] [] ? rest_init+0x80/0x80 [ 0.128476] [] kernel_init+0xe/0x130 [ 0.128476] [] ret_from_fork+0x6e/0xa0 [ 0.128476] [] ? rest_init+0x80/0x80 [ 0.128476] Code: Bad RIP value. [ 0.128476] RIP [] 0xffffffff01719db1 [ 0.128476] RSP [ 0.128476] CR2: ffffffff01719db1 [ 0.128476] ---[ end trace 6821844fed2f9ed6 ]--- [ 0.128476] note: swapper/0[1] exited with preempt_count 1 [ 0.152629] swapper/0 (1) used greatest stack depth: 5400 bytes left [ 0.153295] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000009 [ 0.153295] [ 0.154271] Kernel Offset: 0x0 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffff9fffffff) Signed-off-by: Juerg Haefliger --- arch/x86/mm/extable.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/arch/x86/mm/extable.c b/arch/x86/mm/extable.c index a06be2f7f1bb..903ec1e9c326 100644 --- a/arch/x86/mm/extable.c +++ b/arch/x86/mm/extable.c @@ -17,7 +17,6 @@ ex_fixup_addr(const struct exception_table_entry *x) int fixup_exception(struct pt_regs *regs) { const struct exception_table_entry *fixup; - unsigned long insn_ip; unsigned long new_ip; #ifdef CONFIG_PNPBIOS @@ -36,17 +35,9 @@ int fixup_exception(struct pt_regs *regs) fixup = search_exception_tables(regs->ip); if (fixup) { - insn_ip = ex_insn_addr(fixup); new_ip = ex_fixup_addr(fixup); - /* - * If the code and its fixup are "very far apart" then - * they are infact tagged as uaccess'es. Handle them - * specially and fix the fixup address. This relies on - * the .fixup section being at higher addresses that the - * original code. - */ - if (new_ip - insn_ip >= 0x7ffffff0) { + if (fixup->fixup - fixup->insn >= 0x7ffffff0 - 4) { /* Special hack for uaccess_err */ current_thread_info()->uaccess_err = 1; new_ip -= 0x7ffffff0; @@ -62,16 +53,13 @@ int fixup_exception(struct pt_regs *regs) int __init early_fixup_exception(unsigned long *ip) { const struct exception_table_entry *fixup; - unsigned long insn_ip; unsigned long new_ip; fixup = search_exception_tables(*ip); if (fixup) { - insn_ip = ex_insn_addr(fixup); new_ip = ex_fixup_addr(fixup); - /* See fixup_exception for details ... */ - if (new_ip - insn_ip >= 0x7ffffff0) { + if (fixup->fixup - fixup->insn >= 0x7ffffff0 - 4) { /* uaccess handling not supported during early boot */ return 0; }