0004-libsanitizer-uclibc-sock-fprog-sz.patch 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. libsanitizer: define struct_sock_fprog_sz for SANITIZER_UCLIBC
  2. struct_sock_fprog_sz is declared unconditionally for SANITIZER_LINUX in
  3. sanitizer_platform_limits_posix.h, but its definition in the .cpp is
  4. guarded by #if SANITIZER_GLIBC. With uClibc-ng (SANITIZER_GLIBC=0,
  5. SANITIZER_UCLIBC=1) the symbol is left undefined and linking any
  6. -fsanitize=address binary fails:
  7. libasan.so: undefined reference to `__sanitizer::struct_sock_fprog_sz'
  8. Fix:
  9. 1. Include <linux/filter.h> in the non-glibc Linux branch so that
  10. struct sock_fprog is available regardless of SANITIZER_GLIBC.
  11. 2. Provide the definition of struct_sock_fprog_sz guarded by
  12. SANITIZER_UCLIBC to match the unconditional header declaration.
  13. Signed-off-by: Ramin Moussavi <ramin.moussavi@yacoub.de>
  14. ---
  15. --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
  16. +++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
  17. @@ -129,6 +129,7 @@
  18. # endif
  19. # include <scsi/scsi.h>
  20. #else
  21. +#include <linux/filter.h>
  22. #include <linux/if_ppp.h>
  23. #include <linux/kd.h>
  24. #include <linux/ppp_defs.h>
  25. @@ -537,6 +538,10 @@
  26. unsigned struct_sock_fprog_sz = sizeof(struct sock_fprog);
  27. # endif // SANITIZER_GLIBC
  28. +#if SANITIZER_UCLIBC
  29. + unsigned struct_sock_fprog_sz = sizeof(struct sock_fprog);
  30. +#endif
  31. +
  32. # if !SANITIZER_ANDROID && !SANITIZER_APPLE
  33. unsigned struct_sioc_sg_req_sz = sizeof(struct sioc_sg_req);
  34. unsigned struct_sioc_vif_req_sz = sizeof(struct sioc_vif_req);