From patchwork Wed Jul 27 16:18:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baruch Siach X-Patchwork-Id: 12930535 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 94567C04A68 for ; Wed, 27 Jul 2022 16:19:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=7/2Kr4ZINkurotF7riRi7Z3Ab9x/2uC8jP46XCAh70E=; b=JStoQawJMkLrrq YDW8BYSf29HEvTXnQDbqN+CEmF9aYQ4o2laylDFrv00rtTf/9vS7JJ22gFH5u5cIcW+0MbVXmMNRA 23dFVsOYY73mozHx/hpfK8Y50dKLXFUmmmS+sKoS+E6K0E4LYKqt4p6NatxLE16Y3c+p3L9wUEq/d 68OZW0TO3XUwpckwFILUuQL7qs3Ko6HZBHSpMBgxg3N8DqeBVCGIDAo6ObZQfhb4+gDdhEqrCyOyl zHki1xUZFT9AFM8zjcdmEZTNC2QUFBN+Kec3o9J1cXaoL5n5fqBvsnYRgI4ykzvypgMKkGjuuc2Nb xEZno4KsPJWhN+GMRy6Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oGjju-00FSMB-IF; Wed, 27 Jul 2022 16:18:26 +0000 Received: from hours.tkos.co.il ([84.110.109.230] helo=mail.tkos.co.il) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oGjjq-00FSGN-SJ for linux-arm-kernel@lists.infradead.org; Wed, 27 Jul 2022 16:18:25 +0000 Received: from tarshish.tkos.co.il (unknown [10.0.8.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.tkos.co.il (Postfix) with ESMTPS id 16359440F2F; Wed, 27 Jul 2022 19:17:40 +0300 (IDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tkos.co.il; s=default; t=1658938660; bh=1RMW3MTyqSiUXWqrhv3k/c0bctRd2ejv6kHtYHN5VSA=; h=From:To:Cc:Subject:Date:From; b=LIpZ5D9Fwe02m83HM0pz+8S/zRMaHbNuXCoObmw+gxa1nsjPSPYGAupiDsMtSTxwU Y8YekUWO551nUbT6eLWuwvVm+E1VND2xRu1MQqlxakahqR7HRo0/OnXTDjFd09PpmJ 1ZGE146hobVJLG6oIE3KoPNNoW4u4gjKguM+cigmNp60j0I/19SRmJ03Yx7pi5M0MF xwVpgaU4GNlvIpp5Qu2ENRBy1v3e39+tS6D58BwIdsPrKKXuRhp+yA4lGW+yvZqx4S ZiV+Nnj9N8uAeL4DK767IzdYK4uBtauMpK2exrr1FOcfSbE8wstYsFfqLTiRkV/bhn UwqepVmmbFe8w== From: Baruch Siach To: Russell King , Ard Biesheuvel Cc: linux-arm-kernel@lists.infradead.org, Baruch Siach Subject: [PATCH] ARM: traps: print un-hashed user pc on undefined instruction Date: Wed, 27 Jul 2022 19:18:01 +0300 Message-Id: <515f8c621449e0f9aa7d11f998ce010676ba35fd.1658938681.git.baruch@tkos.co.il> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220727_091823_436972_DB5FEB56 X-CRM114-Status: GOOD ( 13.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When user undefined instruction debug is enabled pc value is hashed like kernel pointers for security reason. But the security benefit of this hash is very limited because the code goes on to call __show_regs() that prints the plain pointer value. pc is a user pointer anyway, so the kernel does not leak anything. The only result is confusion about the difference between the pc value on the first printed line, and the value that __show_regs() prints. Always print the plain value of pc. Signed-off-by: Baruch Siach --- arch/arm/kernel/traps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index 9283dc65be31..82fde11d6b8d 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c @@ -487,7 +487,7 @@ asmlinkage void do_undefinstr(struct pt_regs *regs) die_sig: #ifdef CONFIG_DEBUG_USER if (user_debug & UDBG_UNDEFINED) { - pr_info("%s (%d): undefined instruction: pc=%p\n", + pr_info("%s (%d): undefined instruction: pc=%px\n", current->comm, task_pid_nr(current), pc); __show_regs(regs); dump_instr(KERN_INFO, regs);