All of lore.kernel.org
 help / color / mirror / Atom feed
From: maarten.lankhorst@linux.intel.com (Maarten Lankhorst)
To: linux-snps-arc@lists.infradead.org
Subject: [PATCH] drm: Print unadorned pointers
Date: Wed, 18 Apr 2018 12:08:57 +0200	[thread overview]
Message-ID: <432801bd-a775-5b48-00c4-2160ae52c25b@linux.intel.com> (raw)
In-Reply-To: <1524045595.3198.11.camel@synopsys.com>

Op 18-04-18 om 11:59 schreef Alexey Brodkin:
> On Wed, 2018-04-18@11:29 +0200, Maarten Lankhorst wrote:
>> Op 18-04-18 om 11:24 schreef Alexey Brodkin:
>>> After commit ad67b74 ("printk: hash addresses printed with %p")
>>> pointers are being hashed when printed. However, this makes
>>> debug output completely useless. Switch to %px in order to see the
>>> unadorned kernel pointers.
>>>
>>> This was done with the following one-liner:
>>>  find drivers/gpu/drm -type f -name "*.c" -exec sed -r -i '/DRM_DEBUG|KERN_DEBUG|pr_debug/ s/%p\b/%px/g' {} +
>> So first we plug a kernel information leak hole, then we introduce it again? Seems like a terrible idea..
> Well security concerns are good but what about us poor kernel developers?
> Those debug prints are supposed to help us to deal with stuff we develop or fix.
>
> Frankly I was quite surprised when first saw what was "unique hashed ID" instead
> of real pointer value. And what's worse there's no way to get previous behavior back.
> So now we have to manually patch sources here and there to get meaningful data, right?
>
> I wouldn't bother sending this patch if there was Kconfig option reverting %p behavior
> but that was never implemented.
>
> -Alexey

There's %pK for kernel pointers. It does what you want and can be toggled with kptr_restrict, without introducing security holes. :)

Perhaps split up this patch per driver, and handle the other variations as well?

DRM_NOTE DRM_WARN DRM_INFO DRM_ERROR.


~Maarten

WARNING: multiple messages have this Message-ID (diff)
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: Alexey Brodkin <Alexey.Brodkin@synopsys.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>
Cc: "thomas.lendacky@amd.com" <thomas.lendacky@amd.com>,
	"airlied@linux.ie" <airlied@linux.ie>,
	"daniel.vetter@ffwll.ch" <daniel.vetter@ffwll.ch>,
	"cakturk@gmail.com" <cakturk@gmail.com>,
	"kraxel@redhat.com" <kraxel@redhat.com>,
	"Jerry.Zuo@amd.com" <Jerry.Zuo@amd.com>,
	"mingo@kernel.org" <mingo@kernel.org>,
	"thellstrom@vmware.com" <thellstrom@vmware.com>,
	"vincent.abriou@st.com" <vincent.abriou@st.com>,
	"linux@armlinux.org.uk" <linux@armlinux.org.uk>,
	"krzk@kernel.org" <krzk@kernel.org>,
	"maxime.ripard@bootlin.com" <maxime.ripard@bootlin.com>,
	"wens@csie.org" <wens@csie.org>,
	"Hongbo.He@amd.com" <Hongbo.He@amd.com>,
	"airlied@redhat.com" <airlied@redhat.com>,
	"bp@suse.de" <bp@suse.de>, "arnd@arndb.de" <arnd@arndb.de>,
	"sunpeng.li@amd.com" <sunpeng.li@amd.com>,
	"rodrigo.vivi@intel.com" <rodrigo.vivi@intel.com>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>, Tony.Cheng@
Subject: Re: [PATCH] drm: Print unadorned pointers
Date: Wed, 18 Apr 2018 12:08:57 +0200	[thread overview]
Message-ID: <432801bd-a775-5b48-00c4-2160ae52c25b@linux.intel.com> (raw)
In-Reply-To: <1524045595.3198.11.camel@synopsys.com>

Op 18-04-18 om 11:59 schreef Alexey Brodkin:
> On Wed, 2018-04-18 at 11:29 +0200, Maarten Lankhorst wrote:
>> Op 18-04-18 om 11:24 schreef Alexey Brodkin:
>>> After commit ad67b74 ("printk: hash addresses printed with %p")
>>> pointers are being hashed when printed. However, this makes
>>> debug output completely useless. Switch to %px in order to see the
>>> unadorned kernel pointers.
>>>
>>> This was done with the following one-liner:
>>>  find drivers/gpu/drm -type f -name "*.c" -exec sed -r -i '/DRM_DEBUG|KERN_DEBUG|pr_debug/ s/%p\b/%px/g' {} +
>> So first we plug a kernel information leak hole, then we introduce it again? Seems like a terrible idea..
> Well security concerns are good but what about us poor kernel developers?
> Those debug prints are supposed to help us to deal with stuff we develop or fix.
>
> Frankly I was quite surprised when first saw what was "unique hashed ID" instead
> of real pointer value. And what's worse there's no way to get previous behavior back.
> So now we have to manually patch sources here and there to get meaningful data, right?
>
> I wouldn't bother sending this patch if there was Kconfig option reverting %p behavior
> but that was never implemented.
>
> -Alexey

There's %pK for kernel pointers. It does what you want and can be toggled with kptr_restrict, without introducing security holes. :)

Perhaps split up this patch per driver, and handle the other variations as well?

DRM_NOTE DRM_WARN DRM_INFO DRM_ERROR.


~Maarten

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2018-04-18 10:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-18  9:24 [PATCH] drm: Print unadorned pointers Alexey Brodkin
2018-04-18  9:24 ` Alexey Brodkin
2018-04-18  9:29 ` Maarten Lankhorst
2018-04-18  9:29   ` Maarten Lankhorst
2018-04-18  9:59   ` Alexey Brodkin
2018-04-18  9:59     ` Alexey Brodkin
2018-04-18 10:08     ` Maarten Lankhorst [this message]
2018-04-18 10:08       ` Maarten Lankhorst
2018-04-18 15:52 ` Greg Kroah-Hartman
2018-04-18 15:52 ` Greg Kroah-Hartman
2018-04-18 15:52   ` Greg Kroah-Hartman
2018-04-18 15:53 ` Felix Kuehling
2018-04-18 15:53   ` Felix Kuehling

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=432801bd-a775-5b48-00c4-2160ae52c25b@linux.intel.com \
    --to=maarten.lankhorst@linux.intel.com \
    --cc=linux-snps-arc@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.