Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120721230522.GC544@brightrain.aerifal.cx>
Date: Sat, 21 Jul 2012 19:05:23 -0400
From: Rich Felker <dalias@...ifal.cx>
To: musl@...ts.openwall.com
Subject: Re: sabotage linux X86_64 image with LXDE desktop released

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

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.