Kernel Newbies archive mirror
 help / color / mirror / Atom feed
From: Jeffrey Walton <noloader@gmail.com>
To: "Rahul Gore (Nokia)" <rahul.gore@nokia.com>
Cc: "kernelnewbies@kernelnewbies.org" <kernelnewbies@kernelnewbies.org>
Subject: Re: Calculating private and shared memory for processes
Date: Mon, 13 Feb 2023 22:09:36 -0500	[thread overview]
Message-ID: <CAH8yC8=g9zHzDQihJZaq3vp0xDvC_pB5D8RdEZFaPhebiqdqQQ@mail.gmail.com> (raw)
In-Reply-To: <DM5PR0801MB37831E73B79C39E1B1BF0C5C84DE9@DM5PR0801MB3783.namprd08.prod.outlook.com>

On Fri, Feb 10, 2023 at 5:43 PM Rahul Gore (Nokia) <rahul.gore@nokia.com> wrote:
>
> I’m trying to find private and shared memory usage of each process in Linux. ...

Application should _not_ share memory across processes. That's a
security vulnerability. One app could corrupt memory, and cause
unpredictable results in another process.

You can check for processes which share memory by looking for the
GNU_SHARED section attribute in a [on-disk] program. There should be
no shared sections.

Tobias Klein's checksec may show programs which have GNU_SHARED . If
checksec does not check for it, then `readelf -l <program> | grep
GNU_SHARED` should reveal it.

I'm guessing private memory usage is an easier problem. Profiling
tools probably provide it. Tools like 'perf mem' and Valgrind provide
the information.

Jeff

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

      parent reply	other threads:[~2023-02-14  3:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-10 22:42 Calculating private and shared memory for processes Rahul Gore (Nokia)
2023-02-13 23:56 ` Rahul Gore (Nokia)
2023-02-14  3:09 ` Jeffrey Walton [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='CAH8yC8=g9zHzDQihJZaq3vp0xDvC_pB5D8RdEZFaPhebiqdqQQ@mail.gmail.com' \
    --to=noloader@gmail.com \
    --cc=kernelnewbies@kernelnewbies.org \
    --cc=rahul.gore@nokia.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).