[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: remctl build failure on hurd



(Please cc; I'm not a member of the list.  Thanks!)

Samuel Thibault <sthibault@debian.org> writes:
> Russ Allbery, le Mon 30 Nov 2009 13:19:37 -0800, a écrit :

>> They use setrlimit and then attempt to allocate a large amount of
>> memory to force the allocation to fail.

> Ah, they are using RLIMIT_AS, but it's not (yet) implemented on
> hurd-i386.

In that case, shouldn't setrlimit(RLIMIT_AS) fail?  The code should be
handling that.  Here's the relevant excerpt:

    /*
     * If a memory limit was given and we can set memory limits, set it.
     * Otherwise, exit 2, signalling to the driver that the test should be
     * skipped.  We do this here rather than in the driver due to some
     * pathological problems with Linux (setting ulimit in the shell caused
     * the shell to die).
     */
    if (limit > 0) {
#if HAVE_SETRLIMIT && defined(RLIMIT_AS)
        rl.rlim_cur = limit;
        rl.rlim_max = limit;
        if (setrlimit(RLIMIT_AS, &rl) < 0) {
            syswarn("Can't set data limit to %lu", (unsigned long) limit);
            exit(2);
        }
        if (size < limit || code == 'r') {
            tmp = malloc(code == 'r' ? 10 : size);
            if (tmp == NULL) {
                syswarn("Can't allocate initial memory of %lu",
                        (unsigned long) size);
                exit(2);
            }
            free(tmp);
        }
#else
        warn("Data limits aren't supported.");
        exit(2);
#endif
    }

-- 
Russ Allbery (rra@debian.org)               <http://www.eyrie.org/~eagle/>


Reply to: