public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/31927] New: clang open fortify wrapper does not handle argument correctly
@ 2024-06-25 14:04 adhemerval.zanella at linaro dot org
  2024-06-25 14:48 ` [Bug libc/31927] " simon.chopin at canonical dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: adhemerval.zanella at linaro dot org @ 2024-06-25 14:04 UTC (permalink / raw)
  To: glibc-bugs

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

            Bug ID: 31927
           Summary: clang open fortify wrapper does not handle argument
                    correctly
           Product: glibc
           Version: 2.39
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: adhemerval.zanella at linaro dot org
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

For instance, building jemalloc with a clang based toolchain with glibc 2.39
shows the failures [1]:

./git/src/prof_sys.c:687:8: error: reference to overloaded function could not
be resolved; did you mean to call it?
  687 |         mfd = open(filename, O_RDONLY | O_CLOEXEC);
      |               ^~~~
../git/include/jemalloc/internal/test_hooks.h:12:35: note: expanded from macro
'open'
   12 | #  define open JEMALLOC_TEST_HOOK(open, test_hooks_libc_hook)
      |                                   ^~~~
../git/include/jemalloc/internal/test_hooks.h:10:78: note: expanded from macro
'JEMALLOC_TEST_HOOK'
   10 | #  define JEMALLOC_TEST_HOOK(fn, hook) ((void)(hook != NULL && (hook(),
0)), fn)
      |                                                                        
     ^~
TOPDIR/build/tmp/work/core2-32-yoe-linux/jemalloc/5.3.0+git/recipe-sysroot/usr/include/bits/fcntl2.h:78:1:
note: possible target for call
   78 | open (__fortify_clang_overload_arg (const char *, ,__path), int
__oflag,
      | ^
TOPDIR/build/tmp/work/core2-32-yoe-linux/jemalloc/5.3.0+git/recipe-sysroot/usr/include/bits/fcntl2.h:69:1:
note: possible target for call
   69 | open (__fortify_clang_overload_arg (const char *, ,__path), int
__oflag)
      | ^
TOPDIR/build/tmp/work/core2-32-yoe-linux/jemalloc/5.3.0+git/recipe-sysroot/usr/include/bits/fcntl2.h:65:1:
note: possible target for call
   65 | open (const char *__path, int __oflag, mode_t __mode, ...)
      | ^
TOPDIR/build/tmp/work/core2-32-yoe-linux/jemalloc/5.3.0+git/recipe-sysroot/usr/include/fcntl.h:212:24:
note: possible target for call
  212 | extern int __REDIRECT (open, (const char *__file, int __oflag, ...),
open64)

[1] https://errors.yoctoproject.org/Errors/Details/788032/

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libc/31927] clang open fortify wrapper does not handle argument correctly
  2024-06-25 14:04 [Bug libc/31927] New: clang open fortify wrapper does not handle argument correctly adhemerval.zanella at linaro dot org
@ 2024-06-25 14:48 ` simon.chopin at canonical dot com
  2024-06-25 14:54 ` adhemerval.zanella at linaro dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: simon.chopin at canonical dot com @ 2024-06-25 14:48 UTC (permalink / raw)
  To: glibc-bugs

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

Simon Chopin <simon.chopin at canonical dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simon.chopin at canonical dot com

--- Comment #1 from Simon Chopin <simon.chopin at canonical dot com> ---
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.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libc/31927] clang open fortify wrapper does not handle argument correctly
  2024-06-25 14:04 [Bug libc/31927] New: clang open fortify wrapper does not handle argument correctly adhemerval.zanella at linaro dot org
  2024-06-25 14:48 ` [Bug libc/31927] " simon.chopin at canonical dot com
@ 2024-06-25 14:54 ` adhemerval.zanella at linaro dot org
  2024-06-27 16:35 ` adhemerval.zanella at linaro dot org
  2024-06-27 16:36 ` adhemerval.zanella at linaro dot org
  3 siblings, 0 replies; 5+ messages in thread
From: adhemerval.zanella at linaro dot org @ 2024-06-25 14:54 UTC (permalink / raw)
  To: glibc-bugs

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libc/31927] clang open fortify wrapper does not handle argument correctly
  2024-06-25 14:04 [Bug libc/31927] New: clang open fortify wrapper does not handle argument correctly adhemerval.zanella at linaro dot org
  2024-06-25 14:48 ` [Bug libc/31927] " simon.chopin at canonical dot com
  2024-06-25 14:54 ` adhemerval.zanella at linaro dot org
@ 2024-06-27 16:35 ` adhemerval.zanella at linaro dot org
  2024-06-27 16:36 ` adhemerval.zanella at linaro dot org
  3 siblings, 0 replies; 5+ messages in thread
From: adhemerval.zanella at linaro dot org @ 2024-06-27 16:35 UTC (permalink / raw)
  To: glibc-bugs

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

Adhemerval Zanella <adhemerval.zanella at linaro dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
           Assignee|unassigned at sourceware dot org   |adhemerval.zanella at linaro dot o
                   |                            |rg
             Status|NEW                         |RESOLVED
   Target Milestone|---                         |2.40

--- Comment #3 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
Fixed on 2.40.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libc/31927] clang open fortify wrapper does not handle argument correctly
  2024-06-25 14:04 [Bug libc/31927] New: clang open fortify wrapper does not handle argument correctly adhemerval.zanella at linaro dot org
                   ` (2 preceding siblings ...)
  2024-06-27 16:35 ` adhemerval.zanella at linaro dot org
@ 2024-06-27 16:36 ` adhemerval.zanella at linaro dot org
  3 siblings, 0 replies; 5+ messages in thread
From: adhemerval.zanella at linaro dot org @ 2024-06-27 16:36 UTC (permalink / raw)
  To: glibc-bugs

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

Adhemerval Zanella <adhemerval.zanella at linaro dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|2.39                        |2.40

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-06-27 16:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-25 14:04 [Bug libc/31927] New: clang open fortify wrapper does not handle argument correctly adhemerval.zanella at linaro dot org
2024-06-25 14:48 ` [Bug libc/31927] " simon.chopin at canonical dot com
2024-06-25 14:54 ` adhemerval.zanella at linaro dot org
2024-06-27 16:35 ` adhemerval.zanella at linaro dot org
2024-06-27 16:36 ` adhemerval.zanella at linaro dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).