Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSAN + getservbyname() #1138

Open
kevgs opened this issue Aug 28, 2019 · 4 comments
Open

MSAN + getservbyname() #1138

kevgs opened this issue Aug 28, 2019 · 4 comments

Comments

@kevgs
Copy link

kevgs commented Aug 28, 2019

Hi.

#include <stdlib.h>
#include <netdb.h>

int main() {
  getservbyname("foo", NULL);
}
clang -g -fno-omit-frame-pointer -Wall -fsanitize=memory -fPIE -pie 1.c && ./a.out
Uninitialized bytes in __interceptor_strlen at offset 0 inside [0x718000000000, 49)
==1853==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x7fa2ba363cff in _nss_files_parse_servent /build/glibc-KRRWSm/glibc-2.29/nss/nss_files/files-service.c:32:1
    #1 0x7fa2ba363e6c in internal_getent /build/glibc-KRRWSm/glibc-2.29/nss/nss_files/files-XXX.c:182:22
    #2 0x7fa2ba36412e in _nss_files_getservbyname_r /build/glibc-KRRWSm/glibc-2.29/nss/nss_files/files-service.c:41:1
    #3 0x7fa2bb330f12 in getservbyname_r /build/glibc-KRRWSm/glibc-2.29/inet/../nss/getXXbyYY_r.c:315:16
    #4 0x7fa2bb330cb2 in getservbyname /build/glibc-KRRWSm/glibc-2.29/inet/../nss/getXXbyYY.c:135:7
    #5 0x56423b778467 in main /home/kevg/fun/cpp_projects/1.c:5:3
    #6 0x7fa2bb224b6a in __libc_start_main /build/glibc-KRRWSm/glibc-2.29/csu/../csu/libc-start.c:308:16
    #7 0x56423b6ff279 in _start (/home/kevg/fun/cpp_projects/a.out+0x1d279)

SUMMARY: MemorySanitizer: use-of-uninitialized-value /build/glibc-KRRWSm/glibc-2.29/nss/nss_files/files-service.c:32:1 in _nss_files_parse_servent
Exiting

I'd like to use getservbyname() with MSAN. Am I understand correct that it is missing interceptor? Or could this be a bug inside GNU libc?

@eugenis
Copy link
Contributor

eugenis commented Aug 28, 2019 via email

@kevgs
Copy link
Author

kevgs commented Aug 28, 2019

Thanks for your answer!
You mean my source code or it's not possible to add such interceptor to compiler-rt?

@eugenis
Copy link
Contributor

eugenis commented Aug 28, 2019 via email

@georgthegreat
Copy link

@eugenis, could you, please give an update on the subject?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants