bug-libsigsegv
[Top][All Lists]
Advanced

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

a question about the use of MAP_ANON in libsigsegv


From: Dennis Clarke
Subject: a question about the use of MAP_ANON in libsigsegv
Date: Thu, 10 Aug 2023 13:57:18 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0


Dear Bruno :

    I have been having some fun going in circles with libsigsegv on a
few machines of varying types. In this case I have FreeBSD 14.0 on a
very ordinary AMD64 machine as well as Debian Linux sid on an IBM POWER9
server.  Also there is a big endian ppc64 machine running Debian sid
tossed into this mixture. Sometimes I see libsigsegv configure fine and then blow up diring compile due to :

/usr/local/bin/gmake TARGETSTACK=" all" all-recursive
gmake[1]: Entering directory '/opt/bw/build/libsigsegv-2.14_FreeBSD14_amd64.002'
Making all in src
gmake[2]: Entering directory '/opt/bw/build/libsigsegv-2.14_FreeBSD14_amd64.002/src' /bin/sh ../libtool --tag=CC --mode=compile /usr/bin/cc -DHAVE_CONFIG_H -I. -I.. -I. -I. -I/opt/bw/include -L/opt/bw/lib -D_LARGEFILE64_SOURCE -D_XOPEN_SOURCE=600 -std=iso9899:1999 -pedantic -pedantic-errors -m64 -g -O0 -fno-fast-math -fno-builtin -Weverything -Wno-reserved-id-macro -Wno-missing-prototypes -Wno-padded -Wno-disabled-macro-expansion -Wno-sign-conversion -Wno-reserved-identifier -Wno-extra-semi-stmt -Wno-unsafe-buffer-usage -c -o handler.lo handler.c libtool: compile: /usr/bin/cc -DHAVE_CONFIG_H -I. -I.. -I. -I. -I/opt/bw/include -L/opt/bw/lib -D_LARGEFILE64_SOURCE -D_XOPEN_SOURCE=600 -std=iso9899:1999 -pedantic -pedantic-errors -m64 -g -O0 -fno-fast-math -fno-builtin -Weverything -Wno-reserved-id-macro -Wno-missing-prototypes -Wno-padded -Wno-disabled-macro-expansion -Wno-sign-conversion -Wno-reserved-identifier -Wno-extra-semi-stmt -Wno-unsafe-buffer-usage -c handler.c -fPIC -DPIC -o .libs/handler.o cc: warning: argument unused during compilation: '-L/opt/bw/lib' [-Wunused-command-line-argument]
In file included from handler.c:19:
In file included from ./handler-none.c:17:
./sigsegv.h:32:5: warning: '__GLIBC__' is not defined, evaluates to 0 [-Wundef]
#if __GLIBC__ >= 2
    ^
In file included from handler.c:19:
./handler-none.c:20:44: warning: unused parameter 'handler' [-Wunused-parameter]
sigsegv_install_handler (sigsegv_handler_t handler)
                                           ^
./handler-none.c:39:56: warning: unused parameter 'handler' [-Wunused-parameter]
stackoverflow_install_handler (stackoverflow_handler_t handler,
                                                       ^
./handler-none.c:40:38: warning: unused parameter 'extra_stack' [-Wunused-parameter]
                               void *extra_stack, size_t extra_stack_size)
                                     ^
./handler-none.c:40:58: warning: unused parameter 'extra_stack_size' [-Wunused-parameter]
                               void *extra_stack, size_t extra_stack_size)
                                                         ^
5 warnings generated.
libtool: compile: /usr/bin/cc -DHAVE_CONFIG_H -I. -I.. -I. -I. -I/opt/bw/include -L/opt/bw/lib -D_LARGEFILE64_SOURCE -D_XOPEN_SOURCE=600 -std=iso9899:1999 -pedantic -pedantic-errors -m64 -g -O0 -fno-fast-math -fno-builtin -Weverything -Wno-reserved-id-macro -Wno-missing-prototypes -Wno-padded -Wno-disabled-macro-expansion -Wno-sign-conversion -Wno-reserved-identifier -Wno-extra-semi-stmt -Wno-unsafe-buffer-usage -c handler.c -o handler.o >/dev/null 2>&1 /bin/sh ../libtool --tag=CC --mode=compile /usr/bin/cc -DHAVE_CONFIG_H -I. -I.. -I. -I. -I/opt/bw/include -L/opt/bw/lib -D_LARGEFILE64_SOURCE -D_XOPEN_SOURCE=600 -std=iso9899:1999 -pedantic -pedantic-errors -m64 -g -O0 -fno-fast-math -fno-builtin -Weverything -Wno-reserved-id-macro -Wno-missing-prototypes -Wno-padded -Wno-disabled-macro-expansion -Wno-sign-conversion -Wno-reserved-identifier -Wno-extra-semi-stmt -Wno-unsafe-buffer-usage -c -o stackvma.lo stackvma.c libtool: compile: /usr/bin/cc -DHAVE_CONFIG_H -I. -I.. -I. -I. -I/opt/bw/include -L/opt/bw/lib -D_LARGEFILE64_SOURCE -D_XOPEN_SOURCE=600 -std=iso9899:1999 -pedantic -pedantic-errors -m64 -g -O0 -fno-fast-math -fno-builtin -Weverything -Wno-reserved-id-macro -Wno-missing-prototypes -Wno-padded -Wno-disabled-macro-expansion -Wno-sign-conversion -Wno-reserved-identifier -Wno-extra-semi-stmt -Wno-unsafe-buffer-usage -c stackvma.c -fPIC -DPIC -o .libs/stackvma.o cc: warning: argument unused during compilation: '-L/opt/bw/lib' [-Wunused-command-line-argument]
In file included from stackvma.c:19:
In file included from ./stackvma-freebsd.c:21:
./stackvma-rofile.c:29:5: warning: 'HAVE_MMAP_ANON' is not defined, evaluates to 0 [-Wundef]
#if HAVE_MMAP_ANON && !HAVE_MMAP_ANONYMOUS
    ^
./stackvma-rofile.c:154:22: error: call to undeclared function 'getpagesize'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
          pagesize = getpagesize ();
                     ^
./stackvma-rofile.c:169:36: error: use of undeclared identifier 'MAP_ANONYMOUS'
                                   MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
                                   ^
./stackvma-rofile.c:108:19: warning: implicit conversion loses integer precision: 'ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
          int n = read (fd, rof->buffer, size);
              ~   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
./stackvma-rofile.c:118:36: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
              if (n + MIN_LEFTOVER <= size)
                  ~~~~~~~~~~~~~~~~ ^  ~~~~
In file included from stackvma.c:19:
In file included from ./stackvma-freebsd.c:24:
In file included from /usr/include/sys/user.h:40:
/usr/include/machine/pcb.h:81:2: error: unknown type name 'u_int'
        u_int           pcb_flags;
        ^
In file included from stackvma.c:19:
In file included from ./stackvma-freebsd.c:24:
In file included from /usr/include/sys/user.h:46:
/usr/include/sys/ucred.h:99:2: error: unknown type name 'u_int'
        u_int   cr_version;             /* structure layout version */
        ^
In file included from stackvma.c:19:
In file included from ./stackvma-freebsd.c:24:
In file included from /usr/include/sys/user.h:49:
/usr/include/sys/_lock.h:38:2: error: unknown type name 'u_int'
        u_int   lo_flags;
        ^
/usr/include/sys/_lock.h:39:2: error: unknown type name 'u_int'
        u_int   lo_data;                /* General class specific data. */
        ^
In file included from stackvma.c:19:
In file included from ./stackvma-freebsd.c:24:
In file included from /usr/include/sys/user.h:51:
In file included from /usr/include/sys/proc.h:50:
In file included from /usr/include/sys/filedesc.h:42:
/usr/include/sys/lock.h:63:2: error: unknown type name 'u_int'
        u_int           lc_flags;
        ^
In file included from stackvma.c:19:
In file included from ./stackvma-freebsd.c:24:
In file included from /usr/include/sys/user.h:51:
In file included from /usr/include/sys/proc.h:50:
In file included from /usr/include/sys/filedesc.h:44:
/usr/include/sys/priority.h:135:2: error: unknown type name 'u_char'; did you mean 'char'?
        u_char  pri_class;      /* Scheduling class. */
        ^
/usr/include/sys/priority.h:136:2: error: unknown type name 'u_char'; did you mean 'char'?
        u_char  pri_level;      /* Normal priority level. */
        ^
/usr/include/sys/priority.h:137:2: error: unknown type name 'u_char'; did you mean 'char'?
        u_char  pri_native;     /* Priority before propagation. */
        ^
/usr/include/sys/priority.h:138:2: error: unknown type name 'u_char'; did you mean 'char'? u_char pri_user; /* User priority based on p_cpu and p_nice. */
        ^
In file included from stackvma.c:19:
In file included from ./stackvma-freebsd.c:24:
In file included from /usr/include/sys/user.h:51:
In file included from /usr/include/sys/proc.h:50:
/usr/include/sys/filedesc.h:54:2: error: unknown type name 'u_long'; did you mean 'long'?
        u_long          *fc_ioctls;     /* per-descriptor allowed ioctls */
        ^
/usr/include/sys/filedesc.h:98:2: error: unknown type name 'u_int'
        u_int           pwd_refcount;
        ^
/usr/include/sys/filedesc.h:109:2: error: unknown type name 'u_int'
        u_int           pd_refcount;
        ^
/usr/include/sys/filedesc.h:110:2: error: unknown type name 'u_short'; did you mean 'short'?
        u_short         pd_cmask;       /* mask for file creation */
        ^
/usr/include/sys/filedesc.h:119:2: error: unknown type name 'u_long'; did you mean 'long'?
        NDSLOTTYPE *fd_map;             /* bitmap of free fds */
        ^
/usr/include/sys/filedesc.h:87:20: note: expanded from macro 'NDSLOTTYPE'
#define NDSLOTTYPE      u_long
                        ^
In file included from stackvma.c:19:
In file included from ./stackvma-freebsd.c:24:
In file included from /usr/include/sys/user.h:51:
In file included from /usr/include/sys/proc.h:56:
/usr/include/sys/osd.h:42:2: error: unknown type name 'u_int'
        u_int             osd_nslots;   /* (c) */
        ^
In file included from stackvma.c:19:
In file included from ./stackvma-freebsd.c:24:
In file included from /usr/include/sys/user.h:51:
In file included from /usr/include/sys/proc.h:58:
/usr/include/sys/rtprio.h:76:2: error: unknown type name 'u_short'; did you mean 'short'?
        u_short type;                   /* scheduling class */
        ^
/usr/include/sys/rtprio.h:77:2: error: unknown type name 'u_short'; did you mean 'short'?
        u_short prio;
        ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
3 warnings and 20 errors generated.
gmake[2]: *** [Makefile:495: stackvma.lo] Error 1
gmake[2]: Leaving directory '/opt/bw/build/libsigsegv-2.14_FreeBSD14_amd64.002/src'
gmake[1]: *** [Makefile:433: all-recursive] Error 1
gmake[1]: Leaving directory '/opt/bw/build/libsigsegv-2.14_FreeBSD14_amd64.002'
gmake: *** [Makefile:365: all] Error 2


This seems a little strange. The configure was very nice and clean and claimed to discover all about mmap and its flavour :

hydra$ uname -apKU
FreeBSD hydra 14.0-CURRENT FreeBSD 14.0-CURRENT amd64 1400093 #0 main-n264412-53e1af5a1094: Fri Jul 28 20:12:45 GMT 2023 root@hydra:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64 amd64 1400093 1400093
hydra$
hydra$ cc --version
FreeBSD clang version 16.0.6 (https://github.com/llvm/llvm-project.git llvmorg-16.0.6-0-g7cbf1a259152)
Target: x86_64-unknown-freebsd14.0
Thread model: posix
InstalledDir: /usr/bin
hydra$

hydra$ ./configure --prefix=/opt/bw --disable-silent-rules --enable-dependency-tracking --enable-shared --enable-static --without-gnu-ld

Build Tools:
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... ./build-aux/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... nawk
checking whether /usr/local/bin/gmake sets $(MAKE)... yes
checking whether /usr/local/bin/gmake supports nested variables... yes
checking for gcc... /usr/bin/cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether /usr/bin/cc accepts -g... yes
checking for /usr/bin/cc option to enable C11 features... unsupported
checking for /usr/bin/cc option to enable C99 features... none needed
checking whether /usr/bin/cc understands -c and -o together... yes
checking whether /usr/local/bin/gmake supports the include directive... yes (GNU style)
checking dependency style of /usr/bin/cc... none
checking how to run the C preprocessor... /usr/bin/cc -E
checking build system type... x86_64-unknown-freebsd14.0
checking host system type... x86_64-unknown-freebsd14.0
checking host platform... x86_64-unknown-freebsd14.0
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by /usr/bin/cc... /usr/local/bin/x86_64-unknown-freebsd14.0-ld checking if the linker (/usr/local/bin/x86_64-unknown-freebsd14.0-ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/local/bin/nm -B
checking the name lister (/usr/local/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 393216
checking how to convert x86_64-unknown-freebsd14.0 file names to x86_64-unknown-freebsd14.0 format... func_convert_file_noop checking how to convert x86_64-unknown-freebsd14.0 file names to toolchain format... func_convert_file_noop checking for /usr/local/bin/x86_64-unknown-freebsd14.0-ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... no
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/local/bin/nm -B output from /usr/bin/cc object... failed
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if /usr/bin/cc supports -fno-rtti -fno-exceptions... yes
checking for /usr/bin/cc option to produce PIC... -fPIC -DPIC
checking if /usr/bin/cc PIC flag -fPIC -DPIC works... yes
checking if /usr/bin/cc static flag -static works... no
checking if /usr/bin/cc supports -c -o file.o... yes
checking if /usr/bin/cc supports -c -o file.o... (cached) yes
checking whether the /usr/bin/cc linker (/usr/local/bin/x86_64-unknown-freebsd14.0-ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... freebsd14.0 ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... no
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes

Optional Platform Environment:
checking for sys/signal.h... yes
checking for unistd.h... (cached) yes
checking for getpagesize... no
checking for sysconf(_SC_PAGESIZE)... yes
checking for PAGESIZE in limits.h... no
checking for mmap with MAP_ANON... no
checking for mmap with MAP_ANONYMOUS... no
checking for mmap of /dev/zero... no
checking whether a fault handler according to POSIX works... no
checking whether a fault handler according to Linux/i386 works... no
checking whether a fault handler according to old Linux/i386 works... no
checking whether a fault handler according to Linux/m68k works... no
checking whether a fault handler according to Linux/PowerPC works... no
checking whether a fault handler according to Linux/HPPA works... no
checking whether a fault handler according to BSD works... no
checking whether a fault handler according to IRIX works... no
checking whether a fault handler according to HP-UX HPPA works... no
checking whether a fault handler according to OSF/1 Alpha works... no
checking whether a fault handler according to NetBSD Alpha works... no
checking whether a fault handler according to AIX works... no
checking whether a fault handler according to MacOSX/Darwin7 PowerPC works... no checking whether a fault handler according to MacOSX/Darwin5 PowerPC works... no
checking whether a fault handler according to Hurd works... no
checking for the fault handler specifics... none
checking if the system supports catching SIGSEGV... no
checking for stack direction... grows down
checking for prmap_t in sys/procfs.h... no
checking for mquery... no
checking for mincore... no
checking for getrlimit... no
checking for setrlimit... no
checking for sigaltstack... no
checking for setrlimit... (cached) no
checking for working sigaltstack... no
checking whether a signal handler can be left through longjmp... no
checking whether a signal handler can be left through longjmp and sigaltstack... no checking whether a signal handler can be left through longjmp and setcontext... no
checking whether a signal handler can be left through siglongjmp... no
checking whether a signal handler can be left through siglongjmp and sigaltstack... no checking whether a signal handler can be left through siglongjmp and setcontext... no
checking if the system supports catching stack overflow... no
checking for uintptr_t... yes

Build Parameters:
checking whether to activate relocatable installation... no

Output Substitution:

Now please type 'make' to compile. Good luck.

checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating src/sigsegv.h
config.status: creating tests/Makefile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands


So it seems odd to blow up due to stuff related to getpagesize() and MAP_ANONYMOUS?

I see similar behavior on the Debian Linux sid ppc64le machine.


--
Dennis Clarke
RISC-V/SPARC/PPC/ARM/CISC
UNIX and Linux spoken
GreyBeard and suspenders optional



reply via email to

[Prev in Thread] Current Thread [Next in Thread]