[uClibc] Re: [grsec] crt1S.S file for uClibc

Peter S. Mazinger ps.m at gmx.net
Sat Oct 11 12:57:09 UTC 2003


This is coming from grsecurity list, but the uClibc developers could 
have better answers.

On Sat, 11 Oct 2003, Erik Månsson wrote:

> * pageexec at freemail.hu <pageexec at freemail.hu> [031011 09:01]:
> > ok, i've finally done some debugging myself and... it's really weird.
> > for a start, when i compile uClibc itself and then link executables
> > with its normal crt1.o, they don't work either. as it turns out, there
> > is a bug somewhere in the awk script generating crt[in].o which emits
> > some garbage code into _init/_fini and that causes a segfault quite
> > early during startup - i cannot imagine how this works for anyone,
> > maybe i specified wrong config options, if you have known working
> > setup, please email it to me. i'll keep looking into this but from
> > what i can tell, my code works but something else is wrong in uClibc
> > itself.
> 
> Yes, I remember having problems when I compiled it. In my notes
> for compiling uClibc-0.9.19 I wrote:
> 
> # Diable support for global constructors/destructoirs and dynamic atexit
> # (cause segfault).
> 
> The rest of my notes read:
> # No threads, no shadow support.
> # regexp support must be enabled (busybox)
> # Change to cp -a lib/*.so* (remove '.') in Makefile under install_target
> 
> I hope this was of use
I am using 0.9.21, some of the mentioned problems where solved since 
0.9.19.
I do not have any problems with CTOR_DTOR and dynamic atexit, either with 
threads and shadow. Also since 0.9.18 you do not need EMUTRAMP support in 
kernel. See the attached config file (this works). The only special option 
is, when you build gcc (--disable_cxa_atexit), but has nothing to do with 
dynamic atexit for uClibc (search uClibc list), only the c++ excutables 
are not Linux distro-independent (who has a uClibc distro? ;-)
The comments say that you need CTOR_DTOR if you want to use C++, or gcc's 
__attribute__(([de]constructor)), in this case crtbegin.o/crtend.o have to 
be used in gcc's specs (it's there). Looking at the crt0.S file, it looks
like we need L_crt1 and __UCLIBC_CTOR_DTOR__ defined, else the crt1S.S 
provided by the PaX Team cannot work, or it requires changes in 
libc/misc/internals/__uClibc_main.c file. This file comments:
__uClibc_main function (for uClibc < 0.9.16 compatibility)
__uClibc_start_main function (for new uClibc versions)

It looks like the changes needed for a position independent crt1S.S 
in case no L_crt1 and __UCLIBC_CTOR_DTOR__ are defined has to be done in
corespondence with changes in __uClibc_main.c (_init/_fini). I am not a 
programmer, but that is what I interpret.

Peter

-- 
Peter S. Mazinger <ps.m at gmx.net>   ID: 0xA5F059F2    NIC: IXUYHSKQLI
Key fingerprint = 92A4 31E1 56BC 3D5A 2D08  BB6E C389 975E A5F0 59F2

____________________________________________________________________
Miert fizetsz az internetert? Korlatlan, ingyenes internet hozzaferes a FreeStarttol.
Probald ki most! http://www.freestart.hu
-------------- next part --------------
#
# Automatically generated make config: don't edit
#

#
# Target Architecture Features and Options
#
HAVE_ELF=y
CONFIG_GENERIC_386=y
# CONFIG_386 is not set
# CONFIG_486 is not set
# CONFIG_586 is not set
# CONFIG_586MMX is not set
# CONFIG_686 is not set
# CONFIG_PENTIUMIII is not set
# CONFIG_PENTIUM4 is not set
# CONFIG_K6 is not set
# CONFIG_K7 is not set
# CONFIG_CRUSOE is not set
# CONFIG_WINCHIPC6 is not set
# CONFIG_WINCHIP2 is not set
# CONFIG_CYRIXIII is not set
UCLIBC_HAS_MMU=y
UCLIBC_HAS_FLOATS=y
HAS_FPU=y
DO_C99_MATH=y
WARNINGS="-Wall"
KERNEL_SOURCE="/usr"
C_SYMBOL_PREFIX=""
HAVE_DOT_CONFIG=y

#
# General Library Settings
#
DOPIC=y
HAVE_SHARED=y
# ADD_LIBGCC_FUNCTIONS is not set
BUILD_UCLIBC_LDSO=y
LDSO_LDD_SUPPORT=y
UCLIBC_CTOR_DTOR=y
# UCLIBC_PROFILING is not set
UCLIBC_HAS_THREADS=y
# PTHREADS_DEBUG_SUPPORT is not set
UCLIBC_HAS_LFS=y
# MALLOC is not set
MALLOC_930716=y
# MALLOC_GLIBC_COMPAT is not set
UCLIBC_DYNAMIC_ATEXIT=y
HAS_SHADOW=y
UNIX98PTY_ONLY=y
ASSUME_DEVPTS=y
UCLIBC_HAS_TM_EXTENSIONS=y
UCLIBC_HAS_TZ_CACHING=y
UCLIBC_HAS_TZ_FILE=y
# UCLIBC_HAS_TZ_FILE_READ_MANY is not set
UCLIBC_TZ_FILE_PATH="/etc/TZ"

#
# Networking Support
#
# UCLIBC_HAS_IPV6 is not set
UCLIBC_HAS_RPC=y
UCLIBC_HAS_FULL_RPC=y

#
# String and Stdio Support
#
UCLIBC_HAS_CTYPE_TABLES=y
UCLIBC_HAS_CTYPE_SIGNED=y
# UCLIBC_HAS_CTYPE_UNSAFE is not set
UCLIBC_HAS_CTYPE_CHECKED=y
# UCLIBC_HAS_CTYPE_ENFORCED is not set
UCLIBC_HAS_WCHAR=y
UCLIBC_HAS_LOCALE=y
UCLIBC_PREGENERATED_LOCALE_DATA=y
# UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA is not set
# UCLIBC_HAS_XLOCALE is not set
UCLIBC_HAS_HEXADECIMAL_FLOATS=y
UCLIBC_HAS_GLIBC_DIGIT_GROUPING=y
UCLIBC_HAS_SCANF_LENIENT_DIGIT_GROUPING=y
UCLIBC_HAS_GLIBC_CUSTOM_PRINTF=y
UCLIBC_PRINTF_SCANF_POSITIONAL_ARGS=9
UCLIBC_HAS_SCANF_GLIBC_A_FLAG=y
# UCLIBC_HAS_STDIO_BUFSIZ_NONE is not set
# UCLIBC_HAS_STDIO_BUFSIZ_256 is not set
# UCLIBC_HAS_STDIO_BUFSIZ_512 is not set
# UCLIBC_HAS_STDIO_BUFSIZ_1024 is not set
# UCLIBC_HAS_STDIO_BUFSIZ_2048 is not set
UCLIBC_HAS_STDIO_BUFSIZ_4096=y
# UCLIBC_HAS_STDIO_BUFSIZ_8192 is not set
UCLIBC_HAS_STDIO_BUILTIN_BUFFER_NONE=y
# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_4 is not set
# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_8 is not set
UCLIBC_HAS_STDIO_GETC_MACRO=y
UCLIBC_HAS_STDIO_PUTC_MACRO=y
UCLIBC_HAS_STDIO_AUTO_RW_TRANSITION=y
UCLIBC_HAS_FOPEN_LARGEFILE_MODE=y
UCLIBC_HAS_FOPEN_EXCLUSIVE_MODE=y
UCLIBC_HAS_GLIBC_CUSTOM_STREAMS=y
UCLIBC_HAS_PRINTF_M_SPEC=y
UCLIBC_HAS_ERRNO_MESSAGES=y
# UCLIBC_HAS_SYS_ERRLIST is not set
UCLIBC_HAS_SIGNUM_MESSAGES=y
# UCLIBC_HAS_SYS_SIGLIST is not set
UCLIBC_HAS_GETTEXT_AWARENESS=y
UCLIBC_HAS_GNU_GETOPT=y

#
# Big and Tall
#
UCLIBC_HAS_REGEX=y
# UCLIBC_HAS_WORDEXP is not set
UCLIBC_HAS_FTW=y
UCLIBC_HAS_GLOB=y

#
# Library Installation Options
#
SHARED_LIB_LOADER_PATH="/lib"
DEVEL_PREFIX=""
SYSTEM_DEVEL_PREFIX=""
DEVEL_TOOL_PREFIX="/usr"

#
# uClibc development/debugging options
#
# DODEBUG is not set
# DOASSERTS is not set
# SUPPORT_LD_DEBUG is not set
# SUPPORT_LD_DEBUG_EARLY is not set
# UCLIBC_MJN3_ONLY is not set


More information about the uClibc mailing list