diff mbox series

debug: Fix clang mq_open fortify wrapper (BZ 31927)

Message ID 20240625145723.596466-1-adhemerval.zanella@linaro.org
State New
Headers show
Series debug: Fix clang mq_open fortify wrapper (BZ 31927) | expand

Commit Message

Adhemerval Zanella Netto June 25, 2024, 2:57 p.m. UTC
The fcntl.h fortify wrapper for clang added by 86889e22db329abac61
missed the __fortify_clang_overload_arg and and also added the
mode argument for the __fortify_function_error_function function,
which leads clang to be able to correct resolve which overloaded
function it should emit.

Checked on x86_64-linux-gnu.

Reported-by: Khem Raj <raj.khem@gmail.com>
---
 io/bits/fcntl2.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Adhemerval Zanella Netto June 25, 2024, 8:25 p.m. UTC | #1
I forgot to update the title, where 'mq_open' should be 'open'.

On 25/06/24 11:57, Adhemerval Zanella wrote:
> The fcntl.h fortify wrapper for clang added by 86889e22db329abac61
> missed the __fortify_clang_overload_arg and and also added the
> mode argument for the __fortify_function_error_function function,
> which leads clang to be able to correct resolve which overloaded
> function it should emit.
> 
> Checked on x86_64-linux-gnu.
> 
> Reported-by: Khem Raj <raj.khem@gmail.com>
> ---
>  io/bits/fcntl2.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> 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
Khem Raj June 26, 2024, 3:45 p.m. UTC | #2
On Tue, Jun 25, 2024 at 7:57 AM Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
>
> The fcntl.h fortify wrapper for clang added by 86889e22db329abac61
> missed the __fortify_clang_overload_arg and and also added the
> mode argument for the __fortify_function_error_function function,
> which leads clang to be able to correct resolve which overloaded
> function it should emit.
>
> Checked on x86_64-linux-gnu.

LGTM

Tested-by: Khem Raj <raj.khem@gmail.com>

>
> Reported-by: Khem Raj <raj.khem@gmail.com>
> ---
>  io/bits/fcntl2.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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
> --
> 2.43.0
>
Adhemerval Zanella Netto June 27, 2024, 1:23 p.m. UTC | #3
On 26/06/24 12:45, Khem Raj wrote:
> On Tue, Jun 25, 2024 at 7:57 AM Adhemerval Zanella
> <adhemerval.zanella@linaro.org> wrote:
>>
>> The fcntl.h fortify wrapper for clang added by 86889e22db329abac61
>> missed the __fortify_clang_overload_arg and and also added the
>> mode argument for the __fortify_function_error_function function,
>> which leads clang to be able to correct resolve which overloaded
>> function it should emit.
>>
>> Checked on x86_64-linux-gnu.
> 
> LGTM
> 
> Tested-by: Khem Raj <raj.khem@gmail.com>
> 

Thanks, if no one opposes it I will commit this shortly (with the
commit message corrected).

>>
>> Reported-by: Khem Raj <raj.khem@gmail.com>
>> ---
>>  io/bits/fcntl2.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> 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
>> --
>> 2.43.0
>>
diff mbox series

Patch

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