Re: [PATCH] printk: fix printk.devkmsg sysctl

2017-02-01 Thread Sergey Senozhatsky
; Date: Tue, 31 Jan 2017 12:00:13 +0100 > Subject: [PATCH] printk: Fix printk.devkmsg sysctl > > The code handling write into /proc/sys/kernel/printk_devkmsg expects > a new line at the end of the string but does not check it. As a result > it allows: > > # echo -n of

Re: [PATCH] printk: fix printk.devkmsg sysctl

2017-02-01 Thread Sergey Senozhatsky
12:00:13 +0100 > Subject: [PATCH] printk: Fix printk.devkmsg sysctl > > The code handling write into /proc/sys/kernel/printk_devkmsg expects > a new line at the end of the string but does not check it. As a result > it allows: > > # echo -n offX > /proc/sys/kernel/printk_de

Re: [PATCH] printk: fix printk.devkmsg sysctl

2017-01-31 Thread Petr Mladek
r mispelling, including a non-newline suffix. >From 0ce6125caf314270cb48202390d8a0938fdf316e Mon Sep 17 00:00:00 2001 From: Petr Mladek <pmla...@suse.com> Date: Tue, 31 Jan 2017 12:00:13 +0100 Subject: [PATCH] printk: Fix printk.devkmsg sysctl The code handling write into /proc/sys/kerne

Re: [PATCH] printk: fix printk.devkmsg sysctl

2017-01-31 Thread Petr Mladek
r mispelling, including a non-newline suffix. >From 0ce6125caf314270cb48202390d8a0938fdf316e Mon Sep 17 00:00:00 2001 From: Petr Mladek Date: Tue, 31 Jan 2017 12:00:13 +0100 Subject: [PATCH] printk: Fix printk.devkmsg sysctl The code handling write into /proc/sys/kernel/printk_devkmsg expects

Re: [PATCH] printk: fix printk.devkmsg sysctl

2017-01-30 Thread Borislav Petkov
On Mon, Jan 30, 2017 at 06:03:18PM +0100, Borislav Petkov wrote: > IOW, I'd like the user to know what she does and mean it. No sloppy > inputs. Ok, here's what I wanna do. I decided to do my own parsing on the write path since proc_dostring() does not really allow me to look at the input string.

Re: [PATCH] printk: fix printk.devkmsg sysctl

2017-01-30 Thread Borislav Petkov
On Mon, Jan 30, 2017 at 06:03:18PM +0100, Borislav Petkov wrote: > IOW, I'd like the user to know what she does and mean it. No sloppy > inputs. Ok, here's what I wanna do. I decided to do my own parsing on the write path since proc_dostring() does not really allow me to look at the input string.

Re: [PATCH] printk: fix printk.devkmsg sysctl

2017-01-30 Thread Borislav Petkov
On Mon, Jan 30, 2017 at 06:31:38PM +0100, Rabin Vincent wrote: > Would it be possible for you to please submit it as a patch yourself so > that this gets fixed in the way you like? Thank you. Sure. I'll add your Reported-by when we're done. -- Regards/Gruss, Boris. SUSE Linux GmbH, GF:

Re: [PATCH] printk: fix printk.devkmsg sysctl

2017-01-30 Thread Borislav Petkov
On Mon, Jan 30, 2017 at 06:31:38PM +0100, Rabin Vincent wrote: > Would it be possible for you to please submit it as a patch yourself so > that this gets fixed in the way you like? Thank you. Sure. I'll add your Reported-by when we're done. -- Regards/Gruss, Boris. SUSE Linux GmbH, GF:

Re: [PATCH] printk: fix printk.devkmsg sysctl

2017-01-30 Thread Rabin Vincent
On Fri, Jan 27, 2017 at 07:19:30PM +0100, Borislav Petkov wrote: > On Fri, Jan 27, 2017 at 04:42:30PM +0100, Rabin Vincent wrote: > > proc_dostring() eats the '\n' and stops > > Not a problem, see diff below. Would it be possible for you to please submit it as a patch yourself so that this gets

Re: [PATCH] printk: fix printk.devkmsg sysctl

2017-01-30 Thread Rabin Vincent
On Fri, Jan 27, 2017 at 07:19:30PM +0100, Borislav Petkov wrote: > On Fri, Jan 27, 2017 at 04:42:30PM +0100, Rabin Vincent wrote: > > proc_dostring() eats the '\n' and stops > > Not a problem, see diff below. Would it be possible for you to please submit it as a patch yourself so that this gets

Re: [PATCH] printk: fix printk.devkmsg sysctl

2017-01-30 Thread Borislav Petkov
On Mon, Jan 30, 2017 at 02:38:03PM +0100, Petr Mladek wrote: > We must not access userspace pointer directly. One solution would be > to use get_user(). Good point. > But a better solution might be to check also the trailing '\0' in > __control_devkmsg, see below. I has several advantages: > >

Re: [PATCH] printk: fix printk.devkmsg sysctl

2017-01-30 Thread Borislav Petkov
On Mon, Jan 30, 2017 at 02:38:03PM +0100, Petr Mladek wrote: > We must not access userspace pointer directly. One solution would be > to use get_user(). Good point. > But a better solution might be to check also the trailing '\0' in > __control_devkmsg, see below. I has several advantages: > >

Re: [PATCH] printk: fix printk.devkmsg sysctl

2017-01-30 Thread Petr Mladek
On Fri 2017-01-27 19:19:30, Borislav Petkov wrote: > + printk folk. > > On Fri, Jan 27, 2017 at 04:42:30PM +0100, Rabin Vincent wrote: > > proc_dostring() eats the '\n' and stops > > Not a problem, see diff below. > > Please do it this way instead because after a month no one will remember >

Re: [PATCH] printk: fix printk.devkmsg sysctl

2017-01-30 Thread Petr Mladek
On Fri 2017-01-27 19:19:30, Borislav Petkov wrote: > + printk folk. > > On Fri, Jan 27, 2017 at 04:42:30PM +0100, Rabin Vincent wrote: > > proc_dostring() eats the '\n' and stops > > Not a problem, see diff below. > > Please do it this way instead because after a month no one will remember >

Re: [PATCH] printk: fix printk.devkmsg sysctl

2017-01-27 Thread Borislav Petkov
+ printk folk. On Fri, Jan 27, 2017 at 04:42:30PM +0100, Rabin Vincent wrote: > proc_dostring() eats the '\n' and stops Not a problem, see diff below. Please do it this way instead because after a month no one will remember what this complex conditional means > + if (err < 0 ||

Re: [PATCH] printk: fix printk.devkmsg sysctl

2017-01-27 Thread Borislav Petkov
+ printk folk. On Fri, Jan 27, 2017 at 04:42:30PM +0100, Rabin Vincent wrote: > proc_dostring() eats the '\n' and stops Not a problem, see diff below. Please do it this way instead because after a month no one will remember what this complex conditional means > + if (err < 0 ||

Re: [PATCH] printk: fix printk.devkmsg sysctl

2017-01-27 Thread Rabin Vincent
On Fri, Jan 27, 2017 at 04:01:41PM +0100, Borislav Petkov wrote: > On Fri, Jan 27, 2017 at 02:11:46PM +0100, Rabin Vincent wrote: > > @@ -177,7 +177,7 @@ int devkmsg_sysctl_set_loglvl(struct ctl_table *table, > > int write, > > * Do not accept an unknown string OR a known string with

Re: [PATCH] printk: fix printk.devkmsg sysctl

2017-01-27 Thread Rabin Vincent
On Fri, Jan 27, 2017 at 04:01:41PM +0100, Borislav Petkov wrote: > On Fri, Jan 27, 2017 at 02:11:46PM +0100, Rabin Vincent wrote: > > @@ -177,7 +177,7 @@ int devkmsg_sysctl_set_loglvl(struct ctl_table *table, > > int write, > > * Do not accept an unknown string OR a known string with

Re: [PATCH] printk: fix printk.devkmsg sysctl

2017-01-27 Thread Borislav Petkov
On Fri, Jan 27, 2017 at 02:11:46PM +0100, Rabin Vincent wrote: > From: Rabin Vincent > > The comment says that it doesn't want to accept trailing crap but that's > just what it allows: ... > @@ -177,7 +177,7 @@ int devkmsg_sysctl_set_loglvl(struct ctl_table *table, > int

Re: [PATCH] printk: fix printk.devkmsg sysctl

2017-01-27 Thread Borislav Petkov
On Fri, Jan 27, 2017 at 02:11:46PM +0100, Rabin Vincent wrote: > From: Rabin Vincent > > The comment says that it doesn't want to accept trailing crap but that's > just what it allows: ... > @@ -177,7 +177,7 @@ int devkmsg_sysctl_set_loglvl(struct ctl_table *table, > int write, >

[PATCH] printk: fix printk.devkmsg sysctl

2017-01-27 Thread Rabin Vincent
From: Rabin Vincent The comment says that it doesn't want to accept trailing crap but that's just what it allows: # echo -n offX > /proc/sys/kernel/printk_devkmsg # while at the same time it rejects legitimate uses: # echo -n off > /proc/sys/kernel/printk_devkmsg -sh:

[PATCH] printk: fix printk.devkmsg sysctl

2017-01-27 Thread Rabin Vincent
From: Rabin Vincent The comment says that it doesn't want to accept trailing crap but that's just what it allows: # echo -n offX > /proc/sys/kernel/printk_devkmsg # while at the same time it rejects legitimate uses: # echo -n off > /proc/sys/kernel/printk_devkmsg -sh: echo: write error: