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 doesn't seem to instrument parse_printf_format #992

Open
evverx opened this issue Aug 27, 2018 · 0 comments
Open

MSan doesn't seem to instrument parse_printf_format #992

evverx opened this issue Aug 27, 2018 · 0 comments

Comments

@evverx
Copy link

evverx commented Aug 27, 2018

One of systemd fuzzers triggers a "use-of-uninitialized-value" warning, which I'm going to get around by manually initializing the array MSan is complaining about. I opened the issue here mostly because I need something to refer to in the commit message.

root@1c59ccf2eb06:/src/systemd# clang --version
clang version 7.0.0 (trunk 338452)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin

root@1c59ccf2eb06:/src/systemd# cat test.c
#include <printf.h>
#include <stdio.h>

int main(int arc, char *argv[]) {
	int _argtypes[128];
	size_t _i, _k;
	_k = parse_printf_format("%s", 128, _argtypes);
	for (_i = 0; _i < _k; _i++)
		if (_argtypes[_i] & PA_FLAG_PTR) {
			printf("Found a pointer\n");
	}
	return 0;
}

root@1c59ccf2eb06:/src/systemd# clang -fsanitize-memory-track-origins -g -fsanitize=memory ./test.c -o a.out

root@1c59ccf2eb06:/src/systemd# ./a.out
==183==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x49bdaa in main /src/systemd/./test.c:9:7
    #1 0x7f5eda5aa82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #2 0x41ae08 in _start (/src/systemd/a.out+0x41ae08)

  Uninitialized value was created by an allocation of '_argtypes' in the stack frame of function 'main'
    #0 0x49b770 in main /src/systemd/./test.c:4

SUMMARY: MemorySanitizer: use-of-uninitialized-value /src/systemd/./test.c:9:7 in main
Exiting
evverx added a commit to evverx/systemd that referenced this issue Nov 4, 2018
evverx added a commit to evverx/systemd that referenced this issue Nov 5, 2018
evverx added a commit to evverx/systemd that referenced this issue Nov 6, 2018
Yamakuzure pushed a commit to elogind/elogind that referenced this issue Feb 13, 2019
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

1 participant