Re: Change proc/<pid>/cmdline to 8k

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 5, 2015 at 8:51 AM, Navin P <navinp1912@xxxxxxxxx> wrote:
> On Fri, Jun 5, 2015 at 3:49 AM,  <Valdis.Kletnieks@xxxxxx> wrote:

After all your perseverance , i have got what i wanted with 4 lines
change on linux-4.0 fc22 :)
I just made the proc cmdlines buffer size to a max of 100*4k. I hit
the execve limit E2BIG when i had lot more more than 128000 but then i
stopped beyond that.

diff --git a/linux-4.0_orig/fs/proc/base.c b/linux-4.0/fs/proc/base.c
index 3f3d7ae..06f19ee 100644
--- a/linux-4.0_orig/fs/proc/base.c
+++ b/linux-4.0/fs/proc/base.c
@@ -204,7 +204,7 @@ static int proc_pid_cmdline(struct seq_file *m,
struct pid_namespace *ns,
  * per internal buffer allocation. See single_open(), traverse().
  */
  BUG_ON(m->size < PAGE_SIZE);
- m->count += get_cmdline(task, m->buf, PAGE_SIZE);
+ m->count += get_cmdline(task, m->buf, 100*PAGE_SIZE);
  return 0;
 }

@@ -2166,7 +2166,7 @@ static ssize_t proc_pid_attr_write(struct file *
file, const char __user * buf,
  if (!task)
  goto out_no_task;
  if (count > PAGE_SIZE)
- count = PAGE_SIZE;
+ count = 100*PAGE_SIZE;

  /* No partial writes. */
  length = -EINVAL;
diff --git a/linux-4.0_orig/fs/seq_file.c b/linux-4.0/fs/seq_file.c
index 555f821..047d13e 100644
--- a/linux-4.0_orig/fs/seq_file.c
+++ b/linux-4.0/fs/seq_file.c
@@ -101,7 +101,7 @@ static int traverse(struct seq_file *m, loff_t offset)
  return 0;
  }
  if (!m->buf) {
- m->buf = seq_buf_alloc(m->size = PAGE_SIZE);
+ m->buf = seq_buf_alloc(m->size = (100*PAGE_SIZE));
  if (!m->buf)
  return -ENOMEM;
  }
@@ -197,7 +197,7 @@ ssize_t seq_read(struct file *file, char __user
*buf, size_t size, loff_t *ppos)

  /* grab buffer if we didn't have one */
  if (!m->buf) {
- m->buf = seq_buf_alloc(m->size = PAGE_SIZE);
+ m->buf = seq_buf_alloc(m->size = (100*PAGE_SIZE));
  if (!m->buf)
  goto Enomem;
  }


Thanks.

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux