Skip to content

Commit

Permalink
[PATCH] remove the syslog interface when printk is disabled
Browse files Browse the repository at this point in the history
Attempts to read() from the non-existent dmesg buffer will return zero and
userspace tends to get stuck in a busyloop.

So just remove /dev/kmsg altogether if CONFIG_PRINTK=n.

Signed-off-by: Mike Galbraith <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Mike Galbraith authored and Linus Torvalds committed Dec 7, 2006
1 parent 44ddc4f commit c36264d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
3 changes: 2 additions & 1 deletion fs/proc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ proc-y := nommu.o task_nommu.o
proc-$(CONFIG_MMU) := mmu.o task_mmu.o

proc-y += inode.o root.o base.o generic.o array.o \
kmsg.o proc_tty.o proc_misc.o
proc_tty.o proc_misc.o

proc-$(CONFIG_PROC_KCORE) += kcore.o
proc-$(CONFIG_PROC_VMCORE) += vmcore.o
proc-$(CONFIG_PROC_DEVICETREE) += proc_devtree.o
proc-$(CONFIG_PRINTK) += kmsg.o
2 changes: 2 additions & 0 deletions fs/proc/proc_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -696,9 +696,11 @@ void __init proc_misc_init(void)
proc_symlink("mounts", NULL, "self/mounts");

/* And now for trickier ones */
#ifdef CONFIG_PRINTK
entry = create_proc_entry("kmsg", S_IRUSR, &proc_root);
if (entry)
entry->proc_fops = &proc_kmsg_operations;
#endif
create_seq_entry("devices", 0, &proc_devinfo_operations);
create_seq_entry("cpuinfo", 0, &proc_cpuinfo_operations);
#ifdef CONFIG_BLOCK
Expand Down
7 changes: 1 addition & 6 deletions kernel/printk.c
Original file line number Diff line number Diff line change
Expand Up @@ -631,12 +631,7 @@ EXPORT_SYMBOL(vprintk);

asmlinkage long sys_syslog(int type, char __user *buf, int len)
{
return 0;
}

int do_syslog(int type, char __user *buf, int len)
{
return 0;
return -ENOSYS;
}

static void call_console_drivers(unsigned long start, unsigned long end)
Expand Down

0 comments on commit c36264d

Please sign in to comment.