fake-uname: fix gcc argument order and improve preloaded shared library
This includes recent changes as integrated at https://github.com/sipwise/deployment-iso Makefile: - Fix gcc argument order: newer gcc versions have become more picky on their argument order, due to the --as-needed default, and require the libraries to be linked to, to be passed after the code/objects that use them, otherwise they will get dropped as unused. This change is required for compiling with gcc v10.2.1-6 as present on Debian/bullseye (otherwise fails to execute with `undefined symbol: dlsym`) - Add `make check` target to run some basic tests - Also get rid of *.o *.so files in clean target, adjust targets accordingly to always clean and then build fake-uname.so afterwards - Mark as serial-only via .NOTPARALLEL fake-uname.c: - Use hidden visibility by default, and export the symbol explicitly. - Resolve real_uname() only once. - Return early if the real_uname() fails, to avoid acting on bogus data. - Call dlerror() before dlsym() to clear any previous errors. - Compute the release member size from the utsname struct instead of hard-coding it. - Always NUL-terminate the relese buffer, so protect against very long environment strings. - Make various variables into const. Acked-by:Guillem Jover <gjover@sipwise.com> Thanks: Guillem Jover
parent
72ce6b64
Please register or sign in to comment