Re: shell code on minix



Sridhar wrote:
I installed gcc3.4 on minix3.1.2a which compiles the program without
errors which implies that symbol table construction by the two
compilers may be different.

The program however fails with a "Memory fault- core dumped". Does
that mean that stack is not executable? Again, any piece of code/
literature will be great.

I wonder if that piece of code really works as you expect.

The stack (or data) segment in a i386 processor are not executable and analyzing in details the assembler generated in the Minix and Linux you may see what trick are used and why it works on Linux. I'm sorry, but I.m not familiar with gcc assembler.

It doubt that the compiler is so smart that it changes the segment descriptors (it won't work) but I suppose that it may use some capability of the ELF format used in Linux.

The stack segment could be described twice. As stack and as text segment. The Minix format does not have such feature.

Reading any book on the i386 family of processors would be of help to understand how memory protection and allocation works.

Ciao
Giovanni
--
A computer is like an air conditioner,
it stops working when you open Windows.
Registered Linux user #337974 < http://giovanni.homelinux.net/ >
.



Relevant Pages

  • Re: Microcontroller Project
    ... I'd then suggst you take a look at some more modern compilers perhaps. ... When the stack overwrites the ... registers (memory mapped) all sorts of fun things happen. ... When the stack overflows you don't see any allocation errors. ...
    (sci.electronics.design)
  • Re: Questions about Minix
    ... Of course you still need to allocate chunks of contiguous memory, ... in user mode and at kernel level if you need dynamic ... I read "data segment". ... a stack from growing into the heap (only a possibility of detecting it ...
    (comp.os.minix)
  • Re: Questions about Minix
    ... I think I got to that conclusion that .text shared the same memory chunk ... segment to processes from the beginning, and a data segment that did not ... True, but this would limit your stack size to some predetermined value, ... you still have plenty of heap left. ...
    (comp.os.minix)
  • Re: Questions about Minix
    ... allocating each component the memory it needs can be a real pain). ... This real makes stuff very "static", because the stack ... necessary) the segment when the application demands more heap than was ... address in the data segment, because the data segment contains only data ...
    (comp.os.minix)
  • Re: execve() and heap memory
    ... bss, and stack of the calling process are overwritten by ... This is typically placed in memory above the 'text' (or at ... literals) in the text segment. ... Stack instructions in the 'text', ...
    (comp.unix.programmer)