public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
From: Nathan Nye <nnye@whitebeamsec.com>
To: libc-help@sourceware.org
Subject: Possible glibc 2.35 ARM regression in LD_BIND_NOT
Date: Mon, 4 Jul 2022 15:14:52 -0400	[thread overview]
Message-ID: <055beaf8-d0ba-523b-499f-50f13834111b@whitebeamsec.com> (raw)


[-- Attachment #1.1.1: Type: text/plain, Size: 687 bytes --]

Good afternoon,

I'm reviewing what could be a regression in LD_BIND_NOT's functionality 
in glibc 2.35 on ARM architectures (there were a few recent ARM audit 
changes). Symbol binding only occurs a single time on glibc 2.35/ARM, 
even when LD_BIND_NOT is enabled. I've tested:

  * Ubuntu 22.04 x86_64 glibc 2.35
  * Ubuntu 20.04 ARM glibc 2.34
  * Ubuntu 22.04 ARM glibc 2.35

I could use a second pair of eyes on this issue to verify it exists. 
Here is the test case I cobbled together, please excuse the poor C code 
I wrote while testing: https://pastebin.com/raw/HSSYjemj

I've also attached the test case to this email. Thanks!

Very respectfully,
Nathan Nye

[-- Attachment #1.1.2: ldbindnot235.txt --]
[-- Type: text/plain, Size: 1214 bytes --]

runevp.c:
// gcc runevp.c -o runevp
#include <stdio.h>
#include <unistd.h>

int main() {
    int i;
    for (i=0; i < 5; i++) {
        if(fork()==0) {
            execvp("true", NULL);
        }
    }
    return 0;
}

auditlib.c:
// gcc -Wall -fPIC -shared -o auditlib.so auditlib.c
#include <link.h>
#include <stdio.h>
typedef long int Lmid_t;
unsigned int la_version(unsigned int version) { return version; }
unsigned int la_objopen(struct link_map *map, Lmid_t lmid, uintptr_t *cookie) { return 3; }
uintptr_t la_symbind64(Elf64_Sym *sym, unsigned int ndx, uintptr_t *refcook, uintptr_t *defcook, unsigned int *flags, const char *symname) {
    if (strcmp(symname, "execvp") == 0) {
        printf("symbol binding for '%s'\n", symname);
    }
    return sym->st_value;
}

Any glibc release except glibc 2.35 on ARM: Symbol binding occurs repeatedly (LD_BIND_NOT)
$ LD_AUDIT=/path/to/auditlib.so LD_BIND_NOT=1 ./runevp
symbol binding for 'execvp'
symbol binding for 'execvp'
symbol binding for 'execvp'
symbol binding for 'execvp'
symbol binding for 'execvp'

glibc 2.35 on ARM: Symbol binding occurs once (ignores LD_BIND_NOT)
$ LD_AUDIT=/path/to/auditlib.so LD_BIND_NOT=1 ./runevp
symbol binding for 'execvp'

[-- Attachment #1.1.3: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 673 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

             reply	other threads:[~2022-07-04 19:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-04 19:14 Nathan Nye [this message]
2022-07-04 19:31 ` Nathan Nye
2022-07-05 14:34   ` Nathan Nye
2022-07-05 17:04     ` Adhemerval Zanella

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=055beaf8-d0ba-523b-499f-50f13834111b@whitebeamsec.com \
    --to=nnye@whitebeamsec.com \
    --cc=libc-help@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).