Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-09-15 Thread Eric W. Biederman
On September 15, 2015 4:30:56 AM CDT, Sean Fu wrote: >On Mon, Sep 14, 2015 at 12:44 AM, Eric W. Biederman > wrote: >> Sean Fu writes: >> >>> On Sat, Sep 12, 2015 at 1:01 AM, Eric W. Biederman >>> wrote: Sean Fu writes: >> '\0' is not and has never been valid in a text file. >> proc

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-09-15 Thread Steven Rostedt
On Tue, 15 Sep 2015 17:10:11 +0800 Sean Fu wrote: > According to POSIX standard, "The write() function shall attempt to > write nbyte bytes from the buffer pointed to by buf to the file > associated with the open file descriptor, fildes.". > So it is not the length of string(strlen). Why do we

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-09-15 Thread Sean Fu
On Mon, Sep 14, 2015 at 12:44 AM, Eric W. Biederman wrote: > Sean Fu writes: > >> On Sat, Sep 12, 2015 at 1:01 AM, Eric W. Biederman >> wrote: >>> Sean Fu writes: > '\0' is not and has never been valid in a text file. > proc files are a text interface. > Expecting '\0' to be accepted is very

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-09-15 Thread Sean Fu
According to POSIX standard, "The write() function shall attempt to write nbyte bytes from the buffer pointed to by buf to the file associated with the open file descriptor, fildes.". So it is not the length of string(strlen). On Mon, Sep 14, 2015 at 4:05 AM, Steven Rostedt wrote: > On Sun, 13

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-09-15 Thread Sean Fu
According to POSIX standard, "The write() function shall attempt to write nbyte bytes from the buffer pointed to by buf to the file associated with the open file descriptor, fildes.". So it is not the length of string(strlen). On Mon, Sep 14, 2015 at 4:05 AM, Steven Rostedt

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-09-15 Thread Sean Fu
On Mon, Sep 14, 2015 at 12:44 AM, Eric W. Biederman wrote: > Sean Fu writes: > >> On Sat, Sep 12, 2015 at 1:01 AM, Eric W. Biederman >> wrote: >>> Sean Fu writes: > '\0' is not and has never been valid in a

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-09-15 Thread Eric W. Biederman
On September 15, 2015 4:30:56 AM CDT, Sean Fu wrote: >On Mon, Sep 14, 2015 at 12:44 AM, Eric W. Biederman > wrote: >> Sean Fu writes: >> >>> On Sat, Sep 12, 2015 at 1:01 AM, Eric W. Biederman >>> wrote:

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-09-15 Thread Steven Rostedt
On Tue, 15 Sep 2015 17:10:11 +0800 Sean Fu wrote: > According to POSIX standard, "The write() function shall attempt to > write nbyte bytes from the buffer pointed to by buf to the file > associated with the open file descriptor, fildes.". > So it is not the length of

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-09-13 Thread Steven Rostedt
On Sun, 13 Sep 2015 20:39:31 +0800 Sean Fu wrote: > > Accepting a '\0' is not at all reasonable for a text interface. The > > application that does it is buggy. > It is hard to comprehend that the current kernel can accept two bytes > "1 ", "1\t", "1\n" except "1\0". Um, it does not seem

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-09-13 Thread Eric W. Biederman
Sean Fu writes: > On Sat, Sep 12, 2015 at 1:01 AM, Eric W. Biederman > wrote: >> Sean Fu writes: >> Sounds like a reasonable compromise. Sean, can you make a patch that only affects the one proc file (comment it well in the code), and have it accept nothing past the '\0'. Even

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-09-13 Thread Sean Fu
On Sat, Sep 12, 2015 at 1:01 AM, Eric W. Biederman wrote: > Sean Fu writes: > >>> Sounds like a reasonable compromise. Sean, can you make a patch that >>> only affects the one proc file (comment it well in the code), and have >>> it accept nothing past the '\0'. Even if someone passed in "1 \0

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-09-13 Thread Sean Fu
On Sat, Sep 12, 2015 at 1:01 AM, Eric W. Biederman wrote: > Sean Fu writes: > >>> Sounds like a reasonable compromise. Sean, can you make a patch that >>> only affects the one proc file (comment it well in the code), and have >>> it accept nothing past

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-09-13 Thread Eric W. Biederman
Sean Fu writes: > On Sat, Sep 12, 2015 at 1:01 AM, Eric W. Biederman > wrote: >> Sean Fu writes: >> Sounds like a reasonable compromise. Sean, can you make a patch that only affects the one proc file (comment it well in

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-09-13 Thread Steven Rostedt
On Sun, 13 Sep 2015 20:39:31 +0800 Sean Fu wrote: > > Accepting a '\0' is not at all reasonable for a text interface. The > > application that does it is buggy. > It is hard to comprehend that the current kernel can accept two bytes > "1 ", "1\t", "1\n" except "1\0". Um,

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-09-11 Thread Eric W. Biederman
Sean Fu writes: >> Sounds like a reasonable compromise. Sean, can you make a patch that >> only affects the one proc file (comment it well in the code), and have >> it accept nothing past the '\0'. Even if someone passed in "1 \0 2", it >> would only see "1 " > The current code uses uniform

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-09-11 Thread Steven Rostedt
On Fri, 11 Sep 2015 17:05:31 +0800 Sean Fu wrote: > > Sounds like a reasonable compromise. Sean, can you make a patch that > > only affects the one proc file (comment it well in the code), and have > > it accept nothing past the '\0'. Even if someone passed in "1 \0 2", it > > would only see "1

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-09-11 Thread Sean Fu
On Wed, Sep 9, 2015 at 12:36 AM, Steven Rostedt wrote: > On Tue, 08 Sep 2015 11:19:14 -0500 > ebied...@xmission.com (Eric W. Biederman) wrote: > > >> This patch does not implement the old behavior. >> >> The old code does use '\0' as a buffer terminator, and because it does >> not check things

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-09-11 Thread Eric W. Biederman
Sean Fu writes: >> Sounds like a reasonable compromise. Sean, can you make a patch that >> only affects the one proc file (comment it well in the code), and have >> it accept nothing past the '\0'. Even if someone passed in "1 \0 2", it >> would only see "1 " > The current

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-09-11 Thread Sean Fu
On Wed, Sep 9, 2015 at 12:36 AM, Steven Rostedt wrote: > On Tue, 08 Sep 2015 11:19:14 -0500 > ebied...@xmission.com (Eric W. Biederman) wrote: > > >> This patch does not implement the old behavior. >> >> The old code does use '\0' as a buffer terminator, and because it does

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-09-11 Thread Steven Rostedt
On Fri, 11 Sep 2015 17:05:31 +0800 Sean Fu wrote: > > Sounds like a reasonable compromise. Sean, can you make a patch that > > only affects the one proc file (comment it well in the code), and have > > it accept nothing past the '\0'. Even if someone passed in "1 \0 2", it >

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-09-08 Thread Steven Rostedt
On Tue, 08 Sep 2015 11:19:14 -0500 ebied...@xmission.com (Eric W. Biederman) wrote: > This patch does not implement the old behavior. > > The old code does use '\0' as a buffer terminator, and because it does > not check things closely I can see how it could accept a '\0' from > userspace and

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-09-08 Thread Eric W. Biederman
Steven Rostedt writes: > On Tue, 8 Sep 2015 11:11:38 +0800 > Sean Fu wrote: > >> On Fri, Aug 28, 2015 at 11:31 AM, Sean Fu wrote: >> > On Thu, Aug 27, 2015 at 4:32 PM, Sean Fu wrote: >> >> On Thu, Aug 27, 2015 at 10:32 AM, Steven Rostedt >> >> wrote: >> >>> On Thu, 27 Aug 2015 08:17:29

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-09-08 Thread Steven Rostedt
On Tue, 8 Sep 2015 11:11:38 +0800 Sean Fu wrote: > On Fri, Aug 28, 2015 at 11:31 AM, Sean Fu wrote: > > On Thu, Aug 27, 2015 at 4:32 PM, Sean Fu wrote: > >> On Thu, Aug 27, 2015 at 10:32 AM, Steven Rostedt > >> wrote: > >>> On Thu, 27 Aug 2015 08:17:29 +0800 > >>> Sean Fu wrote: >

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-09-08 Thread Steven Rostedt
On Tue, 8 Sep 2015 11:11:38 +0800 Sean Fu wrote: > On Fri, Aug 28, 2015 at 11:31 AM, Sean Fu wrote: > > On Thu, Aug 27, 2015 at 4:32 PM, Sean Fu wrote: > >> On Thu, Aug 27, 2015 at 10:32 AM, Steven Rostedt > >>

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-09-08 Thread Eric W. Biederman
Steven Rostedt writes: > On Tue, 8 Sep 2015 11:11:38 +0800 > Sean Fu wrote: > >> On Fri, Aug 28, 2015 at 11:31 AM, Sean Fu wrote: >> > On Thu, Aug 27, 2015 at 4:32 PM, Sean Fu wrote: >> >> On Thu, Aug 27, 2015 at

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-09-08 Thread Steven Rostedt
On Tue, 08 Sep 2015 11:19:14 -0500 ebied...@xmission.com (Eric W. Biederman) wrote: > This patch does not implement the old behavior. > > The old code does use '\0' as a buffer terminator, and because it does > not check things closely I can see how it could accept a '\0' from > userspace and

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-09-07 Thread Sean Fu
On Fri, Aug 28, 2015 at 11:31 AM, Sean Fu wrote: > On Thu, Aug 27, 2015 at 4:32 PM, Sean Fu wrote: >> On Thu, Aug 27, 2015 at 10:32 AM, Steven Rostedt wrote: >>> On Thu, 27 Aug 2015 08:17:29 +0800 >>> Sean Fu wrote: strace execute result: write(3, "1\2\0", 3)= -1

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-09-07 Thread Sean Fu
On Fri, Aug 28, 2015 at 11:31 AM, Sean Fu wrote: > On Thu, Aug 27, 2015 at 4:32 PM, Sean Fu wrote: >> On Thu, Aug 27, 2015 at 10:32 AM, Steven Rostedt wrote: >>> On Thu, 27 Aug 2015 08:17:29 +0800 >>> Sean Fu

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-08-27 Thread Sean Fu
On Thu, Aug 27, 2015 at 4:32 PM, Sean Fu wrote: > On Thu, Aug 27, 2015 at 10:32 AM, Steven Rostedt wrote: >> On Thu, 27 Aug 2015 08:17:29 +0800 >> Sean Fu wrote: >> >>> On Thu, Aug 27, 2015 at 4:36 AM, Steven Rostedt wrote: >>> > On Wed, 26 Aug 2015 23:48:01 +0800 >>> > Sean Fu wrote: >>> >

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-08-27 Thread Sean Fu
On Thu, Aug 27, 2015 at 10:32 AM, Steven Rostedt wrote: > On Thu, 27 Aug 2015 08:17:29 +0800 > Sean Fu wrote: > >> On Thu, Aug 27, 2015 at 4:36 AM, Steven Rostedt wrote: >> > On Wed, 26 Aug 2015 23:48:01 +0800 >> > Sean Fu wrote: >> > >> > >> >> > Defending the patch, I can't imagine any user

Re: [PATCH] kernel/sysctl.c: If count including the terminating byte '\0' the write system call should retrun success.

2015-08-27 Thread Sean Fu
On Thu, Aug 27, 2015 at 4:32 PM, Sean Fu fxinr...@gmail.com wrote: On Thu, Aug 27, 2015 at 10:32 AM, Steven Rostedt rost...@goodmis.org wrote: On Thu, 27 Aug 2015 08:17:29 +0800 Sean Fu fxinr...@gmail.com wrote: On Thu, Aug 27, 2015 at 4:36 AM, Steven Rostedt rost...@goodmis.org wrote: On

Re: [PATCH] kernel/sysctl.c: If count including the terminating byte '\0' the write system call should retrun success.

2015-08-27 Thread Sean Fu
On Thu, Aug 27, 2015 at 10:32 AM, Steven Rostedt rost...@goodmis.org wrote: On Thu, 27 Aug 2015 08:17:29 +0800 Sean Fu fxinr...@gmail.com wrote: On Thu, Aug 27, 2015 at 4:36 AM, Steven Rostedt rost...@goodmis.org wrote: On Wed, 26 Aug 2015 23:48:01 +0800 Sean Fu fxinr...@gmail.com wrote:

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-08-26 Thread Steven Rostedt
On Thu, 27 Aug 2015 08:17:29 +0800 Sean Fu wrote: > On Thu, Aug 27, 2015 at 4:36 AM, Steven Rostedt wrote: > > On Wed, 26 Aug 2015 23:48:01 +0800 > > Sean Fu wrote: > > > > > >> > Defending the patch, I can't imagine any user space code expecting the > >> > current behavior. The current

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-08-26 Thread Sean Fu
On Wed, Aug 26, 2015 at 4:39 AM, Heinrich Schuchardt wrote: > > > On 24.08.2015 10:56, Sean Fu wrote: >> when the input argument "count" including the terminating byte "\0", >> The write system call return EINVAL on proc file. >> But it return success on regular file. >> >> E.g. Writting two

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-08-26 Thread Sean Fu
On Thu, Aug 27, 2015 at 4:36 AM, Steven Rostedt wrote: > On Wed, 26 Aug 2015 23:48:01 +0800 > Sean Fu wrote: > > >> > Defending the patch, I can't imagine any user space code expecting the >> > current behavior. The current behavior is that if you write "1\0" it >> > will error out instead of

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-08-26 Thread Steven Rostedt
On Wed, 26 Aug 2015 23:48:01 +0800 Sean Fu wrote: > > Defending the patch, I can't imagine any user space code expecting the > > current behavior. The current behavior is that if you write "1\0" it > > will error out instead of accepting the "1". I can't come up with a > > scenario that would

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-08-26 Thread Sean Fu
On Wed, Aug 26, 2015 at 3:05 AM, Steven Rostedt wrote: > On Tue, 25 Aug 2015 13:33:57 -0400 > Austin S Hemmelgarn wrote: > >> >> How do you know that? >> > I will prove that all other write usage is not impacted later. >> Except that you can only really do this for programs that you have >>

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-08-26 Thread Sean Fu
On Wed, Aug 26, 2015 at 4:39 AM, Heinrich Schuchardt wrote: > > > On 24.08.2015 10:56, Sean Fu wrote: >> when the input argument "count" including the terminating byte "\0", >> The write system call return EINVAL on proc file. >> But it return success on regular file. >> >> E.g. Writting two

Re: [PATCH] kernel/sysctl.c: If count including the terminating byte '\0' the write system call should retrun success.

2015-08-26 Thread Sean Fu
On Wed, Aug 26, 2015 at 3:05 AM, Steven Rostedt rost...@goodmis.org wrote: On Tue, 25 Aug 2015 13:33:57 -0400 Austin S Hemmelgarn ahferro...@gmail.com wrote: How do you know that? I will prove that all other write usage is not impacted later. Except that you can only really do this for

Re: [PATCH] kernel/sysctl.c: If count including the terminating byte '\0' the write system call should retrun success.

2015-08-26 Thread Steven Rostedt
On Wed, 26 Aug 2015 23:48:01 +0800 Sean Fu fxinr...@gmail.com wrote: Defending the patch, I can't imagine any user space code expecting the current behavior. The current behavior is that if you write 1\0 it will error out instead of accepting the 1. I can't come up with a scenario that

Re: [PATCH] kernel/sysctl.c: If count including the terminating byte '\0' the write system call should retrun success.

2015-08-26 Thread Sean Fu
On Wed, Aug 26, 2015 at 4:39 AM, Heinrich Schuchardt xypron.g...@gmx.de wrote: On 24.08.2015 10:56, Sean Fu wrote: when the input argument count including the terminating byte \0, The write system call return EINVAL on proc file. But it return success on regular file. E.g. Writting two

Re: [PATCH] kernel/sysctl.c: If count including the terminating byte '\0' the write system call should retrun success.

2015-08-26 Thread Sean Fu
On Wed, Aug 26, 2015 at 4:39 AM, Heinrich Schuchardt xypron.g...@gmx.de wrote: On 24.08.2015 10:56, Sean Fu wrote: when the input argument count including the terminating byte \0, The write system call return EINVAL on proc file. But it return success on regular file. E.g. Writting two

Re: [PATCH] kernel/sysctl.c: If count including the terminating byte '\0' the write system call should retrun success.

2015-08-26 Thread Sean Fu
On Thu, Aug 27, 2015 at 4:36 AM, Steven Rostedt rost...@goodmis.org wrote: On Wed, 26 Aug 2015 23:48:01 +0800 Sean Fu fxinr...@gmail.com wrote: Defending the patch, I can't imagine any user space code expecting the current behavior. The current behavior is that if you write 1\0 it will

Re: [PATCH] kernel/sysctl.c: If count including the terminating byte '\0' the write system call should retrun success.

2015-08-26 Thread Steven Rostedt
On Thu, 27 Aug 2015 08:17:29 +0800 Sean Fu fxinr...@gmail.com wrote: On Thu, Aug 27, 2015 at 4:36 AM, Steven Rostedt rost...@goodmis.org wrote: On Wed, 26 Aug 2015 23:48:01 +0800 Sean Fu fxinr...@gmail.com wrote: Defending the patch, I can't imagine any user space code expecting the

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-08-25 Thread Heinrich Schuchardt
On 24.08.2015 10:56, Sean Fu wrote: > when the input argument "count" including the terminating byte "\0", > The write system call return EINVAL on proc file. > But it return success on regular file. > > E.g. Writting two bytes ("1\0") to "/proc/sys/net/ipv4/conf/eth0/rp_filter". > write(fd,

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-08-25 Thread Steven Rostedt
On Tue, 25 Aug 2015 13:33:57 -0400 Austin S Hemmelgarn wrote: > >> How do you know that? > > I will prove that all other write usage is not impacted later. > Except that you can only really do this for programs that you have > access to, and by definition you can not have access to every

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-08-25 Thread Austin S Hemmelgarn
On 2015-08-25 12:44, Sean Fu wrote: On Tue, Aug 25, 2015 at 10:15 PM, Steven Rostedt wrote: On Tue, 25 Aug 2015 15:50:18 +0800 Sean Fu wrote: On Tue, Aug 25, 2015 at 10:24 AM, Eric W. Biederman wrote: On August 24, 2015 6:57:57 PM MDT, Sean Fu wrote: An application from HuaWei which

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-08-25 Thread Sean Fu
On Tue, Aug 25, 2015 at 10:15 PM, Steven Rostedt wrote: > On Tue, 25 Aug 2015 15:50:18 +0800 > Sean Fu wrote: > >> On Tue, Aug 25, 2015 at 10:24 AM, Eric W. Biederman >> wrote: >> > >> > >> > On August 24, 2015 6:57:57 PM MDT, Sean Fu wrote: >> >>An application from HuaWei which works fine on

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-08-25 Thread Steven Rostedt
On Tue, 25 Aug 2015 15:50:18 +0800 Sean Fu wrote: > On Tue, Aug 25, 2015 at 10:24 AM, Eric W. Biederman > wrote: > > > > > > On August 24, 2015 6:57:57 PM MDT, Sean Fu wrote: > >>An application from HuaWei which works fine on 2.6 encounters this > >>issue on 3.0 or later kernel. > > > > My

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-08-25 Thread Sean Fu
On Tue, Aug 25, 2015 at 10:24 AM, Eric W. Biederman wrote: > > > On August 24, 2015 6:57:57 PM MDT, Sean Fu wrote: >>An application from HuaWei which works fine on 2.6 encounters this >>issue on 3.0 or later kernel. > > My sympathies. Being stuck with a 3rd party application you can barely talk

Re: [PATCH] kernel/sysctl.c: If count including the terminating byte '\0' the write system call should retrun success.

2015-08-25 Thread Austin S Hemmelgarn
On 2015-08-25 12:44, Sean Fu wrote: On Tue, Aug 25, 2015 at 10:15 PM, Steven Rostedt rost...@goodmis.org wrote: On Tue, 25 Aug 2015 15:50:18 +0800 Sean Fu fxinr...@gmail.com wrote: On Tue, Aug 25, 2015 at 10:24 AM, Eric W. Biederman ebied...@xmission.com wrote: On August 24, 2015 6:57:57

Re: [PATCH] kernel/sysctl.c: If count including the terminating byte '\0' the write system call should retrun success.

2015-08-25 Thread Sean Fu
On Tue, Aug 25, 2015 at 10:15 PM, Steven Rostedt rost...@goodmis.org wrote: On Tue, 25 Aug 2015 15:50:18 +0800 Sean Fu fxinr...@gmail.com wrote: On Tue, Aug 25, 2015 at 10:24 AM, Eric W. Biederman ebied...@xmission.com wrote: On August 24, 2015 6:57:57 PM MDT, Sean Fu fxinr...@gmail.com

Re: [PATCH] kernel/sysctl.c: If count including the terminating byte '\0' the write system call should retrun success.

2015-08-25 Thread Steven Rostedt
On Tue, 25 Aug 2015 15:50:18 +0800 Sean Fu fxinr...@gmail.com wrote: On Tue, Aug 25, 2015 at 10:24 AM, Eric W. Biederman ebied...@xmission.com wrote: On August 24, 2015 6:57:57 PM MDT, Sean Fu fxinr...@gmail.com wrote: An application from HuaWei which works fine on 2.6 encounters this

Re: [PATCH] kernel/sysctl.c: If count including the terminating byte '\0' the write system call should retrun success.

2015-08-25 Thread Sean Fu
On Tue, Aug 25, 2015 at 10:24 AM, Eric W. Biederman ebied...@xmission.com wrote: On August 24, 2015 6:57:57 PM MDT, Sean Fu fxinr...@gmail.com wrote: An application from HuaWei which works fine on 2.6 encounters this issue on 3.0 or later kernel. My sympathies. Being stuck with a 3rd party

Re: [PATCH] kernel/sysctl.c: If count including the terminating byte '\0' the write system call should retrun success.

2015-08-25 Thread Steven Rostedt
On Tue, 25 Aug 2015 13:33:57 -0400 Austin S Hemmelgarn ahferro...@gmail.com wrote: How do you know that? I will prove that all other write usage is not impacted later. Except that you can only really do this for programs that you have access to, and by definition you can not have access to

Re: [PATCH] kernel/sysctl.c: If count including the terminating byte '\0' the write system call should retrun success.

2015-08-25 Thread Heinrich Schuchardt
On 24.08.2015 10:56, Sean Fu wrote: when the input argument count including the terminating byte \0, The write system call return EINVAL on proc file. But it return success on regular file. E.g. Writting two bytes (1\0) to /proc/sys/net/ipv4/conf/eth0/rp_filter. write(fd, 1\0, 2) return

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-08-24 Thread Sean Fu
Call path is "proc_dointvec-->do_proc_dointvec-->__do_proc_dointvec-->proc_get_long". file: kernel/sysctl.c function: proc_get_long ... 1927 if (len < *size && perm_tr_len && !memchr(perm_tr, *p, perm_tr_len)) //this line should accept two bytes "1\0". 1928

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-08-24 Thread Eric W. Biederman
On August 24, 2015 6:57:57 PM MDT, Sean Fu wrote: >An application from HuaWei which works fine on 2.6 encounters this >issue on 3.0 or later kernel. My sympathies. Being stuck with a 3rd party application you can barely talk about that has been broken for 5years and no one reported it.

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-08-24 Thread Sean Fu
An application from HuaWei which works fine on 2.6 encounters this issue on 3.0 or later kernel. Test code: #include #include #include #include #include #include #include #define MAXLEN (100) int main(int argc, char** argv) { int fd = 0; int len = 0; char

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-08-24 Thread Heinrich Schuchardt
This seems to be the relevant patch: https://lkml.org/lkml/2010/5/5/104 Amerigo Wang 2010-05-05 02:26:45 00b7c3395aec3df43de5bd02a3c5a099ca51169f +static const char proc_wspace_sep[] = { ' ', '\t', '\n' }; So since 2010 we have the current behavior. Best regards Heinrich Schuchardt On

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-08-24 Thread Andrew Morton
On Mon, 24 Aug 2015 23:33:58 +0800 Sean Fu wrote: > On Mon, Aug 24, 2015 at 8:27 PM, Eric W. Biederman > wrote: > > > > > > On August 24, 2015 1:56:13 AM PDT, Sean Fu wrote: > >>when the input argument "count" including the terminating byte "\0", > >>The write system call return EINVAL on proc

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-08-24 Thread Steven Rostedt
On Mon, 24 Aug 2015 16:56:13 +0800 Sean Fu wrote: > when the input argument "count" including the terminating byte "\0", > The write system call return EINVAL on proc file. > But it return success on regular file. > > E.g. Writting two bytes ("1\0") to "/proc/sys/net/ipv4/conf/eth0/rp_filter".

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-08-24 Thread Sean Fu
On Mon, Aug 24, 2015 at 8:27 PM, Eric W. Biederman wrote: > > > On August 24, 2015 1:56:13 AM PDT, Sean Fu wrote: >>when the input argument "count" including the terminating byte "\0", >>The write system call return EINVAL on proc file. >>But it return success on regular file. > > Nonsense. It

Re: [PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-08-24 Thread Eric W. Biederman
On August 24, 2015 1:56:13 AM PDT, Sean Fu wrote: >when the input argument "count" including the terminating byte "\0", >The write system call return EINVAL on proc file. >But it return success on regular file. Nonsense. It will write the '\0' to a regular file because it is just data.

[PATCH] kernel/sysctl.c: If "count" including the terminating byte '\0' the write system call should retrun success.

2015-08-24 Thread Sean Fu
when the input argument "count" including the terminating byte "\0", The write system call return EINVAL on proc file. But it return success on regular file. E.g. Writting two bytes ("1\0") to "/proc/sys/net/ipv4/conf/eth0/rp_filter". write(fd, "1\0", 2) return EINVAL. Signed-off-by: Sean Fu

Re: [PATCH] kernel/sysctl.c: If count including the terminating byte '\0' the write system call should retrun success.

2015-08-24 Thread Eric W. Biederman
On August 24, 2015 1:56:13 AM PDT, Sean Fu fxinr...@gmail.com wrote: when the input argument count including the terminating byte \0, The write system call return EINVAL on proc file. But it return success on regular file. Nonsense. It will write the '\0' to a regular file because it is just

Re: [PATCH] kernel/sysctl.c: If count including the terminating byte '\0' the write system call should retrun success.

2015-08-24 Thread Sean Fu
On Mon, Aug 24, 2015 at 8:27 PM, Eric W. Biederman ebied...@xmission.com wrote: On August 24, 2015 1:56:13 AM PDT, Sean Fu fxinr...@gmail.com wrote: when the input argument count including the terminating byte \0, The write system call return EINVAL on proc file. But it return success on

Re: [PATCH] kernel/sysctl.c: If count including the terminating byte '\0' the write system call should retrun success.

2015-08-24 Thread Steven Rostedt
On Mon, 24 Aug 2015 16:56:13 +0800 Sean Fu fxinr...@gmail.com wrote: when the input argument count including the terminating byte \0, The write system call return EINVAL on proc file. But it return success on regular file. E.g. Writting two bytes (1\0) to

[PATCH] kernel/sysctl.c: If count including the terminating byte '\0' the write system call should retrun success.

2015-08-24 Thread Sean Fu
when the input argument count including the terminating byte \0, The write system call return EINVAL on proc file. But it return success on regular file. E.g. Writting two bytes (1\0) to /proc/sys/net/ipv4/conf/eth0/rp_filter. write(fd, 1\0, 2) return EINVAL. Signed-off-by: Sean Fu

Re: [PATCH] kernel/sysctl.c: If count including the terminating byte '\0' the write system call should retrun success.

2015-08-24 Thread Andrew Morton
On Mon, 24 Aug 2015 23:33:58 +0800 Sean Fu fxinr...@gmail.com wrote: On Mon, Aug 24, 2015 at 8:27 PM, Eric W. Biederman ebied...@xmission.com wrote: On August 24, 2015 1:56:13 AM PDT, Sean Fu fxinr...@gmail.com wrote: when the input argument count including the terminating byte \0, The

Re: [PATCH] kernel/sysctl.c: If count including the terminating byte '\0' the write system call should retrun success.

2015-08-24 Thread Heinrich Schuchardt
This seems to be the relevant patch: https://lkml.org/lkml/2010/5/5/104 Amerigo Wang amw...@redhat.com 2010-05-05 02:26:45 00b7c3395aec3df43de5bd02a3c5a099ca51169f +static const char proc_wspace_sep[] = { ' ', '\t', '\n' }; So since 2010 we have the current behavior. Best regards Heinrich

Re: [PATCH] kernel/sysctl.c: If count including the terminating byte '\0' the write system call should retrun success.

2015-08-24 Thread Sean Fu
An application from HuaWei which works fine on 2.6 encounters this issue on 3.0 or later kernel. Test code: #include sys/types.h #include sys/stat.h #include fcntl.h #include unistd.h #include stdio.h #include string.h #include errno.h #define MAXLEN (100) int main(int argc, char** argv) {

Re: [PATCH] kernel/sysctl.c: If count including the terminating byte '\0' the write system call should retrun success.

2015-08-24 Thread Eric W. Biederman
On August 24, 2015 6:57:57 PM MDT, Sean Fu fxinr...@gmail.com wrote: An application from HuaWei which works fine on 2.6 encounters this issue on 3.0 or later kernel. My sympathies. Being stuck with a 3rd party application you can barely talk about that has been broken for 5years and no one

Re: [PATCH] kernel/sysctl.c: If count including the terminating byte '\0' the write system call should retrun success.

2015-08-24 Thread Sean Fu
Call path is proc_dointvec--do_proc_dointvec--__do_proc_dointvec--proc_get_long. file: kernel/sysctl.c function: proc_get_long ... 1927 if (len *size perm_tr_len !memchr(perm_tr, *p, perm_tr_len)) //this line should accept two bytes 1\0. 1928 return