Skip to contentSkip to conversation

x86/mm/ptdump: Make (debugfs)/kernel_page_tables read-only

PATCH In review Borislav Petkov 3 participants 4 messages Nov 30, 2015 – Dec 4, 2015

Subsystems (2)
lore
Share & tools
lore

Borislav Petkov

author maintainer
#0 lore raw

PATCH 1/1 x86/mm/ptdump: Make (debugfs)/kernel_page_tables read-only

From: Borislav Petkov <[email protected]>

File should be created with S_IRUSR and not with S_IWUSR too because writing to it doesn't make any sense. I mean, we don't have a ->write method anyway but let's have the permissions correct too.

Cc Arjan van de Ven <[email protected]>
---
 arch/x86/mm/debug_pagetables.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/mm/debug_pagetables.c +1 -1
index b35ee86a9316..bfcffdf6c577 100644
@@ -26,7 +26,7 @@ static struct dentry *pe;
 
 static int __init pt_dump_debug_init(void)
 {
-	pe = debugfs_create_file("kernel_page_tables", 0600, NULL, NULL,
+	pe = debugfs_create_file("kernel_page_tables", S_IRUSR, NULL, NULL,
 				 &ptdump_fops);
 	if (!pe)
 		return -ENOMEM;
Signature · 1 line
2.3.5
#1 lore raw

[tip:x86/mm] x86/mm/ptdump: Make (debugfs)/ kernel_page_tables read-only

x86/mm/ptdump: Make (debugfs)/kernel_page_tables read-only
Commit-ID:  071ac0c4e8e90d5de05f0779b03ae69ce84820d5
Gitweb:     http://git.kernel.org/tip/071ac0c4e8e90d5de05f0779b03ae69ce84820d5
Author:     Borislav Petkov <[email protected]>
AuthorDate: Mon, 30 Nov 2015 13:12:59 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Fri, 4 Dec 2015 12:55:01 +0100

x86/mm/ptdump: Make (debugfs)/kernel_page_tables read-only

File should be created with S_IRUSR and not with S_IWUSR too because writing to it doesn't make any sense. I mean, we don't have a ->write method anyway but let's have the permissions correct too.

Cc Andrew Morton <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Arjan van de Ven <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Brian Gerst <[email protected]>
Cc Denys Vlasenko <[email protected]>
Cc H. Peter Anvin <[email protected]>
Cc Kees Cook <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Paul E. McKenney <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 arch/x86/mm/debug_pagetables.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/mm/debug_pagetables.c +1 -1
index b35ee86..bfcffdf 100644
@@ -26,7 +26,7 @@ static struct dentry *pe;
 
 static int __init pt_dump_debug_init(void)
 {
-	pe = debugfs_create_file("kernel_page_tables", 0600, NULL, NULL,
+	pe = debugfs_create_file("kernel_page_tables", S_IRUSR, NULL, NULL,
 				 &ptdump_fops);
 	if (!pe)
 		return -ENOMEM;
Acked-by on v1 1/1
#2 lore raw
In reply to Borislav Petkov
Quoted 8 lines · Borislav Petkov

From: Borislav Petkov <[email protected]>

File should be created with S_IRUSR and not with S_IWUSR too because writing to it doesn't make any sense. I mean, we don't have a ->write method anyway but let's have the permissions correct too.

Cc Arjan van de Ven <[email protected]>

We need a EHAHANOPE errno and have write return that. ;)

-Kees

Quoted 25 lines
---
 arch/x86/mm/debug_pagetables.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/mm/debug_pagetables.c +1 -2
index b35ee86a9316..bfcffdf6c577 100644
@@ -26,7 +26,7 @@ static struct dentry *pe;
 
 static int __init pt_dump_debug_init(void)
 {
-       pe = debugfs_create_file("kernel_page_tables", 0600, NULL, NULL,
+       pe = debugfs_create_file("kernel_page_tables", S_IRUSR, NULL, NULL,
                                 &ptdump_fops);
        if (!pe)
                return -ENOMEM;
--

2.3.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 2 lines
Kees Cook
Chrome OS & Brillo Security
author maintainer
#3 lore raw
Quoted 1 line · Kees Cook

We need a EHAHANOPE errno and have write return that. ;)

Sure, lemme add it to glibc:

---

manual/errno.texi +6 -1
index 1068be3a5072..ec92cc00f81b 100644
@@ -1279,6 +1279,12 @@ They are not yet documented.}
 @comment errno ???/???
 @end deftypevr
 
+@comment errno.h
+@comment Linux: Haha, nope, you wish.
+@deftypevar Macro int EHAHANOPE
+@comment errno ???/???
+@end deftypevr
+
 @node Error Messages,  , Error Codes, Error Reporting
 @section Error Messages
---

:-P

Signature · 4 lines
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.