Received: by 10.223.176.5 with SMTP id f5csp1177573wra; Fri, 9 Feb 2018 14:02:35 -0800 (PST) X-Google-Smtp-Source: AH8x225iKKRx5nkHhncwUuNgaHTMgI1r15oChnGD8cByM5Pv01nYu4DpqLjJITHrs2gPxBgzwd/q X-Received: by 2002:a17:902:8d81:: with SMTP id v1-v6mr3807480plo.430.1518213755180; Fri, 09 Feb 2018 14:02:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518213755; cv=none; d=google.com; s=arc-20160816; b=uC2Y4vAD96BiDdC0M3KNet/0Fqoieegd6xU3nGA81TbaEuFSDyXuMdPrK7/lLV6YC/ lpEdLgetz1cjrbfYO75SxOqsdpoWqRMtcgbxBfyG+EHn8vVGdy+i08vP/B1Vs7Lpp/l4 Inf+tRezS1iR69N8Isk0hPjnX7nq+9n/vU5WgxZ0CNsTAXi7SZL98lR9XWY6wA05PFEy zUq3A9GztyRPtnoVGXwl0XYtAoUDBbIUGb22127v8yUpV2l0MHSRmRRho7kf9tjoXQS1 qhI2mcwnZ5azwyB7gx5OAbS0tA98/xxgmOEyTrzBZ2W79hDwURfUKk6SzjyKLVuOjzxy /WFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=Tp7PzciY3lrNKVYUlDki9MkMlRHpPMlG0hqxe/s2BkU=; b=uzF7LIv+7J0ml6u8b7Nzr8s+7Ytb3c6fFR1VY0hbFZSQ9EiW1kOH0s9AcpghtR3h0/ SUStF/F8Wind1t+VGCYlAKQC9F1mXsztQthzU2YnUagaS5yAlGHVd/FXXTKyBP+zlk37 qMbJvCxI8Q3GTvundi+khc/VR8A9YXywF+jA14zTsJSiTlvewD7d51wcGsZ1dJc9NpZq TiSoiT2xTs+9vUIMgAh5H2eQVFGx4JpGs7RRgjuO58JypI4y0TokHJfz7yMRKzghC39i BonA+3nTCIR9OAPbu08AREPdwGJH15kuTyXZ47MPH2y/0yj8QF4WX/aPLqY5A/8//UR7 MDYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Qd01IboD; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f63si2300795pfb.194.2018.02.09.14.02.21; Fri, 09 Feb 2018 14:02:35 -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=@google.com header.s=20161025 header.b=Qd01IboD; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753036AbeBIWBh (ORCPT + 99 others); Fri, 9 Feb 2018 17:01:37 -0500 Received: from mail-ua0-f194.google.com ([209.85.217.194]:33102 "EHLO mail-ua0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752913AbeBIWBf (ORCPT ); Fri, 9 Feb 2018 17:01:35 -0500 Received: by mail-ua0-f194.google.com with SMTP id p12so6111570uad.0 for ; Fri, 09 Feb 2018 14:01:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Tp7PzciY3lrNKVYUlDki9MkMlRHpPMlG0hqxe/s2BkU=; b=Qd01IboDR5N0yDLqA/GefaGy/z7/0M15KU0IdOIhS7K9CqIcoqPenCbbGhJBI66qS+ Z+tgl9ofDfITE4wf6s9pfMEzIKZpQAhVYYmDkjLWAIjVTVD3gvtwE2AIOEL9AMCWG6d3 lp/CEzNjTowtsAQq3o3YxO6hB2+dpcjtSttkyQIeWHez66GOLiEp76owbSH7qObCdSd3 PhUm+N63WlcnAEAN3MCQuvEii4isYNWyg4aQ9x9V3ju4ixMrrnTkQKsrJgLdfE12GcpS HbUeg7ULWOm8N53Cd+QnbfCLhqz7vewyoEfdnxRxRq2+3dXv3A4BDyObrxjdmwzRO72w wSCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Tp7PzciY3lrNKVYUlDki9MkMlRHpPMlG0hqxe/s2BkU=; b=jSTpNDa+CO+C/cPvea3Imf9dMstYPaYkGDiPHPBfz0aGUEG1Fpl1a+l2n/Uh0g1WKq dpn0YqALQ1+FuyOTg63A6Z1lBCqn+5H+UgC9Qqz4NfQTAu4sQwOWshonffw1MkB6LJ7O dA54x7NUK++qMDbDqnSnNRX4ClEzCFDW3JcndK6Zhke1KrnEH3Powyxk7jdYa3k4cxnj Ot+5nixv4FaWhxQB9Y6cOSm4+3uC0W89Q3qzZVdlwn6K9D0pAWUBKv1xHgqjbQp5Ze54 5hGx2FLXJNZtiMSxDDnBczKR6txAwMaY/X18Nq9TG9NkDxxIhUKi/MyukGq6C9gugosY upgw== X-Gm-Message-State: APf1xPDoQUekiOSX311ZrL7OKwaM53XQiToVqBF/2jwmJssXUpGi7x9u azjd3q+/Cq7JXByf6/YWwjKrAxiN/YMsnAd2/MNUiA== X-Received: by 10.176.112.181 with SMTP id q21mr4191860ual.105.1518213694067; Fri, 09 Feb 2018 14:01:34 -0800 (PST) MIME-Version: 1.0 Received: by 10.31.67.196 with HTTP; Fri, 9 Feb 2018 14:01:32 -0800 (PST) In-Reply-To: <20180209133934.472824776@linuxfoundation.org> References: <20180209133931.211869118@linuxfoundation.org> <20180209133934.472824776@linuxfoundation.org> From: Kees Cook Date: Fri, 9 Feb 2018 14:01:32 -0800 Message-ID: Subject: Re: [PATCH 4.9 46/92] x86/alternative: Print unadorned pointers To: Greg Kroah-Hartman Cc: LKML , "# 3.4.x" , Borislav Petkov , Thomas Gleixner , Rik van Riel , Andi Kleen , Peter Zijlstra , David Woodhouse , Jiri Kosina , Andy Lutomirski , Dave Hansen , Linus Torvalds , Josh Poimboeuf , Tim Chen , Paul Turner , David Woodhouse , Greg Kroah-Hartmann Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 9, 2018 at 5:39 AM, Greg Kroah-Hartman wrote: > 4.9-stable review patch. If anyone has any objections, please let me know. > > ------------------ > > From: Borislav Petkov > > (cherry picked from commit 0e6c16c652cadaffd25a6bb326ec10da5bcec6b4) > > After commit ad67b74d2469 ("printk: hash addresses printed with %p") > pointers are being hashed when printed. However, this makes the alternative > debug output completely useless. Switch to %px in order to see the > unadorned kernel pointers. This missed a "Fixes:" tag so probably missed automated checking on how far back to port this. It shouldn't go back beyond 4.15 (where ad67b74d2469 first appeared). -Kees > > Signed-off-by: Borislav Petkov > Signed-off-by: Thomas Gleixner > Cc: riel@redhat.com > Cc: ak@linux.intel.com > Cc: peterz@infradead.org > Cc: David Woodhouse > Cc: jikos@kernel.org > Cc: luto@amacapital.net > Cc: dave.hansen@intel.com > Cc: torvalds@linux-foundation.org > Cc: keescook@google.com > Cc: Josh Poimboeuf > Cc: tim.c.chen@linux.intel.com > Cc: gregkh@linux-foundation.org > Cc: pjt@google.com > Link: https://lkml.kernel.org/r/20180126121139.31959-2-bp@alien8.de > Signed-off-by: David Woodhouse > Signed-off-by: Greg Kroah-Hartman > --- > arch/x86/kernel/alternative.c | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) > > --- a/arch/x86/kernel/alternative.c > +++ b/arch/x86/kernel/alternative.c > @@ -298,7 +298,7 @@ recompute_jump(struct alt_instr *a, u8 * > tgt_rip = next_rip + o_dspl; > n_dspl = tgt_rip - orig_insn; > > - DPRINTK("target RIP: %p, new_displ: 0x%x", tgt_rip, n_dspl); > + DPRINTK("target RIP: %px, new_displ: 0x%x", tgt_rip, n_dspl); > > if (tgt_rip - orig_insn >= 0) { > if (n_dspl - 2 <= 127) > @@ -352,7 +352,7 @@ static void __init_or_module optimize_no > sync_core(); > local_irq_restore(flags); > > - DUMP_BYTES(instr, a->instrlen, "%p: [%d:%d) optimized NOPs: ", > + DUMP_BYTES(instr, a->instrlen, "%px: [%d:%d) optimized NOPs: ", > instr, a->instrlen - a->padlen, a->padlen); > } > > @@ -370,7 +370,7 @@ void __init_or_module apply_alternatives > u8 *instr, *replacement; > u8 insnbuf[MAX_PATCH_LEN]; > > - DPRINTK("alt table %p -> %p", start, end); > + DPRINTK("alt table %px, -> %px", start, end); > /* > * The scan order should be from start to end. A later scanned > * alternative code can overwrite previously scanned alternative code. > @@ -394,14 +394,14 @@ void __init_or_module apply_alternatives > continue; > } > > - DPRINTK("feat: %d*32+%d, old: (%p, len: %d), repl: (%p, len: %d), pad: %d", > + DPRINTK("feat: %d*32+%d, old: (%px len: %d), repl: (%px, len: %d), pad: %d", > a->cpuid >> 5, > a->cpuid & 0x1f, > instr, a->instrlen, > replacement, a->replacementlen, a->padlen); > > - DUMP_BYTES(instr, a->instrlen, "%p: old_insn: ", instr); > - DUMP_BYTES(replacement, a->replacementlen, "%p: rpl_insn: ", replacement); > + DUMP_BYTES(instr, a->instrlen, "%px: old_insn: ", instr); > + DUMP_BYTES(replacement, a->replacementlen, "%px: rpl_insn: ", replacement); > > memcpy(insnbuf, replacement, a->replacementlen); > insnbuf_sz = a->replacementlen; > @@ -422,7 +422,7 @@ void __init_or_module apply_alternatives > a->instrlen - a->replacementlen); > insnbuf_sz += a->instrlen - a->replacementlen; > } > - DUMP_BYTES(insnbuf, insnbuf_sz, "%p: final_insn: ", instr); > + DUMP_BYTES(insnbuf, insnbuf_sz, "%px: final_insn: ", instr); > > text_poke_early(instr, insnbuf, insnbuf_sz); > } > > -- Kees Cook Pixel Security