2010-10-11 13:58:54     mmap MAP_UNINITIALIZED

Document created by Aaronwu Employee on Aug 23, 2013
Version 1Show Document
  • View in full screen mode

2010-10-11 13:58:54     mmap MAP_UNINITIALIZED

Rob Maris (GERMANY)

Message: 94410   

 

With CONFIG_MMAP_ALLOW_UNINITIALIZED=y, I encounter undesired quits when running mpg321 in remote mode, but only when a http stream is read. The quits occur when in this mode p (pause) or q (quit) are entered. in both cases an abnormal text "BUS" appears just before the shell prompt occurs.

 

I'm wondering about this, because the mmap calls within mpg321 do not use the MAP_UNINITIALIZE flag at all. Therefore I did some analysis, e.g. through the help of a temporary printk in front of the appropriate section in nommu.c. Example log:

 

/ # mpg321 -R --skip-printing-frames=1000 -

 

mmap flags 00001802

mmap flags 00001802

mmap flags 00000802

mmap flags 00000122

mmap flags 04000022

mmap flags 00000002

mmap flags 04000022

mmap flags 00000002

...

mmap flags 04000021

mmap flags 04000021

mmap flags 04000021

mmap flags 04000021

mmap flags 00000001

mmap flags 00000001

mmap flags 00000001@R MPG123

 

 

 

Apparently, many mmap calls below the application level (with allowed uninitialization) occur. The question: how should the crucial call stack be found where the problem becomes apparent and results in described "unpredictable" behaviour?

 

(Note: low prio posting)

QuoteReplyEditDelete

 

 

2010-10-11 14:13:56     Re: mmap MAP_UNINITIALIZED

Mike Frysinger (UNITED STATES)

Message: 94411   

 

the C library's malloc() takes care of using MAP_UNINITIALIZE.  if you're seeing misbehavior, then mpg321 is probably wrongly using uninitialized memory.

QuoteReplyEditDelete

 

 

2010-10-11 14:43:44     Re: mmap MAP_UNINITIALIZED

Mike Frysinger (UNITED STATES)

Message: 94412   

 

it'll probably be faster to try debugging on your host then

 

glibc has a MALLOC_PERTURB_ env var which lets you do the same thing -- seed the allocated region with non-zero values

QuoteReplyEditDelete

 

 

2010-10-11 15:17:09     Re: mmap MAP_UNINITIALIZED

Rob Maris (GERMANY)

Message: 94413   

 

Thanks, also for the latter (host) hint. I'll ask Chris if he can do some debugging effort.

 

Regarding malloc(): I was aware about the relationship, but didn't get the link to the idea that every standard malloc call effectively hits mmap - yes, it is documented... So for test, I have replaced several mallocs by callocs where it was not immediately clear whether zero init was requested or not. It didn't help. Probably there is a false uninitialized malloc with the network resources, since the problem does not occur when a plain file is played.

QuoteReplyEditDelete

Attachments

    Outcomes