Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4643077img; Tue, 26 Mar 2019 13:38:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqzjF7nv8z/fnjBzRxHakHGIckQG/74QJyiyjSli3iXrfuxUi5uIFHMvosGjXul1hbEIdbxg X-Received: by 2002:a62:e418:: with SMTP id r24mr32098015pfh.52.1553632702828; Tue, 26 Mar 2019 13:38:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553632702; cv=none; d=google.com; s=arc-20160816; b=xVPDjkZtDQqs9xMli6NZz6RX5srZOsG9YnJUIISzSQdod4HS5hBmK6TpRlQsRctCDa DT3d7nN/A7ievcv38Wr9WLWmPIKJGOrkW1Qyu0KliGiWKebLU5Zp8ph832ECLK62vkQu 0Cpx9LKn2PDFIexS+cSO7FKvIiaolbuBwngK/GlAIhp4hozHMlIejf2Z5dmj12ZTjWXc h5nVQzf3E3+McLMKywYlTZxMCK6gChO2CtN/hjEG4tSBnlSxwV1n8tNrv37JjbyJ9j55 sYa0o4Fw02n76kgZmYD8H7yC/h/yStHGA1au3B/7clw+YHpT1/B3l7tf/KcnJXZr0Fj2 hEtw== 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 :in-reply-to:references:mime-version; bh=JhLyn48nA6q2U7w5eOLrSrVD+Xv83Es5B1I3uCqZReg=; b=nzztEOFw8zcXficLvYESAgyxaGpQhihjnuQZFhLgj5QQa8HvRQ3pt3wIMAvACJeUhQ xR/WuOyVFUIKz39j8yQCcjwu2uKS1ab1RwcpxsWPj39qi3vUGyPIbDQDVF/bljkBGw7N dgo0ISps9FfTNlPVpyzbvr8JSGi4Rc9DrZwTRydO6WLsA47syeBOInkUPR16N+F4jUf4 Uo1na7Kz6PCuEo510+3XDhu2Qb0hODKMQam8r/rbr0rHy1bGnku/4qnS4UuAY/6SkJFx sD3UYYuRLXBfS7xqNbqvA7AYk141Gy9IZ1rR2IRyA4Vbu3eAxzliNGGbLT0lm9gKjVjR y6cw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y7si16266694pfe.248.2019.03.26.13.38.07; Tue, 26 Mar 2019 13:38:22 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732731AbfCZUh0 (ORCPT + 99 others); Tue, 26 Mar 2019 16:37:26 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:42761 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726207AbfCZUhZ (ORCPT ); Tue, 26 Mar 2019 16:37:25 -0400 Received: by mail-lj1-f194.google.com with SMTP id v22so12363883lje.9 for ; Tue, 26 Mar 2019 13:37:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JhLyn48nA6q2U7w5eOLrSrVD+Xv83Es5B1I3uCqZReg=; b=dL2xPAJ2YBi4NBJZZbjtE+PycOXk/xW/XYikVeOncmmPEBt16SkjoVbqSXF+q+ULTX tDKC0Rho/6voKPiXyZGJ8NPsjWFd+TaWaddsQ4hWC2HOy33HWUXaJYuqcwoazGmYP/F/ DziY0BC7fbB4abXG5ljxKlPGTmAvDoR2gGUpKVqiePhqZ4ztiGGlToe+OjMjPnElxEpl cYomNDjuGrAY/rrmskuXZeFf21X5W/TtrhFrqhH3dBmGxkeQVyJIdXcJ0IBCtaPq2zUB cgcQIed/KfgEuXcpfBLz7iUvvoRC83DcvdiLzN/yDbWq8bY2ZA5CtNqNqr/g5HEQuxKr GX0A== X-Gm-Message-State: APjAAAWZtOkknS9wWn8/vS81ofANyLMgn/mtuVK0d25GB7cDJuw9vjLA QXnnvpOllW/HgUa8auJEZXXrJ0fXnGS1NG+xtj3QZw== X-Received: by 2002:a2e:9a0f:: with SMTP id o15mr1768397lji.130.1553632644200; Tue, 26 Mar 2019 13:37:24 -0700 (PDT) MIME-Version: 1.0 References: <20190324190504.29906-1-mcroce@redhat.com> <20190326161457.GN1867@zn.tnic> In-Reply-To: <20190326161457.GN1867@zn.tnic> From: Matteo Croce Date: Tue, 26 Mar 2019 21:36:48 +0100 Message-ID: Subject: Re: [PATCH v2] x86/realmode: don't leak kernel addresses To: Borislav Petkov Cc: x86@kernel.org, "H . Peter Anvin" , Thomas Gleixner , Ingo Molnar , lkml 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 Tue, Mar 26, 2019 at 5:15 PM Borislav Petkov wrote: > > On Sun, Mar 24, 2019 at 08:05:04PM +0100, Matteo Croce wrote: > > Since commit ad67b74d2469d9b8 ("printk: hash addresses printed with %p"), > > at boot "____ptrval____" is printed instead of the trampoline addresses: > > > > Base memory trampoline at [(____ptrval____)] 99000 size 24576 > > > > Remove the address from the print as we don't want to leak kernel > > addresses. > > > > Fixes: ad67b74d2469d9b8 ("printk: hash addresses printed with %p") > > Signed-off-by: Matteo Croce > > --- > > arch/x86/realmode/init.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/arch/x86/realmode/init.c b/arch/x86/realmode/init.c > > index d10105825d57..d76a1380ec37 100644 > > --- a/arch/x86/realmode/init.c > > +++ b/arch/x86/realmode/init.c > > @@ -20,8 +20,8 @@ void __init set_real_mode_mem(phys_addr_t mem, size_t size) > > void *base = __va(mem); > > > > real_mode_header = (struct real_mode_header *) base; > > - printk(KERN_DEBUG "Base memory trampoline at [%p] %llx size %zu\n", > > - base, (unsigned long long)mem, size); > > + printk(KERN_DEBUG "Base memory trampoline at %llx size %zu\n", > > + (unsigned long long)mem, size); > > In case this wasn't clear, please remove the whole printk. And don't > forget to CC lkml on your submissions. CCed now. > > -- > Regards/Gruss, > Boris. > > Good mailing practices for 400: avoid top-posting and trim the reply. Got it, sent a v3 with the printk removed. Anyway, I wonder if we can remove the 'size' argument and/or moving set_real_mode_mem() into realmode.h to have it inlined. Or maybe it's not worth it. Regards, -- Matteo Croce per aspera ad upstream