From: Shuah Khan <skhan@linuxfoundation.org>
To: Nirbhay Sharma <nirbhay.lkd@gmail.com>, Kees Cook <kees@kernel.org>
Cc: Andy Lutomirski <luto@amacapital.net>,
Will Drewry <wad@chromium.org>,
Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <nick.desaulniers+lkml@gmail.com>,
Bill Wendling <morbo@google.com>,
Justin Stitt <justinstitt@google.com>,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
bpf@vger.kernel.org, llvm@lists.linux.dev, khalid@kernel.org,
david.hunter.linux@gmail.com, Jiri Olsa <olsajiri@gmail.com>,
sam@gentoo.org, shuah <shuah@kernel.org>,
Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH v2] selftests/seccomp: fix pointer type mismatch in UPROBE test
Date: Wed, 3 Dec 2025 08:59:18 -0700 [thread overview]
Message-ID: <a5a1d7bf-04b0-43fb-8f93-781c3534d8fd@linuxfoundation.org> (raw)
In-Reply-To: <8e1ff2f1-b45e-4b1f-b545-d433e277607f@gmail.com>
On 11/25/25 04:20, Nirbhay Sharma wrote:
>
>
> On 10/26/25 2:42 PM, Nirbhay Sharma wrote:
>> Fix compilation error in UPROBE_setup caused by pointer type mismatch
>> in the ternary expression when compiled with -fcf-protection. The
>> probed_uprobe function pointer has the __attribute__((nocf_check))
>> attribute, which causes the conditional operator to fail when combined
>> with the regular probed_uretprobe function pointer:
>>
>> seccomp_bpf.c:5175:74: error: pointer type mismatch in conditional
>> expression [-Wincompatible-pointer-types]
>>
>> Cast both function pointers to 'const void *' to match the expected
>> parameter type of get_uprobe_offset(), resolving the type mismatch
>> while preserving the function selection logic.
>>
>> This error appears with compilers that enable Control Flow Integrity
>> (CFI) protection via -fcf-protection, such as Clang 19.1.2 (default
>> on Fedora).
>>
>> Signed-off-by: Nirbhay Sharma <nirbhay.lkd@gmail.com>
>> ---
>> tools/testing/selftests/seccomp/seccomp_bpf.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
>> index 874f17763536..e13ffe18ef95 100644
>> --- a/tools/testing/selftests/seccomp/seccomp_bpf.c
>> +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
>> @@ -5172,7 +5172,8 @@ FIXTURE_SETUP(UPROBE)
>> ASSERT_GE(bit, 0);
>> }
>> - offset = get_uprobe_offset(variant->uretprobe ? probed_uretprobe : probed_uprobe);
>> + offset = get_uprobe_offset(variant->uretprobe ?
>> + (const void *)probed_uretprobe : (const void *)probed_uprobe);
>> ASSERT_GE(offset, 0);
>> if (variant->uretprobe)
>
> Hi all,
>
> I'm following up on this patch that fixes the pointer type mismatch in
> UPROBE_setup when building with -fcf-protection. It resolves the
> incompatible-pointer-types error seen with Clang 19.
>
> Please let me know if there are any comments or some changes needed.
>
Hi Kees,
Is it okay to take this patch through my tree?
thanks,
-- Shuah
prev parent reply other threads:[~2025-12-03 15:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-25 18:49 [PATCH] selftests/seccomp: fix pointer type mismatch in UPROBE test Nirbhay Sharma
2025-10-25 21:18 ` Jiri Olsa
2025-10-26 0:25 ` Sam James
2025-10-26 8:58 ` Nirbhay Sharma
2025-10-26 9:12 ` [PATCH v2] " Nirbhay Sharma
2025-10-26 10:44 ` Sam James
2025-10-27 8:14 ` Jiri Olsa
2025-11-25 11:20 ` Nirbhay Sharma
2025-12-03 15:59 ` Shuah Khan [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a5a1d7bf-04b0-43fb-8f93-781c3534d8fd@linuxfoundation.org \
--to=skhan@linuxfoundation.org \
--cc=bpf@vger.kernel.org \
--cc=david.hunter.linux@gmail.com \
--cc=justinstitt@google.com \
--cc=kees@kernel.org \
--cc=khalid@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=luto@amacapital.net \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=nick.desaulniers+lkml@gmail.com \
--cc=nirbhay.lkd@gmail.com \
--cc=olsajiri@gmail.com \
--cc=sam@gentoo.org \
--cc=shuah@kernel.org \
--cc=wad@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox