Skip to content

Commit 39380b8

Browse files
Jiri Kosinaingomolnar
authored andcommitted
x86/mm/pat, /dev/mem: Remove superfluous error message
Currently it's possible for broken (or malicious) userspace to flood a kernel log indefinitely with messages a-la Program dmidecode tried to access /dev/mem between f0000->100000 because range_is_allowed() is case of CONFIG_STRICT_DEVMEM being turned on dumps this information each and every time devmem_is_allowed() fails. Reportedly userspace that is able to trigger contignuous flow of these messages exists. It would be possible to rate limit this message, but that'd have a questionable value; the administrator wouldn't get information about all the failing accessess, so then the information would be both superfluous and incomplete at the same time :) Returning EPERM (which is what is actually happening) is enough indication for userspace what has happened; no need to log this particular error as some sort of special condition. Signed-off-by: Jiri Kosina <jkosina@suse.cz> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Andy Lutomirski <luto@kernel.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Kees Cook <keescook@chromium.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Luis R. Rodriguez <mcgrof@suse.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Toshi Kani <toshi.kani@hp.com> Link: http://lkml.kernel.org/r/alpine.LNX.2.00.1607081137020.24757@cbobk.fhfr.pm Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 946e0f6 commit 39380b8

2 files changed

Lines changed: 2 additions & 9 deletions

File tree

‎arch/x86/mm/pat.c‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -755,11 +755,8 @@ static inline int range_is_allowed(unsigned long pfn, unsigned long size)
755755
return 1;
756756

757757
while (cursor < to) {
758-
if (!devmem_is_allowed(pfn)) {
759-
pr_info("x86/PAT: Program %s tried to access /dev/mem between [mem %#010Lx-%#010Lx], PAT prevents it\n",
760-
current->comm, from, to - 1);
758+
if (!devmem_is_allowed(pfn))
761759
return 0;
762-
}
763760
cursor += PAGE_SIZE;
764761
pfn++;
765762
}

‎drivers/char/mem.c‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,8 @@ static inline int range_is_allowed(unsigned long pfn, unsigned long size)
6666
u64 cursor = from;
6767

6868
while (cursor < to) {
69-
if (!devmem_is_allowed(pfn)) {
70-
printk(KERN_INFO
71-
"Program %s tried to access /dev/mem between %Lx->%Lx.\n",
72-
current->comm, from, to);
69+
if (!devmem_is_allowed(pfn))
7370
return 0;
74-
}
7571
cursor += PAGE_SIZE;
7672
pfn++;
7773
}

0 commit comments

Comments
 (0)