is there a problem with Minix bss? - Minix

This is a discussion on is there a problem with Minix bss? - Minix ; Kees, I made some modifications to bootimage.c concerning my previous postings. If what I present bellow is correct the Minix kernel processes are loaded with a part of the bss area not zeroed. In that case I think it is ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: is there a problem with Minix bss?

  1. is there a problem with Minix bss?

    Kees,

    I made some modifications to bootimage.c concerning my previous postings. If
    what I present bellow is correct the Minix kernel processes are loaded with
    a part of the bss area not zeroed. In that case I think it is still possible
    for a processes, even with non blanked bss, to continue function correctly,
    however this might be proved dangerous in some cases, especially if Minix is
    loaded, then exits to the Monitor and finally is loaded again.



    I added at bootimage.c the lines with the NEW comment, the first ones to see
    the addresses that are zeroed and the second ones to have the chance to
    examine the kernel banner:

    ------------------------------------------------------

    /* Zero out bss. */
    printf("\n Start zeroing at %06lx\n\n", addr); /* NEW
    */
    if (addr + n > limit) { errno= ENOMEM; return; }
    raw_clear(addr, n);
    addr+= n;


    ....

    printf("please press any key/n"); /* NEW */
    getchat(); /* NEW */
    /* Check the kernel magic number. */

    -------------------------------------------------------

    it printed to the screen ( I ommit the kernel process):

    ---------------------------------------------------------
    cs ds text data bss stack

    100000 103100 12544 1176 29576 1024 mm


    Start zeroing at 0x103600
    ----------------------------------------------------------


    ds decimal 1061120
    + data 1176
    --------
    1062296 or 0x103598 (bss)


    Start zeroing (bss) was at 0x103600 or 1062400 decimal


    DIFFERENCE 104 positions


    the next line (fs) is:

    ------------------------------------------------------


    10ae00 112100 29392 2196 108084 2148 fs

    Start zeroing at 0x112a00
    ------------------------------------------------------

    ds 112100 is decimal 1122560
    + data 2196
    ---------
    1124756 or 0x112994 (bss)

    Starting zeroing (bss) was at 0x112a00 or 1124846 decimal

    DIFFERENCE 90 positions




    Christos



  2. Re: is there a problem with Minix bss?

    In article <1135694528.374195@athnrd02>,
    Christos Karayiannis wrote:
    >
    >ds decimal 1061120
    > + data 1176
    > --------
    > 1062296 or 0x103598 (bss)
    >
    >
    >Start zeroing (bss) was at 0x103600 or 1062400 decimal
    >
    >
    >DIFFERENCE 104 positions


    Has been cleared by get_segment() already. As I've already told you in
    <6nulod.t8s.ln@jetsam.cs.vu.nl>:

    "So get_segment() reads a text or data segment into memory and then
    pads it out to the next click boundary with zeros."

    And that's the last response you'll get from me.
    --
    Kees J. Bot, Systems Programmer, Sciences dept., Vrije Universiteit Amsterdam

  3. Re: is there a problem with Minix bss?


    > "So get_segment() reads a text or data segment into memory and then
    > pads it out to the next click boundary with zeros."
    >
    > And that's the last response you'll get from me.
    > --
    > Kees J. Bot, Systems Programmer, Sciences dept., Vrije Universiteit

    Amsterdam

    Kees,

    anyone can use debugging checkpoints easily and check at the lines of
    get_segment() that you refer the number n, which is the number of memory
    positions padded with zeros. To my experiment and for all Minix kernel
    processes this number was always zero. Therefore get_segment() does not zero
    and at the same time the part of exec_image() code after the comment

    /* Zero out bss. */

    zeroes a little after the beginning of bss (the differences I mentioned in
    my previous posting). A patch for bootimage.c to debug get_segment() would
    not be difficult to make.


    To print n I just added the "/* NEW LINE */" to get_segment() as:

    ----------------------------------
    /* Zero extend to a click. */
    n= align(*addr, click_size) - *addr;

    printf("%d", n); /* NEW LINE */

    raw_clear(*addr, n);
    *addr+= n;
    *size-= n;
    return 1;
    -------------------------------------


    Christos



+ Reply to Thread