Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp13474939ybl; Sun, 29 Dec 2019 12:47:57 -0800 (PST) X-Google-Smtp-Source: APXvYqwlAHTLnmqi3uMNzP6hLcDCBsxj1ailHnTj0XBxy6QU8Cll816oARgE/M9tLwTuAsIXlC5C X-Received: by 2002:a9d:51c1:: with SMTP id d1mr66703856oth.136.1577652477455; Sun, 29 Dec 2019 12:47:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577652477; cv=none; d=google.com; s=arc-20160816; b=kRG8hX7Y4eCkvqVy/KR/YeDLnyLBaIhu0S4XYy+Jk4W4ig2YFrsZfcZ7PKs0CQCI/T XhOv8RF5B+orffSJSK9W6gB6e613MaN/rsbAnohlQrdcr/M6bPVEI96MYPxmWilOHBBv c8TOLiB0XKsW3AnPY5j3F/Y86/JLd8n4MzrlcjT9qyyvmnoFsabY66tBzCzQgZ/u0XuG UT9l8cjsamaTTfpZKY/wmJXAw/nENwpVL2N1QoifMSeQbX43bE2CCjfw740hIG9TcipZ I3OnwAu7FzRFJiwemN7WmdZ8UwEPPFkeuXc5T+EVwmCjlp/oczxEUag1/UURicMobSur f7AQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iyPsiIi4oN6xcG4Gtlyvidt00Cp2Eirj7I6RkD73FII=; b=GPLH7W7GsG5HIPWMkFfvX7ePr7C3CwdN4NzB3f/65bCC/FA1Emr3mB+LzlQBniFvSz V87on3sV1RlP0ANxyL/uIoZ+caHqSNzuh8TzN5839N7CJG8mWozI4cI6DY6L1+DoTEXa q37unc/yY9yzbaCkbaX7g4Fp20Ha4vcldPCKhZpqWJewLhkbaLrZgNGUjBBagtOZAVcg e83KkcnEd2NXiUkMvYYkVmE7lmuKpJfP3R4m0p2msEJeBu4f6IxE29mjNpv3QE4K4OOg zj/PEWZyjtKMlASfZtNdmvSmBmZ/zHkOBxFC/5kvApOz7fIsd3A/0UO2O42AE9yRaOOq 6/+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AJA4L4XT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t12si21477795otm.224.2019.12.29.12.47.47; Sun, 29 Dec 2019 12:47:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AJA4L4XT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732417AbfL2RxK (ORCPT + 99 others); Sun, 29 Dec 2019 12:53:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:39746 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731949AbfL2RxE (ORCPT ); Sun, 29 Dec 2019 12:53:04 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0258F206DB; Sun, 29 Dec 2019 17:53:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577641983; bh=zBSBBZtdPOuufD76JTa1GxoyWwBTHQqOo1fL1zV/vQM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AJA4L4XTUdzSokqvneNl0HfkW+290yK2k/rxqh76PvNInb9s/vrp5VsTNYQkJpGSS M+3WWzPwADWYbnipontNXsh12m8li5A/R4BIx3C87TMB5FKRBahrRSpr8960nZYz2W IDsee3ocgAZbxzjC/V++Nxoz/9nQ/Ai/so2U9WWU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ilya Leoshkevich , Vasily Gorbik , Sasha Levin Subject: [PATCH 5.4 294/434] s390/disassembler: dont hide instruction addresses Date: Sun, 29 Dec 2019 18:25:47 +0100 Message-Id: <20191229172721.477156682@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229172702.393141737@linuxfoundation.org> References: <20191229172702.393141737@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ilya Leoshkevich [ Upstream commit 544f1d62e3e6c6e6d17a5e56f6139208acb5ff46 ] Due to kptr_restrict, JITted BPF code is now displayed like this: 000000000b6ed1b2: ebdff0800024 stmg %r13,%r15,128(%r15) 000000004cde2ba0: 41d0f040 la %r13,64(%r15) 00000000fbad41b0: a7fbffa0 aghi %r15,-96 Leaking kernel addresses to dmesg is not a concern in this case, because this happens only when JIT debugging is explicitly activated, which only root can do. Use %px in this particular instance, and also to print an instruction address in show_code and PCREL (e.g. brasl) arguments in print_insn. While at present functionally equivalent to %016lx, %px is recommended by Documentation/core-api/printk-formats.rst for such cases. Signed-off-by: Ilya Leoshkevich Reviewed-by: Vasily Gorbik Signed-off-by: Vasily Gorbik Signed-off-by: Sasha Levin --- arch/s390/kernel/dis.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/arch/s390/kernel/dis.c b/arch/s390/kernel/dis.c index 7abe6ae261b4..f304802ecf7b 100644 --- a/arch/s390/kernel/dis.c +++ b/arch/s390/kernel/dis.c @@ -461,10 +461,11 @@ static int print_insn(char *buffer, unsigned char *code, unsigned long addr) ptr += sprintf(ptr, "%%c%i", value); else if (operand->flags & OPERAND_VR) ptr += sprintf(ptr, "%%v%i", value); - else if (operand->flags & OPERAND_PCREL) - ptr += sprintf(ptr, "%lx", (signed int) value - + addr); - else if (operand->flags & OPERAND_SIGNED) + else if (operand->flags & OPERAND_PCREL) { + void *pcrel = (void *)((int)value + addr); + + ptr += sprintf(ptr, "%px", pcrel); + } else if (operand->flags & OPERAND_SIGNED) ptr += sprintf(ptr, "%i", value); else ptr += sprintf(ptr, "%u", value); @@ -536,7 +537,7 @@ void show_code(struct pt_regs *regs) else *ptr++ = ' '; addr = regs->psw.addr + start - 32; - ptr += sprintf(ptr, "%016lx: ", addr); + ptr += sprintf(ptr, "%px: ", (void *)addr); if (start + opsize >= end) break; for (i = 0; i < opsize; i++) @@ -564,7 +565,7 @@ void print_fn_code(unsigned char *code, unsigned long len) opsize = insn_length(*code); if (opsize > len) break; - ptr += sprintf(ptr, "%p: ", code); + ptr += sprintf(ptr, "%px: ", code); for (i = 0; i < opsize; i++) ptr += sprintf(ptr, "%02x", code[i]); *ptr++ = '\t'; -- 2.20.1