Kernel-hardening archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] x86/mm/init: Stop printing pgt_buf addresses
@ 2020-02-29 23:11 Arvind Sankar
  2020-02-29 23:23 ` Kees Cook
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Arvind Sankar @ 2020-02-29 23:11 UTC (permalink / raw)
  To: Tobin C . Harding, Tycho Andersen
  Cc: kernel-hardening, Kees Cook, Dave Hansen, Andy Lutomirski,
	Peter Zijlstra, x86, linux-kernel

This currently leaks kernel physical addresses into userspace.

Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
---
 arch/x86/mm/init.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index e7bb483557c9..dc4711f09cdc 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -121,8 +121,6 @@ __ref void *alloc_low_pages(unsigned int num)
 	} else {
 		pfn = pgt_buf_end;
 		pgt_buf_end += num;
-		printk(KERN_DEBUG "BRK [%#010lx, %#010lx] PGTABLE\n",
-			pfn << PAGE_SHIFT, (pgt_buf_end << PAGE_SHIFT) - 1);
 	}
 
 	for (i = 0; i < num; i++) {
-- 
2.24.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] x86/mm/init: Stop printing pgt_buf addresses
  2020-02-29 23:11 [PATCH] x86/mm/init: Stop printing pgt_buf addresses Arvind Sankar
@ 2020-02-29 23:23 ` Kees Cook
  2020-04-09 22:19 ` Arvind Sankar
  2020-05-23  1:51 ` Arvind Sankar
  2 siblings, 0 replies; 6+ messages in thread
From: Kees Cook @ 2020-02-29 23:23 UTC (permalink / raw)
  To: x86
  Cc: Arvind Sankar, Tobin C . Harding, Tycho Andersen,
	kernel-hardening, Dave Hansen, Andy Lutomirski, Peter Zijlstra,
	linux-kernel

On Sat, Feb 29, 2020 at 06:11:20PM -0500, Arvind Sankar wrote:
> This currently leaks kernel physical addresses into userspace.
> 
> Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>

Acked-by: Kees Cook <keescook@chromium.org>

-Kees

> ---
>  arch/x86/mm/init.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
> index e7bb483557c9..dc4711f09cdc 100644
> --- a/arch/x86/mm/init.c
> +++ b/arch/x86/mm/init.c
> @@ -121,8 +121,6 @@ __ref void *alloc_low_pages(unsigned int num)
>  	} else {
>  		pfn = pgt_buf_end;
>  		pgt_buf_end += num;
> -		printk(KERN_DEBUG "BRK [%#010lx, %#010lx] PGTABLE\n",
> -			pfn << PAGE_SHIFT, (pgt_buf_end << PAGE_SHIFT) - 1);
>  	}
>  
>  	for (i = 0; i < num; i++) {
> -- 
> 2.24.1
> 

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] x86/mm/init: Stop printing pgt_buf addresses
  2020-02-29 23:11 [PATCH] x86/mm/init: Stop printing pgt_buf addresses Arvind Sankar
  2020-02-29 23:23 ` Kees Cook
@ 2020-04-09 22:19 ` Arvind Sankar
  2020-04-09 22:35   ` Dave Hansen
  2020-05-23  1:51 ` Arvind Sankar
  2 siblings, 1 reply; 6+ messages in thread
From: Arvind Sankar @ 2020-04-09 22:19 UTC (permalink / raw)
  To: Arvind Sankar
  Cc: Tobin C . Harding, Tycho Andersen, kernel-hardening, Kees Cook,
	Dave Hansen, Andy Lutomirski, Peter Zijlstra, x86, linux-kernel

On Sat, Feb 29, 2020 at 06:11:20PM -0500, Arvind Sankar wrote:
> This currently leaks kernel physical addresses into userspace.
> 
> Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
> ---
>  arch/x86/mm/init.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
> index e7bb483557c9..dc4711f09cdc 100644
> --- a/arch/x86/mm/init.c
> +++ b/arch/x86/mm/init.c
> @@ -121,8 +121,6 @@ __ref void *alloc_low_pages(unsigned int num)
>  	} else {
>  		pfn = pgt_buf_end;
>  		pgt_buf_end += num;
> -		printk(KERN_DEBUG "BRK [%#010lx, %#010lx] PGTABLE\n",
> -			pfn << PAGE_SHIFT, (pgt_buf_end << PAGE_SHIFT) - 1);
>  	}
>  
>  	for (i = 0; i < num; i++) {
> -- 
> 2.24.1
> 

This was acked by Kees, is it ok for merge?

Thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] x86/mm/init: Stop printing pgt_buf addresses
  2020-04-09 22:19 ` Arvind Sankar
@ 2020-04-09 22:35   ` Dave Hansen
  0 siblings, 0 replies; 6+ messages in thread
From: Dave Hansen @ 2020-04-09 22:35 UTC (permalink / raw)
  To: Arvind Sankar
  Cc: Tobin C . Harding, Tycho Andersen, kernel-hardening, Kees Cook,
	Andy Lutomirski, Peter Zijlstra, x86, linux-kernel

On 4/9/20 3:19 PM, Arvind Sankar wrote:
>> @@ -121,8 +121,6 @@ __ref void *alloc_low_pages(unsigned int num)
>>  	} else {
>>  		pfn = pgt_buf_end;
>>  		pgt_buf_end += num;
>> -		printk(KERN_DEBUG "BRK [%#010lx, %#010lx] PGTABLE\n",
>> -			pfn << PAGE_SHIFT, (pgt_buf_end << PAGE_SHIFT) - 1);
>>  	}
>>  
>>  	for (i = 0; i < num; i++) {
>> -- 
>> 2.24.1
>>
> This was acked by Kees, is it ok for merge?

Independent of the obvious security implications, I don't think I've
ever once gleaned useful information from that message.  It's fine by me.

Acked-by: Dave Hansen <dave.hansen@intel.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] x86/mm/init: Stop printing pgt_buf addresses
  2020-02-29 23:11 [PATCH] x86/mm/init: Stop printing pgt_buf addresses Arvind Sankar
  2020-02-29 23:23 ` Kees Cook
  2020-04-09 22:19 ` Arvind Sankar
@ 2020-05-23  1:51 ` Arvind Sankar
  2020-05-23  2:57   ` Joe Perches
  2 siblings, 1 reply; 6+ messages in thread
From: Arvind Sankar @ 2020-05-23  1:51 UTC (permalink / raw)
  To: Arvind Sankar
  Cc: Tobin C . Harding, Tycho Andersen, kernel-hardening, Kees Cook,
	Dave Hansen, Andy Lutomirski, Peter Zijlstra, x86, linux-kernel

On Sat, Feb 29, 2020 at 06:11:20PM -0500, Arvind Sankar wrote:
> This currently leaks kernel physical addresses into userspace.
> 
> Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
> ---
>  arch/x86/mm/init.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
> index e7bb483557c9..dc4711f09cdc 100644
> --- a/arch/x86/mm/init.c
> +++ b/arch/x86/mm/init.c
> @@ -121,8 +121,6 @@ __ref void *alloc_low_pages(unsigned int num)
>  	} else {
>  		pfn = pgt_buf_end;
>  		pgt_buf_end += num;
> -		printk(KERN_DEBUG "BRK [%#010lx, %#010lx] PGTABLE\n",
> -			pfn << PAGE_SHIFT, (pgt_buf_end << PAGE_SHIFT) - 1);
>  	}
>  
>  	for (i = 0; i < num; i++) {
> -- 
> 2.24.1
> 

Ping.

https://lore.kernel.org/lkml/20200229231120.1147527-1-nivedita@alum.mit.edu/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] x86/mm/init: Stop printing pgt_buf addresses
  2020-05-23  1:51 ` Arvind Sankar
@ 2020-05-23  2:57   ` Joe Perches
  0 siblings, 0 replies; 6+ messages in thread
From: Joe Perches @ 2020-05-23  2:57 UTC (permalink / raw)
  To: Arvind Sankar
  Cc: Tobin C . Harding, Tycho Andersen, kernel-hardening, Kees Cook,
	Dave Hansen, Andy Lutomirski, Peter Zijlstra, x86, linux-kernel

On Fri, 2020-05-22 at 21:51 -0400, Arvind Sankar wrote:
> On Sat, Feb 29, 2020 at 06:11:20PM -0500, Arvind Sankar wrote:
> > This currently leaks kernel physical addresses into userspace.
> > 
> > Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
> > ---
> >  arch/x86/mm/init.c | 2 --
> >  1 file changed, 2 deletions(-)
> > 
> > diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
> > index e7bb483557c9..dc4711f09cdc 100644
> > --- a/arch/x86/mm/init.c
> > +++ b/arch/x86/mm/init.c
> > @@ -121,8 +121,6 @@ __ref void *alloc_low_pages(unsigned int num)
> >  	} else {
> >  		pfn = pgt_buf_end;
> >  		pgt_buf_end += num;
> > -		printk(KERN_DEBUG "BRK [%#010lx, %#010lx] PGTABLE\n",
> > -			pfn << PAGE_SHIFT, (pgt_buf_end << PAGE_SHIFT) - 1);
> >  	}
> >  
> >  	for (i = 0; i < num; i++) {
> > -- 
> > 2.24.1
> > 
> 
> Ping.
> 
> https://lore.kernel.org/lkml/20200229231120.1147527-1-nivedita@alum.mit.edu/

If this output is at all valuable,
perhaps emit them as hashed pointers?

Maybe:

---
 arch/x86/mm/init.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index 1bba16c5742b..44f0d6592c7e 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -121,8 +121,9 @@ __ref void *alloc_low_pages(unsigned int num)
 	} else {
 		pfn = pgt_buf_end;
 		pgt_buf_end += num;
-		printk(KERN_DEBUG "BRK [%#010lx, %#010lx] PGTABLE\n",
-			pfn << PAGE_SHIFT, (pgt_buf_end << PAGE_SHIFT) - 1);
+		printk(KERN_DEBUG "BRK [0x%8p, 0x%8p] PGTABLE\n",
+		       (void *)(pfn << PAGE_SHIFT),
+		       (void *)((pgt_buf_end << PAGE_SHIFT) - 1));
 	}
 
 	for (i = 0; i < num; i++) {



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, back to index

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-29 23:11 [PATCH] x86/mm/init: Stop printing pgt_buf addresses Arvind Sankar
2020-02-29 23:23 ` Kees Cook
2020-04-09 22:19 ` Arvind Sankar
2020-04-09 22:35   ` Dave Hansen
2020-05-23  1:51 ` Arvind Sankar
2020-05-23  2:57   ` Joe Perches

Kernel-hardening archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/kernel-hardening/0 kernel-hardening/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 kernel-hardening kernel-hardening/ https://lore.kernel.org/kernel-hardening \
		kernel-hardening@lists.openwall.com
	public-inbox-index kernel-hardening

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/com.openwall.lists.kernel-hardening


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git