Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Jun 2019 09:57:56 -0500
From:      Doug Moore <unkadoug@gmail.com>
To:        Shawn Webb <shawn.webb@hardenedbsd.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, pho@freebsd.org
Subject:   Re: svn commit: r348843 - head/sys/vm
Message-ID:  <65cab520-731a-3256-8a71-bb8cfcc93011@gmail.com>
In-Reply-To: <20190610142715.be254wljfrnetuom@mutt-hbsd>
References:  <201906100307.x5A37BFt099669@repo.freebsd.org> <20190610130034.k2nzitvaxvpj5lzx@mutt-hbsd> <c084ec12-5f44-c3e1-bad0-2c702a3032f9@freebsd.org> <20190610142715.be254wljfrnetuom@mutt-hbsd>

next in thread | previous in thread | raw e-mail | index | archive | help

The comment and the code that rejects size==0, or doesn't, are copied
below.  Konstantin Belousov is the last person to have touched most of
it, and can better explain its meaning than I.

Doug Moore

    /*
     * Enforce the constraints.
     * Mapping of length 0 is only allowed for old binaries.
     * Anonymous mapping shall specify -1 as filedescriptor and
     * zero position for new code. Be nice to ancient a.out
     * binaries and correct pos for anonymous mapping, since old
     * ld.so sometimes issues anonymous map requests with non-zero
     * pos.
     */
    if (!SV_CURPROC_FLAG(SV_AOUT)) {
        if ((size == 0 && curproc->p_osrel >= P_OSREL_MAP_ANON) ||
            ((flags & MAP_ANON) != 0 && (fd != -1 || pos != 0)))
            return (EINVAL);
    } else {
        if ((flags & MAP_ANON) != 0)
            pos = 0;
    }

On 6/10/19 9:27 AM, Shawn Webb wrote:
> Sounds good! I think the manpage still might still need a change
> to match the current behavior, or perhaps matching something similar
> to that vm_mmap.c comment. But that comment brings another question:
> what's the definition of "old binaries"? a.out?
>
> Thanks,
>




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?65cab520-731a-3256-8a71-bb8cfcc93011>