• Re: BSS

    From Marcel Mueller@21:1/5 to All on Mon Mar 4 19:32:25 2024
    Am 02.03.24 um 09:01 schrieb Paul Edwards:
    I changed malloc to calloc in exeload.c and
    the problem was resolved. I didn't notice a
    specific BSS section in the LX header so will
    leave any refining of that to another day.

    This is another story. malloc does not clear memory.
    Even when the operating system clears memory before it is mapped into a
    process malloc may still return dirty memory that has been used by the
    same process before when free has been called.


    Marcel

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marcel Mueller@21:1/5 to All on Mon Mar 4 19:29:02 2024
    Am 02.03.24 um 06:56 schrieb Paul Edwards:
    Whose responsibility is it to clear BSS?

    I assume it is the operating system.

    Yes. More accurately the operating system initializes memory before it
    is mapped into a different process. Otherwise one could simply allocate
    memory and read from it to get information from other processes or even
    kernel mode code.

    I am now able to open and read/write files,
    but during testing (on PDOS/386) I found an
    issue which I believe is due to uninitialized BSS.

    OS/2 and modern operating systems clear the memory. DOS does not clear anything. And in the C language reading from memory that has not been
    written before is undefined behavior.


    Marcel

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)