strange error building print/texinfo

Eugene Grosbein eugen at grosbein.net
Sat Oct 17 09:57:27 UTC 2015


On 17.10.2015 05:00, Sean Bruno wrote:

> I just built print/texinfo with the lastes qemu-user-static without an
> issue:
> http://tasty.ysv.freebsd.org/build.html?mastername=11mips-default&build=
> 2015-10-16_18h26m15s

I've digged it: install(1) calls mmap() inside its copy() function:

        /*
         * Mmap and write if less than 8M (the limit is so we don't totally
         * trash memory on big files.  This is really a minor hack, but it
         * wins some CPU back.
         */
        done_copy = 0;
        if (size <= 8 * 1048576 && trymmap(from_fd) &&
            (p = mmap(NULL, (size_t)size, PROT_READ, MAP_SHARED,
                    from_fd, (off_t)0)) != MAP_FAILED) {
                nw = write(to_fd, p, size);


mmap() returns NULL in my case, not MAP_FAILD.
There is no check for NULL and write() returns EFAULT for attempt to write to NULL.


More information about the freebsd-mips mailing list