Shutting down fds prior to execvpe in rainbow/inject.py: joyride 247 under Qemu

2007-11-06 Thread Marcus Leech
Michael et al:

I just uploaded the EXT3 image for Joyride 247, and it seems to mostly work.

I experimentally put some code just before the execvpe() in inject.py to
close FDs >= 3 and <= 10.  I picked 10 out of the
  air, but I wouldn't expect there to be many open file descriptors at
that point.  Actually, given the semantics of dup(),
  you could use it to probe what the maximum FD number is just before
execvpe(), so the terminating condition could
  be something like <= dup(0).

Anyway everything appears to be sane after the experiment (that is to
say, nothing is any *more* broken after this
  compared to before this).

I note that Clock doesn't work at all (Stays in "Starting..." forever),
and eToys comes up, but bits of it fail with error dialogs, and
  then there's no way to get out of it, or return to the Sugar
desktop--I had to go over to the virtual serial console and kill -1 it.
  Logviewer hangs just like Clock.  So does MaMa Media Creative Center,
and Record.Hmmm.





signature.asc
Description: OpenPGP digital signature
___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Re: Shutting down fds prior to execvpe in rainbow/inject.py: joyride 247 under Qemu

2007-11-06 Thread Michael Stone
On Tue, Nov 06, 2007 at 10:12:16PM -0500, Marcus Leech wrote:
> I experimentally put some code just before the execvpe() in inject.py to
> close FDs >= 3 and <= 10.  I picked 10 out of the
>   air, but I wouldn't expect there to be many open file descriptors at
> that point.  Actually, given the semantics of dup(),
>   you could use it to probe what the maximum FD number is just before
> execvpe(), so the terminating condition could
>   be something like <= dup(0).

Thanks for trying this. You should make yourself a clone of the security
repo at

  users/mleech/security

and I'll start pulling from you.

> Anyway everything appears to be sane after the experiment (that is to
> say, nothing is any *more* broken after this
>   compared to before this).
> 
> I note that Clock doesn't work at all (Stays in "Starting..." forever),

If you look at /home/olpc/.sugar/default/logs/shell.log you'll see that
Clock is crashing during startup trying to find 'clock.svg'.

> and eToys comes up, but bits of it fail with error dialogs, and
>   then there's no way to get out of it, 

I reported at least one part of this problem to Bert a day or two ago.
Just filed a ticket for it (#4703). We'll see if there are other
problems besides Etoys trying to create $SAR/sandbox.

> or return to the Sugar desktop--I had to go over to the virtual serial
> console and kill -1 it.

Yeah, this is a combination of a rainbow bug and a sugar bug. The
rainbow bug is that we aren't reporting the pid of the process we've
started for Rainbow to wait on.

The Sugar bug is that there's no way to remove the icon of an activity
that crashed during startup.

>   Logviewer hangs just like Clock.  So does MaMa Media Creative Center,
> and Record.Hmmm.

Record has been crashing on startup for a long time (a week?) because
it's trying to mkdir() a directory that already exists.

MaMa Media Creative Center had a similar problem, though some of the
other MaMaMedia activities started fine (e.g. Joke Machine).

I'm not yet sure what's up with LogViewer.

Thanks for the comprehensive report!

Michael
___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Re: Shutting down fds prior to execvpe in rainbow/inject.py: joyride 247 under Qemu

2007-11-06 Thread Benjamin M. Schwartz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Michael Stone wrote:
>> I note that Clock doesn't work at all (Stays in "Starting..." forever),
> 
> If you look at /home/olpc/.sugar/default/logs/shell.log you'll see that
> Clock is crashing during startup trying to find 'clock.svg'.

Heads up to Activity developers:  this is because Activities can no longer
assume that they are started in the $SUGAR_BUNDLE_PATH directory.

- --Ben
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHMTZUUJT6e6HFtqQRArbhAJ9qM95wT4qIRZv2Q5fSSueBfx4O/gCeNgBC
0tsXOZ3hYSDCrP2ix+FzlUI=
=MWTO
-END PGP SIGNATURE-
___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Re: Shutting down fds prior to execvpe in rainbow/inject.py: joyride 247 under Qemu

2007-11-06 Thread Albert Cahalan
Marcus Leech writes:

> I experimentally put some code just before the execvpe() in
> inject.py to close FDs >= 3 and <= 10.  I picked 10 out of
> the air, but I wouldn't expect there to be many open file
> descriptors at that point.  Actually, given the semantics of dup(),
> you could use it to probe what the maximum FD number is just before
> execvpe(), so the terminating condition could be something
> like <= dup(0).

I don't see how dup() would help you. Remember, you could get
back fd 123 even if fd 12345 was the last one allocated and is
still in use. You get the lowest free fd.

You can do readdir() on /proc/self/fd to list them, being
careful to not close the fd used for reading the directory
until you have read the whole directory.
___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Re: Shutting down fds prior to execvpe in rainbow/inject.py: joyride 247 under Qemu

2007-11-07 Thread Marcus Leech
Albert Cahalan wrote:
> Marcus Leech writes:
>
>   
>> I experimentally put some code just before the execvpe() in
>> inject.py to close FDs >= 3 and <= 10.  I picked 10 out of
>> the air, but I wouldn't expect there to be many open file
>> descriptors at that point.  Actually, given the semantics of dup(),
>> you could use it to probe what the maximum FD number is just before
>> execvpe(), so the terminating condition could be something
>> like <= dup(0).
>> 
>
> I don't see how dup() would help you. Remember, you could get
> back fd 123 even if fd 12345 was the last one allocated and is
> still in use. You get the lowest free fd.
>
> You can do readdir() on /proc/self/fd to list them, being
> careful to not close the fd used for reading the directory
> until you have read the whole directory.
>
>   
Yes, you're quite right.   Late-night fuzzy thinking on my part.



signature.asc
Description: OpenPGP digital signature
___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Re: Shutting down fds prior to execvpe in rainbow/inject.py: joyride 247 under Qemu

2007-11-07 Thread Alexander M. Latham
--- Michael Stone wrote:

>   Logviewer hangs just like Clock.  So does MaMa Media Creative Center,
> and Record.Hmmm.

Record has been crashing on startup for a long time (a week?) because
it's trying to mkdir() a directory that already exists.

MaMa Media Creative Center had a similar problem, though some of the
other MaMaMedia activities started fine (e.g. Joke Machine).

I'm not yet sure what's up with LogViewer.

Thanks for the comprehensive report!

Michael
--- end of quote ---

Actually, Record was loading fine in Joyride 243. I just loaded joyride 251. 
Record did not open at first, but after removing the security file, Record, 
Clock, and Log Viewer all loaded fine. MaMa Media Creative Center is still 
broken, but it wasn't working in past builds anyways.

I'll write up bugs as soon as trac is back up.

- AlexL
___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel