Confused by segfault with legitimate call to strerror(3) on amd64 / sysctl(3) setting `odd' errno's

Garrett Cooper yanefbsd at gmail.com
Fri Jan 16 01:19:52 PST 2009


On Fri, Jan 16, 2009 at 12:58 AM, Garrett Cooper <yanefbsd at gmail.com> wrote:
> On Fri, Jan 16, 2009 at 12:57 AM, Christoph Mallon
> <christoph.mallon at gmx.de> wrote:
>> Garrett Cooper schrieb:
>>>
>>> Good point. I modified the source to do that.
>>> Thanks,
>>> -Garrett
>>
>> You should reply to all so the discussion stays on the list.
>
> Yeah, that was a goofup on my part. Go-go Gmail web interface!
> -Garrett

Hmmm... looks like the strerror issue it could be a serious bug:

#include <errno.h>
#include <stdio.h>
#include <sys/stat.h>

int
main()
{

        struct stat sb;

        int o_errno;

        if (stat("/some/file/that/doesn't/exist", &sb) != 0) {
                o_errno = errno;
                printf("Errno: %d\n", errno);
                err(errno, "%s", strerror(o_errno));
        }

        return 0;

}

[gcooper at optimus ~]$ ./badfile
Errno: 2
badfile: Segmentation fault: 11 (core dumped)

    I rebuilt my kernel and installed it, and I rebuilt world, but
haven't installed it yet though, so let me reboot the amd64 machine
and see what happens (may be a mismatched ABI issue)...
Cheers,
-Garrett


More information about the freebsd-hackers mailing list