Skip to content

libfastjson: missing runtime dependency on libm #29160

@micpf

Description

@micpf

libfastjson uses modf() from libm (in json_object.c / json_print.c) and links against it at build time, but the package definition doesn't declare DEPENDS:=+libm. This means the dynamic linker doesn't guarantee libm is loaded and relocated before libfastjson.

This is normally harmless because rsyslog (the main consumer) also links libm directly. However, with CONFIG_PKG_RELRO_FULL (BIND_NOW), the missing dependency can cause a fatal crash on PowerPC: the dynamic linker may process libfastjson's relocations before libm's GOT is set up, triggering libm's IFUNC resolver (__modf_ifunc) with an uninitialized _rtld_global_ro pointer — resulting in a segfault at address 0x78.

Observed on PowerPC64 BE (e5500) with glibc 2.41, where rsyslogd crashes immediately on startup.

Suggested fix: add DEPENDS:=+libm to the package definition.

 define Package/libfastjson
   SECTION:=libs
   CATEGORY:=Libraries
   TITLE:=A fast JSON library for C
   URL:=https://github.com/rsyslog/libfastjson
+  DEPENDS:=+libm
 endef

Note: glibc's PowerPC INIT_ARCH() macro also has a regression (lost NULL guard for _rtld_global_ro in commit 21841f0d562f), but the missing dependency is a standalone packaging bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions