Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!mcsun!hp4nl!star.cs.vu.nl!philip From: philip@cs.vu.nl (Philip Homburg) Newsgroups: comp.os.minix Subject: Re: #! in MM -- take 2 Message-ID: <10050@star.cs.vu.nl> Date: 24 May 91 11:50:27 GMT References: <10033@star.cs.vu.nl> Sender: news@cs.vu.nl Organization: Fac. Wiskunde & Informatica, Vrije Universiteit, Amsterdam Lines: 62 In article klamer@mi.eltn.utwente.nl (Klamer Schutte) writes: %In <10033@star.cs.vu.nl> kjb@cs.vu.nl (Kees J. Bot) writes: %>Except for not doing setuid and this other "feature". % %I said i had bugs fixed. Setuid in your way is a bug. What bug, if you say something is a bug please explain why, and how it is triggered. %>I know of three places to look for the proper format of the initial stack: %>- The old V7 manuals under exec(2), written when users were not considered %> too stupid to know such things. %>- The source code of execve(2). %>- The source code of ps(1). %>The ps(1) source contains this interesting comment: % %How nice, to talk about self-documenting code. But i don't model system %call behaviour to assumptions made by any program. So ps(1), look at the %POSIX description of execve(). And yes, i have looked at the source code %of execve(2). This one is mm/exec.c right? The other one (lib/posix/execve.c) %is just an attempt to get the POSIX specification mapped to minix system. First of all POSIX doesn't specify bit patterns but the C-functions to access certain features of the operating system. I can't find an initial stack layout in IEEE Std 1003.1-1988. But I might have overlooked it. mm/exec.c doesn't specify the exec format either, it just copies some data from the old process' image to the new ones. Why isn't the source of execve.c, crtso.s, and ps.c enough for you. %This will destroy alignment of the strings pointed by by argv[] and envp[]. Without ps on a decent machine like a 386 there is no need for alignment specifications execept maybe for speed. But on sparcs and mc68000s some objects need to be aligned. According to the C standard arrays should be aligned on the alignment required by their basetypes. Since the base type of string is char and (1 byte)chars need no alignment, there is no need to align strings and the alignment of strings can't be destroyed. %I must say this kind of bug finding is a good way to get rid of them. %But must this be on news? Private mail should be appropriate. Oh, why are public discussions not appropriate for shell scripts, or bugs? I was glad that Kees posted his version of #! and I installed it immediately. Your version is still somewhere in one of my mailboxes. %Can anybody with a POSIX copy at hand clearify what the correct stack format %is? My old V7 manual (for a m68k system) only says something about pdp11 and %interdata stack layouts... First you state that the POSIX specification is mapped to the minix system, and now you ask for "anybody with a POSIX copy". Yes of course, my V7 manual also mentions only pdp11 and interdata, may be they didn't run V7 on mc68000s back in 1979? You forgot to mention that that manual says nothing about padding. But the the strings should follow the the null after the environment pointers. (Minix doesn't have the 0 word at the top of the memory either, has it?) Philip