mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Subject: Re: sabotage linux X86_64 image with LXDE desktop released
Date: Sat, 21 Jul 2012 19:05:23 -0400	[thread overview]
Message-ID: <20120721230522.GC544@brightrain.aerifal.cx> (raw)
In-Reply-To: <500B3703.5030607@barfooze.de>

On Sun, Jul 22, 2012 at 01:10:59AM +0200, John Spencer wrote:
> >>here is a screenshot: http://i.imgur.com/Lz7Ov.png
> >Something seems very wrong with those task manager vm sizes...
> >Is this indicative of a bug on musl's side?
> 
> here's what it's doing (note that PAGE_SIZE was originally an
> external variable which got once filled with sc_sysconf values,
> i needed to patch it away because of the conflict with the macro of
> the same name)

That shouldn't break anything..

> void get_task_details(gint pid,struct task *task)
> {
>         task->size=0;
> 
>         sprintf(line,"/proc/%d/statm",pid);
>         fd=open(line,O_RDONLY);
>         if(fd==-1) return;
>         read(fd,line,256);
>         sscanf(line,"%d %d",&task->size,&task->rss);
>         close(fd);
>         if(!task->size) return;
>         task->size*=PAGE_SIZE;
>         task->rss*=PAGE_SIZE;
> 
> struct task
> {
> // ...
>     gint size;
>     gint rss;
> };

gint is not large enough to store memory sizes on 64-bit machines
(though I doubt you're overflowing it here...) and %d may not be the
right scanf conversion for gint unless gint is defined as int...

Otherwise, I don't see what's wrong...

Rich


  reply	other threads:[~2012-07-21 23:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-21 20:59 John Spencer
2012-07-21 20:50 ` Rich Felker
2012-07-21 23:10   ` John Spencer
2012-07-21 23:05     ` Rich Felker [this message]
2012-07-21 23:50       ` John Spencer
2012-07-22  9:32 ` Daniel Cegiełka
2012-08-07 23:06 ` Roy
2012-08-07 23:29   ` John Spencer

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=20120721230522.GC544@brightrain.aerifal.cx \
    --to=dalias@aerifal.cx \
    --cc=musl@lists.openwall.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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).