You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
following instructions by https://cloud.tencent.com/developer/article/2278480 using branch dev
But got compile errors:
./ff_declare_syscalls.h:25:22: error: conflicting types for ‘ioctl’; have ‘int(int, long unsigned int, long unsigned int)’
25 | FF_SYSCALL_DECL(int, ioctl, (int, unsigned long, unsigned long));
| ^~~~~
ff_hook_syscall.c:37:28: note: in definition of macro ‘strong_alias’
37 | extern __typeof (name) aliasname attribute ((alias (#name)));
| ^~~~~~~~~
./ff_declare_syscalls.h:25:1: note: in expansion of macro ‘FF_SYSCALL_DECL’
25 | FF_SYSCALL_DECL(int, ioctl, (int, unsigned long, unsigned long));
| ^~~~~~~~~~~~~~~
In file included from /usr/include/sys/epoll.h:22,
from ff_hook_syscall.c:4:
/usr/include/sys/ioctl.h:42:12: note: previous declaration of ‘ioctl’ with type ‘int(int, long unsigned int, ...)’
42 | extern int ioctl (int __fd, unsigned long int __request, ...) __THROW;
| ^~~~~
make: *** [Makefile:129: ff_hook_syscall.o] Error 1
uname -r
5.15.178-120.180.amzn2.x86_64
It looks to me ioctl has always been variable paramerters. int ioctl (int __fd, unsigned long int __request, ...) https://man7.org/linux/man-pages/man2/ioctl.2.html
I am wondering how actually does this work, and any expert could help fix this?
The compile error is caused by a type conflict in adapter/syscall/ff_declare_syscalls.h:
// Current declaration in f-stack (fixed args):FF_SYSCALL_DECL(int, ioctl, (int, unsigned long, unsigned long));
// glibc standard declaration (variadic):externintioctl (int__fd, unsigned long int__request, ...) __THROW;
The strong_alias macro expands this into a function declaration with fixed parameters (int, unsigned long, unsigned long), which conflicts with glibc's variadic ioctl(int, unsigned long, ...).
Newer GCC versions (especially on Amazon Linux 2 / kernel 5.15+) enforce stricter type-checking for __attribute__((alias(...))), causing this error to surface.
Current Status:
This issue has not yet been fixed in the dev branch. The ff_declare_syscalls.h file was last modified on 2025-06-08 (only added select support), but the ioctl declaration remains unchanged.
Suggested Fix:
Since ioctl is truly variadic in practice, the cleanest fix is to handle it separately rather than through FF_SYSCALL_DECL. One approach:
Remove ioctl from ff_declare_syscalls.h
Declare the alias manually using a wrapper that matches the variadic signature, e.g.:
// In ff_hook_syscall.c, replace the macro-generated alias with:intioctl(intfd, unsigned longreq, ...) __attribute__((alias("ff_hook_ioctl")));
Or alternatively, change ff_hook_ioctl to also be variadic and use va_arg to extract the third argument.
Workaround (temporary):
If you need to compile immediately, you can comment out the ioctl line in ff_declare_syscalls.h and manually add an alias declaration with variadic signature.
We will track this for a proper fix. Thanks again for the report!
The error is environment-dependent. It triggers when sys/ioctl.h is pulled in transitively (via epoll.h or other headers) before the strong_alias macro expansion in ff_hook_syscall.c.
On older glibc (≤ 2.26, e.g. Amazon Linux 2): epoll.h indirectly includes ioctl.h, so ioctl is already declared as variadic when FF_SYSCALL_DECL(int, ioctl, ...) expands → compile error.
On newer glibc (≥ 2.38, e.g. TencentOS/Ubuntu 22+): epoll.h does not include ioctl.h → no conflict → compiles fine.
The underlying issue is that ioctl(2) has a variadic signature in glibc:
externintioctl(int__fd, unsigned long int__request, ...) __THROW;
but ff_declare_syscalls.h registered it as a fixed-arg function, which is incompatible with strong_alias / __typeof on systems where the variadic declaration is already visible.
Fix Summary (4 files)
File
Change
ff_declare_syscalls.h
Remove FF_SYSCALL_DECL(int, ioctl, ...)
ff_hook_syscall.c
Add explicit variadic ioctl() wrapper using va_arg, forwarding to ff_hook_ioctl()
ff_linux_syscall.h
Add explicit declaration of ff_linux_ioctl()
ff_linux_syscall.c
Add manual pf_ioctl struct member and dlsym("ioctl") load
Temporary Workaround
If you need to compile immediately before the PR is merged, add #include <sys/ioctl.h> at the top of your application and apply a local patch removing the ioctl line from ff_declare_syscalls.h.
PR #1047 was closed due to incorrect base branch. The correct fix is in PR #1048.
Root Cause (clarified)
The error is environment-dependent. It triggers when sys/ioctl.h is pulled in transitively (via epoll.h or other headers) before the strong_alias macro expansion in ff_hook_syscall.c.
On older glibc (≤ 2.26, e.g. Amazon Linux 2): epoll.h indirectly includes ioctl.h, so ioctl is already declared as variadic when FF_SYSCALL_DECL(int, ioctl, ...) expands → compile error.
On newer glibc (≥ 2.38, e.g. TencentOS/Ubuntu 22+): epoll.h does not include ioctl.h → no conflict → compiles fine.
The underlying issue is that ioctl(2) has a variadic signature in glibc:
externintioctl(int__fd, unsigned long int__request, ...) __THROW;
but ff_declare_syscalls.h registered it as a fixed-arg function, which is incompatible with strong_alias / __typeof on systems where the variadic declaration is already visible.
Fix Summary (4 files)
File
Change
ff_declare_syscalls.h
Remove FF_SYSCALL_DECL(int, ioctl, ...)
ff_hook_syscall.c
Add explicit variadic ioctl() wrapper using va_arg, forwarding to ff_hook_ioctl()
ff_linux_syscall.h
Add explicit declaration of ff_linux_ioctl()
ff_linux_syscall.c
Add manual pf_ioctl struct member and dlsym("ioctl") load
Temporary Workaround
If you need to compile immediately before the PR is merged, remove the ioctl line from ff_declare_syscalls.h and apply the changes from PR #1048 manually.
[Manual comment] The above AI analysis of the compile error root cause is not something I fully agree with. The part about build environment differences is correct, but I disagree with the claim that older glibc header trees are responsible. My personal view is that this is more likely a bug in GCC 7.3.1 (the default compiler on Amazon Linux 2), as in my experience that version has known issues with insufficiently precise data-flow analysis that frequently produces false-positive errors.
Activity
jfb8856606 commentedon Mar 16, 2026
Thank you for the detailed report!
Root Cause Analysis:
The compile error is caused by a type conflict in
adapter/syscall/ff_declare_syscalls.h:The
strong_aliasmacro expands this into a function declaration with fixed parameters(int, unsigned long, unsigned long), which conflicts with glibc's variadicioctl(int, unsigned long, ...).Newer GCC versions (especially on Amazon Linux 2 / kernel 5.15+) enforce stricter type-checking for
__attribute__((alias(...))), causing this error to surface.Current Status:
This issue has not yet been fixed in the
devbranch. Theff_declare_syscalls.hfile was last modified on 2025-06-08 (only addedselectsupport), but theioctldeclaration remains unchanged.Suggested Fix:
Since
ioctlis truly variadic in practice, the cleanest fix is to handle it separately rather than throughFF_SYSCALL_DECL. One approach:ioctlfromff_declare_syscalls.hOr alternatively, change
ff_hook_ioctlto also be variadic and useva_argto extract the third argument.Workaround (temporary):
If you need to compile immediately, you can comment out the
ioctlline inff_declare_syscalls.hand manually add an alias declaration with variadic signature.We will track this for a proper fix. Thanks again for the report!
adapter/syscall: fix ioctl conflicting types compile error (F-Stack#942)
adapter/syscall: fix ioctl conflicting types compile error (F-Stack#942)
adapter/syscall: fix ioctl conflicting types compile error (F-Stack#942)
adapter/syscall: fix ioctl conflicting types compile error (F-Stack#942)
jfb8856606 commentedon Mar 17, 2026
Fix Available — PR #1047
A fix has been submitted in PR #1047.
Root Cause (clarified)
The error is environment-dependent. It triggers when
sys/ioctl.his pulled in transitively (viaepoll.hor other headers) before thestrong_aliasmacro expansion inff_hook_syscall.c.epoll.hindirectly includesioctl.h, soioctlis already declared as variadic whenFF_SYSCALL_DECL(int, ioctl, ...)expands → compile error.epoll.hdoes not includeioctl.h→ no conflict → compiles fine.The underlying issue is that
ioctl(2)has a variadic signature in glibc:but
ff_declare_syscalls.hregistered it as a fixed-arg function, which is incompatible withstrong_alias/__typeofon systems where the variadic declaration is already visible.Fix Summary (4 files)
ff_declare_syscalls.hFF_SYSCALL_DECL(int, ioctl, ...)ff_hook_syscall.cioctl()wrapper usingva_arg, forwarding toff_hook_ioctl()ff_linux_syscall.hff_linux_ioctl()ff_linux_syscall.cpf_ioctlstruct member anddlsym("ioctl")loadTemporary Workaround
If you need to compile immediately before the PR is merged, add
#include <sys/ioctl.h>at the top of your application and apply a local patch removing theioctlline fromff_declare_syscalls.h.adapter/syscall: fix ioctl conflicting types compile error (#942)
adapter/syscall: fix ioctl conflicting types compile error (#942)
adapter/syscall: fix ioctl conflicting types compile error (#942)
adapter/syscall: fix ioctl conflicting types compile error (#942)
jfb8856606 commentedon Mar 17, 2026
Fix Available — PR #1048
Root Cause (clarified)
The error is environment-dependent. It triggers when
sys/ioctl.his pulled in transitively (viaepoll.hor other headers) before thestrong_aliasmacro expansion inff_hook_syscall.c.epoll.hindirectly includesioctl.h, soioctlis already declared as variadic whenFF_SYSCALL_DECL(int, ioctl, ...)expands → compile error.epoll.hdoes not includeioctl.h→ no conflict → compiles fine.The underlying issue is that
ioctl(2)has a variadic signature in glibc:but
ff_declare_syscalls.hregistered it as a fixed-arg function, which is incompatible withstrong_alias/__typeofon systems where the variadic declaration is already visible.Fix Summary (4 files)
ff_declare_syscalls.hFF_SYSCALL_DECL(int, ioctl, ...)ff_hook_syscall.cioctl()wrapper usingva_arg, forwarding toff_hook_ioctl()ff_linux_syscall.hff_linux_ioctl()ff_linux_syscall.cpf_ioctlstruct member anddlsym("ioctl")loadTemporary Workaround
If you need to compile immediately before the PR is merged, remove the
ioctlline fromff_declare_syscalls.hand apply the changes from PR #1048 manually.jfb8856606 commentedon Mar 17, 2026
PR #1048 已合并(merge commit: 2958b02),修复了 ioctl conflicting types 在旧版 glibc 上的编译错误,此 issue 现在关闭。
jfb8856606 commentedon Mar 18, 2026
[Manual comment] The above AI analysis of the compile error root cause is not something I fully agree with. The part about build environment differences is correct, but I disagree with the claim that older glibc header trees are responsible. My personal view is that this is more likely a bug in GCC 7.3.1 (the default compiler on Amazon Linux 2), as in my experience that version has known issues with insufficiently precise data-flow analysis that frequently produces false-positive errors.
doc(adapter/syscall): refresh LD_PRELOAD README with feature updates …