Re: [PATCH -mm] Don't truncate /proc/PID/environ at 4096 characters

2007-09-25 Thread James Pearson
James Pearson wrote: > Arvin Moezzi wrote: > >> I think that's not true. 'count' is changing through the iteration. >> The difference in the mem_read(): >> >> * while (count > 0) { >> * int this_len, retval; >> * >> * this_len = (count > PAGE_SIZE) ? PAGE_SIZE : count; >> * retval =

Re: [PATCH -mm] Don't truncate /proc/PID/environ at 4096 characters

2007-09-25 Thread James Pearson
James Pearson wrote: Arvin Moezzi wrote: I think that's not true. 'count' is changing through the iteration. The difference in the mem_read(): * while (count 0) { * int this_len, retval; * * this_len = (count PAGE_SIZE) ? PAGE_SIZE : count; * retval =

Re: [PATCH -mm] Don't truncate /proc/PID/environ at 4096 characters

2007-09-21 Thread James Pearson
Arvin Moezzi wrote: I think that's not true. 'count' is changing through the iteration. The difference in the mem_read(): * while (count > 0) { * int this_len, retval; * * this_len = (count > PAGE_SIZE) ? PAGE_SIZE : count; * retval = access_process_vm(task, src, page, this_len,

Re: [PATCH -mm] Don't truncate /proc/PID/environ at 4096 characters

2007-09-21 Thread Arvin Moezzi
> >>+ > >>+ if (copy_to_user(buf, page, retval)) { > > > > > > shouldn't you only copy min(count,retval) bytes? otherwise you could > > write beyond the users buffer "buf", right? > > AFAIK, 'retval' can never be

Re: [PATCH -mm] Don't truncate /proc/PID/environ at 4096 characters

2007-09-21 Thread Mel Gorman
On (20/09/07 16:46), Andrew Morton didst pronounce: > On Wed, 19 Sep 2007 14:35:29 +0100 > "James Pearson" <[EMAIL PROTECTED]> wrote: > > > > > From: James Pearson <[EMAIL PROTECTED]> > > > > /proc/PID/environ currently truncates at 4096 characters, patch based on > > the /proc/PID/mem code. >

Re: [PATCH -mm] Don't truncate /proc/PID/environ at 4096 characters

2007-09-21 Thread James Pearson
Arvin Moezzi wrote: 2007/9/19, James Pearson <[EMAIL PROTECTED]>: + while (count > 0) { + int this_len, retval; + + this_len = mm->env_end - (mm->env_start + src); + + if (this_len <= 0) + break; + + if

Re: [PATCH -mm] Don't truncate /proc/PID/environ at 4096 characters

2007-09-21 Thread James Pearson
Andrew Morton wrote: On Wed, 19 Sep 2007 14:35:29 +0100 "James Pearson" <[EMAIL PROTECTED]> wrote: From: James Pearson <[EMAIL PROTECTED]> /proc/PID/environ currently truncates at 4096 characters, patch based on the /proc/PID/mem code. patch needs to be carefully reviewed from the

Re: [PATCH -mm] Don't truncate /proc/PID/environ at 4096 characters

2007-09-21 Thread James Pearson
Arvin Moezzi wrote: 2007/9/19, James Pearson [EMAIL PROTECTED]: + while (count 0) { + int this_len, retval; + + this_len = mm-env_end - (mm-env_start + src); + + if (this_len = 0) + break; + + if (this_len

Re: [PATCH -mm] Don't truncate /proc/PID/environ at 4096 characters

2007-09-21 Thread James Pearson
Andrew Morton wrote: On Wed, 19 Sep 2007 14:35:29 +0100 James Pearson [EMAIL PROTECTED] wrote: From: James Pearson [EMAIL PROTECTED] /proc/PID/environ currently truncates at 4096 characters, patch based on the /proc/PID/mem code. patch needs to be carefully reviewed from the security POV

Re: [PATCH -mm] Don't truncate /proc/PID/environ at 4096 characters

2007-09-21 Thread Mel Gorman
On (20/09/07 16:46), Andrew Morton didst pronounce: On Wed, 19 Sep 2007 14:35:29 +0100 James Pearson [EMAIL PROTECTED] wrote: From: James Pearson [EMAIL PROTECTED] /proc/PID/environ currently truncates at 4096 characters, patch based on the /proc/PID/mem code. patch needs to be

Re: [PATCH -mm] Don't truncate /proc/PID/environ at 4096 characters

2007-09-21 Thread Arvin Moezzi
+ + if (copy_to_user(buf, page, retval)) { shouldn't you only copy min(count,retval) bytes? otherwise you could write beyond the users buffer buf, right? AFAIK, 'retval' can never be greater than

Re: [PATCH -mm] Don't truncate /proc/PID/environ at 4096 characters

2007-09-21 Thread James Pearson
Arvin Moezzi wrote: I think that's not true. 'count' is changing through the iteration. The difference in the mem_read(): * while (count 0) { * int this_len, retval; * * this_len = (count PAGE_SIZE) ? PAGE_SIZE : count; * retval = access_process_vm(task, src, page, this_len,

Re: [PATCH -mm] Don't truncate /proc/PID/environ at 4096 characters

2007-09-20 Thread Arvin Moezzi
2007/9/19, James Pearson <[EMAIL PROTECTED]>: > + while (count > 0) { > + int this_len, retval; > + > + this_len = mm->env_end - (mm->env_start + src); > + > + if (this_len <= 0) > + break; > + > + if (this_len >

Re: [PATCH -mm] Don't truncate /proc/PID/environ at 4096 characters

2007-09-20 Thread Andrew Morton
On Wed, 19 Sep 2007 14:35:29 +0100 "James Pearson" <[EMAIL PROTECTED]> wrote: > > From: James Pearson <[EMAIL PROTECTED]> > > /proc/PID/environ currently truncates at 4096 characters, patch based on > the /proc/PID/mem code. patch needs to be carefully reviewed from the security POV (ie:

Re: [PATCH -mm] Don't truncate /proc/PID/environ at 4096 characters

2007-09-20 Thread Andrew Morton
On Wed, 19 Sep 2007 14:35:29 +0100 James Pearson [EMAIL PROTECTED] wrote: From: James Pearson [EMAIL PROTECTED] /proc/PID/environ currently truncates at 4096 characters, patch based on the /proc/PID/mem code. patch needs to be carefully reviewed from the security POV (ie: permissions) as

Re: [PATCH -mm] Don't truncate /proc/PID/environ at 4096 characters

2007-09-20 Thread Arvin Moezzi
2007/9/19, James Pearson [EMAIL PROTECTED]: + while (count 0) { + int this_len, retval; + + this_len = mm-env_end - (mm-env_start + src); + + if (this_len = 0) + break; + + if (this_len max_len) +

Re: [PATCH -mm] Don't truncate /proc/PID/environ at 4096 characters

2007-09-19 Thread Hugh Dickins
On Wed, 19 Sep 2007, Mikael Pettersson wrote: > H. Peter Anvin writes: > > Mikael Pettersson wrote: > > > Does /proc/PID/mem even work? If I do `strace cat /proc/PID/mem > > /dev/null' > > > for a known good PID, the first read() from /proc/PID/mem fails with > ESRCH, > > > > Of course it

Re: [PATCH -mm] Don't truncate /proc/PID/environ at 4096 characters

2007-09-19 Thread Mikael Pettersson
H. Peter Anvin writes: > Mikael Pettersson wrote: > > On Wed, 19 Sep 2007 14:35:29 +0100, James Pearson wrote: > >> /proc/PID/environ currently truncates at 4096 characters, patch based on > >> the /proc/PID/mem code. > > > > Does /proc/PID/mem even work? If I do `strace cat /proc/PID/mem

Re: [PATCH -mm] Don't truncate /proc/PID/environ at 4096 characters

2007-09-19 Thread H. Peter Anvin
Mikael Pettersson wrote: > On Wed, 19 Sep 2007 14:35:29 +0100, James Pearson wrote: >> /proc/PID/environ currently truncates at 4096 characters, patch based on >> the /proc/PID/mem code. > > Does /proc/PID/mem even work? If I do `strace cat /proc/PID/mem > /dev/null' > for a known good PID, the

Re: [PATCH -mm] Don't truncate /proc/PID/environ at 4096 characters

2007-09-19 Thread Mikael Pettersson
On Wed, 19 Sep 2007 14:35:29 +0100, James Pearson wrote: > /proc/PID/environ currently truncates at 4096 characters, patch based on > the /proc/PID/mem code. Does /proc/PID/mem even work? If I do `strace cat /proc/PID/mem > /dev/null' for a known good PID, the first read() from /proc/PID/mem

[PATCH -mm] Don't truncate /proc/PID/environ at 4096 characters

2007-09-19 Thread James Pearson
From: James Pearson <[EMAIL PROTECTED]> /proc/PID/environ currently truncates at 4096 characters, patch based on the /proc/PID/mem code. Signed-off-by: James Pearson <[EMAIL PROTECTED]> --- Patch against 2.6.23-rc6-mm1 --- ./fs/proc/base.c.dist 2007-09-19 12:29:46.244929651 +0100 +++

[PATCH -mm] Don't truncate /proc/PID/environ at 4096 characters

2007-09-19 Thread James Pearson
From: James Pearson [EMAIL PROTECTED] /proc/PID/environ currently truncates at 4096 characters, patch based on the /proc/PID/mem code. Signed-off-by: James Pearson [EMAIL PROTECTED] --- Patch against 2.6.23-rc6-mm1 --- ./fs/proc/base.c.dist 2007-09-19 12:29:46.244929651 +0100 +++

Re: [PATCH -mm] Don't truncate /proc/PID/environ at 4096 characters

2007-09-19 Thread Mikael Pettersson
On Wed, 19 Sep 2007 14:35:29 +0100, James Pearson wrote: /proc/PID/environ currently truncates at 4096 characters, patch based on the /proc/PID/mem code. Does /proc/PID/mem even work? If I do `strace cat /proc/PID/mem /dev/null' for a known good PID, the first read() from /proc/PID/mem fails

Re: [PATCH -mm] Don't truncate /proc/PID/environ at 4096 characters

2007-09-19 Thread H. Peter Anvin
Mikael Pettersson wrote: On Wed, 19 Sep 2007 14:35:29 +0100, James Pearson wrote: /proc/PID/environ currently truncates at 4096 characters, patch based on the /proc/PID/mem code. Does /proc/PID/mem even work? If I do `strace cat /proc/PID/mem /dev/null' for a known good PID, the first

Re: [PATCH -mm] Don't truncate /proc/PID/environ at 4096 characters

2007-09-19 Thread Mikael Pettersson
H. Peter Anvin writes: Mikael Pettersson wrote: On Wed, 19 Sep 2007 14:35:29 +0100, James Pearson wrote: /proc/PID/environ currently truncates at 4096 characters, patch based on the /proc/PID/mem code. Does /proc/PID/mem even work? If I do `strace cat /proc/PID/mem

Re: [PATCH -mm] Don't truncate /proc/PID/environ at 4096 characters

2007-09-19 Thread Hugh Dickins
On Wed, 19 Sep 2007, Mikael Pettersson wrote: H. Peter Anvin writes: Mikael Pettersson wrote: Does /proc/PID/mem even work? If I do `strace cat /proc/PID/mem /dev/null' for a known good PID, the first read() from /proc/PID/mem fails with ESRCH, Of course it does. Address