Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: jeremie.galarneau@efficios.com (Jérémie Galarneau)
Subject: [lttng-dev] lttng list -u return "Error: Command error"
Date: Wed, 24 Jun 2015 00:03:12 +0200	[thread overview]
Message-ID: <CA+jJMxv_NK10R_hovxLYk4i3pZDQhsWivgyS_q3k_+dN6XXJyg@mail.gmail.com> (raw)
In-Reply-To: <---.GY------rzHGY$b39120f9-2664-4e5c-bb89-379e7494cb0d@aliyun.com>

On Thu, Jun 4, 2015 at 5:00 AM, zhenyu.ren <zhenyu.ren at aliyun.com> wrote:

> Hi,dev-team
>
>    As the subject is my problem. It seems that the function
> get_cmdline_by_pid() will fail if kernel.pid_max > 100000 (i.e. 131072)
>
> static char *get_cmdline_by_pid(pid_t pid)
> {
>         int ret;
>         FILE *fp = NULL;
>         char *cmdline = NULL;
>         char path[20];        /* Can't go bigger than /proc/65535/cmdline
> */
>
>
>  I think path[20] is not big enough .Do you have any better idea?
>

Good catch! Sorry for the delay, traveling has caused me to fall behind on
e-mails... Catching up!

Based on PROC(5):

       /proc/sys/kernel/pid_max (since Linux 2.5.34)
              This  file  specifies the value at which PIDs wrap around
              (i.e., the value in this file is  one  greater  than  the
              maximum PID).  PIDs greater than this value are not allo?
              cated; thus, the value in this file also acts as  a  sys?
              tem-wide  limit  on  the  total  number  of processes and
              threads.  The default value for this file, 32768, results
              in  the  same  range  of  PIDs as on earlier kernels.  On
              32-bit platforms, 32768 is the maximum value for pid_max.
              On  64-bit systems, pid_max can be set to any value up to
              2^22 (PID_MAX_LIMIT, approximately 4 million).

I have introduced a fix in master, stable-2.6 and stable-2.5.

commit fae9a062a468c47fc71ef7aa96374bf9d87d137e
Author: J?r?mie Galarneau <jeremie.galarneau at efficios.com>
Date:   Tue Jun 23 23:27:31 2015 +0200

    Fix: get_cmdline_by_pid path length assumes a max pid of 65535

    PROC(5) mentions that "On 64-bit systems, pid_max can be set to any
    value up to 2^22 (PID_MAX_LIMIT, approximately 4 million)."

    We use 32 bits for simplicity's sake.

    Reported-by: Zhenyu Ren <zhenyu.ren at aliyun.com>
    Signed-off-by: J?r?mie Galarneau <jeremie.galarneau at efficios.com>


Thanks!
J?r?mie



>
> Thanks
> zhenyu.ren
>
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
>



-- 
J?r?mie Galarneau
EfficiOS Inc.
http://www.efficios.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20150624/92e197ff/attachment.html>


      reply	other threads:[~2015-06-23 22:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-04  3:00 zhenyu.ren
2015-06-23 22:03 ` Jérémie Galarneau [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+jJMxv_NK10R_hovxLYk4i3pZDQhsWivgyS_q3k_+dN6XXJyg@mail.gmail.com \
    --to=jeremie.galarneau@efficios.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox