This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: libsanitizer in GCC 10 is dropping symbols without bumping the soversions
- From: Martin Liška <mliska at suse dot cz>
- To: Jakub Jelinek <jakub at redhat dot com>, Matthias Klose <doko at ubuntu dot com>
- Cc: gcc Development <gcc at gcc dot gnu dot org>
- Date: Fri, 29 Nov 2019 13:07:05 +0100
- Subject: Re: libsanitizer in GCC 10 is dropping symbols without bumping the soversions
- References: <eeedba55-46e6-be8d-ca1b-7ed37f22d508@ubuntu.com> <20191129114752.GK10088@tucnak>
On 11/29/19 12:47 PM, Jakub Jelinek wrote:
__ubsan_handle_function_type_mismatch* is something we don't use (Martin,
should we add such sanitizer? We have gimple_call_fntype vs. actual decl
types, but it would need some inspection on what the sanitizer really does),
but still e.g. clang compiled binaries could and could be (at least in
theory) be linked against gcc libubsan.
Yes, we can add it for GCC 11. The sanitizer is about:
$ cat indirect.C
int foo(int a)
{
return a;
}
void bar(int (*fn) (void))
{
fn();
}
int main()
{
bar(reinterpret_cast<int (*)(void)> (foo));
}
$ clang++ indirect.C -fsanitize=function && ./a.out
indirect.C:8:3: runtime error: call to function foo(int) through pointer to incorrect function type 'int (*)()'
(/tmp/a.out+0x424c60): note: foo(int) defined here
#0 0x424cfb in bar(int (*)()) (/tmp/a.out+0x424cfb)
#1 0x424d2d in main (/tmp/a.out+0x424d2d)
#2 0x7f2e8bbfee0a in __libc_start_main /usr/src/debug/glibc-2.30-1.2.x86_64/csu/../csu/libc-start.c:308:16
#3 0x403309 in _start /home/abuild/rpmbuild/BUILD/glibc-2.30/csu/../sysdeps/x86_64/start.S:120
static bool handleFunctionTypeMismatch(FunctionTypeMismatchData *Data,
ValueHandle Function,
ValueHandle calleeRTTI,
ValueHandle fnRTTI, ReportOptions Opts) {
if (checkTypeInfoEquality(reinterpret_cast<void *>(calleeRTTI),
reinterpret_cast<void *>(fnRTTI)))
return false;
So it should be quite trivial as we're already using checkTypeInfoEquality in
bool __ubsan::checkDynamicType(void *Object, void *Type, HashValue Hash) {
Martin