[Bug libc/31927] clang open fortify wrapper does not handle argument correctly

adhemerval.zanella at linaro dot org sourceware-bugzilla@sourceware.org
Tue Jun 25 14:54:14 GMT 2024


https://sourceware.org/bugzilla/show_bug.cgi?id=31927

--- Comment #2 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
(In reply to Simon Chopin from comment #1)
> Not sure, but this patch might help with this:
> 
> https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/glibc/tree/debian/
> patches/ubuntu/fix-fortify-source.patch
> 
> I still need to find the time to submit it properly.

The open fortify wrapper is not fully corrected I see the failures being
corrected with the fix:

diff --git a/io/bits/fcntl2.h b/io/bits/fcntl2.h
index 26f1792fd1..c8888b50c1 100644
--- a/io/bits/fcntl2.h
+++ b/io/bits/fcntl2.h
@@ -62,7 +62,7 @@ open (const char *__path, int __oflag, ...)
 }
 #elif __fortify_use_clang
 __fortify_function_error_function __attribute_overloadable__ int
-open (const char *__path, int __oflag, mode_t __mode, ...)
+open (__fortify_clang_overload_arg (const char *, ,__path), int __oflag, ...)
      __fortify_clang_unavailable ("open can be called either with 2 or 3
arguments, not more");

 __fortify_function __attribute_overloadable__ int


This Ubuntu out-of-tree patch is indeed for something different, where one can
not build glibc without adding -U_FORTIFY_SOURCE if the compiler defaults for
-D_FORTIFY_SOURCE.  I am unsure why -Wp was added in the first place since it
bypassed the compiler driver.  

Could you open another bug to track build failure if the compiler defaults to
-D_FORTIFY_SOURCE?

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Glibc-bugs mailing list