Prebinding for DragonFly/FreeBSD-4

Matthew Dillon dillon at apollo.backplane.com
Tue Sep 16 20:00:57 PDT 2003


    Patching for suid/sgid prebinding disablement is trivial.  The code
    in _rtld() is just slightly modified to add an if (trust) ...

    if (trust) {
	prebind_disable = getenv("LD_PREBIND_DISABLE") != NULL;
    } else {
	prebind_disable = 1;
    }

    ...

    if (trust) {
        ld_prebind = getenv("LD_PREBIND");
        if (ld_prebind != NULL && *ld_prebind != '\0') {
            ld_bind_now = ld_prebind;
            prebind_disable = 1;
        } 
    }

    Also, you do not need to initialize prebind_disable to 0 in the
    'int prebind_disable = 0' declaration, since you unconditionally
    initialize it below and the compiler will catch simple cases for
    variables that are used without being initialized.  Or, alternatively,
    you can default prebind_disable to 1 in the declaration and clean up
    my else clause above.

						-Matt







More information about the Kernel mailing list