public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug dynamic-link/27105] New: dlmopen crashes if library does not depend on libc
@ 2020-12-22 12:45 sware at reimardoeffinger dot de
  0 siblings, 0 replies; only message in thread
From: sware at reimardoeffinger dot de @ 2020-12-22 12:45 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=27105

            Bug ID: 27105
           Summary: dlmopen crashes if library does not depend on libc
           Product: glibc
           Version: 2.32
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: dynamic-link
          Assignee: unassigned at sourceware dot org
          Reporter: sware at reimardoeffinger dot de
  Target Milestone: ---

This code in dl-open.c assumes a libc is loaded:
  if (!args->libc_already_loaded)
    {
      struct link_map *libc_map = GL(dl_ns)[args->nsid].libc_map;
#ifdef SHARED
      bool initial = libc_map->l_ns == LM_ID_BASE;

(i.e. there is no check for libc_map being NULL)
However there seems to be no code that ensures this, and if dlmopen is used
this can easily be the case.

Trivial script to reproduce the issue:

#!/bin/bash
echo 'void dummytestfunc(void) {}' | gcc -o dummy.so -shared -Os -nostdlib -x c
-
gcc -o test -Os -x c - -ldl <<EOF
#define _GNU_SOURCE
#include <dlfcn.h>
int main()
{
    dlmopen(LM_ID_NEWLM, "./dummy.so", RTLD_NOW);
    return 0;
}
EOF
./test

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-12-22 12:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-22 12:45 [Bug dynamic-link/27105] New: dlmopen crashes if library does not depend on libc sware at reimardoeffinger dot de

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).