auditsc: Implement a workaround for a GCC bug triggered by task comm changes
PATCH 1/1 auditsc: Implement a workaround for a GCC bug triggered by task comm changes
From: Yafang shao <[email protected]>
A build failure has been reported with the following details:
In file included from include/linux/string.h:390,
from include/linux/bitmap.h:13, from include/linux/cpumask.h:12, from include/linux/smp.h:13, from include/linux/lockdep.h:14, from include/linux/spinlock.h:63, from include/linux/wait.h:9, from include/linux/wait_bit.h:8, from include/linux/fs.h:6, from kernel/auditsc.c:37:
In function 'sized_strscpy',
inlined from '__audit_ptrace' at kernel/auditsc.c:2732:2:
Quoted 1 line
Quoted 1 line
include/linux/fortify-string.h:293:17: error: call to '__write_overflow' declared with attribute error: detected write beyond size of object (1st parameter)
293 | __write_overflow();
| ^~~~~~~~~~~~~~~~~~ In function 'sized_strscpy',
inlined from 'audit_signal_info_syscall' at kernel/auditsc.c:2759:3:
Quoted 1 line
Quoted 1 line
include/linux/fortify-string.h:293:17: error: call to '__write_overflow' declared with attribute error: detected write beyond size of object (1st parameter)
293 | __write_overflow();
| ^~~~~~~~~~~~~~~~~~The issue appears to be a GCC bug, though the root cause remains unclear at this time. For now, let's implement a workaround.
--- kernel/auditsc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/auditsc.c +2 -2
@@ -2728,8 +2728,8 @@ void __audit_ptrace(struct task_struct *t) context->target_auid =audit_get_loginuid (t); context->target_uid =task_uid (t); context->target_sessionid =audit_get_sessionid (t); -security_task_getlsmprop_obj (t, &context->target_ref);strscpy (context->target_comm, t->comm); +security_task_getlsmprop_obj (t, &context->target_ref); }/**
@@ -2755,8 +2755,8 @@ int audit_signal_info_syscall(struct task_struct *t) ctx->target_auid =audit_get_loginuid (t); ctx->target_uid = t_uid; ctx->target_sessionid =audit_get_sessionid (t); -security_task_getlsmprop_obj (t, &ctx->target_ref);strscpy (ctx->target_comm, t->comm); +security_task_getlsmprop_obj (t, &ctx->target_ref);return 0 ; }
Signature · 1 line
2.43.5
Paul Moore
maintainerQuoted 39 lines · Yafang Shao
From: Yafang shao <[email protected]>
A build failure has been reported with the following details:
In file included from
include/linux/string.h:390,
frominclude/linux/bitmap.h:13, frominclude/linux/cpumask.h:12, frominclude/linux/smp.h:13, frominclude/linux/lockdep.h:14, frominclude/linux/spinlock.h:63, frominclude/linux/wait.h:9, frominclude/linux/wait_bit.h:8, frominclude/linux/fs.h:6, fromkernel/auditsc.c:37:
In function 'sized_strscpy',inlined from '__audit_ptrace' at kernel/auditsc.c:2732:2:Quoted 1 line
Quoted 1 line
include/linux/fortify-string.h:293:17: error: call to '__write_overflow' declared with attribute error: detected write beyond size of object (1st parameter)293 | __write_overflow(); | ^~~~~~~~~~~~~~~~~~In function '
sized_strscpy',
inlined from 'audit_signal_info_syscall' atkernel/auditsc.c:2759:3:Quoted 1 line
Quoted 1 line
include/linux/fortify-string.h:293:17: error: call to '__write_overflow' declared with attribute error: detected write beyond size of object (1st parameter)293 | __write_overflow(); | ^~~~~~~~~~~~~~~~~~The issue appears to be a GCC bug, though the root cause remains unclear at this time. For now, let's implement a workaround.
Reported-by kernel test robot <[email protected]>Reported-by Steven Rostedt (Google) <[email protected]>Reported-by "Zhuo, Qiuxu" <[email protected]>Closes https://lore.kernel.org/all/CY8PR11MB71348E568DBDA576F17DAFF389362@CY8PR11MB7134.namprd11.prod.outlook.com/ open hereOriginally-by Kees Cook <[email protected]>Signed-off-by Yafang shao <[email protected]>
Quoted 3 lines
--- kernel/auditsc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Thanks, does anyone have a link to the GCC bug report? We really should mention that in the commit description and/or metadata.
Quoted 26 lines
kernel/auditsc.c +2
-3@@ -2728,8 +2728,8 @@ void __audit_ptrace(struct task_struct *t) context->target_auid =audit_get_loginuid (t); context->target_uid =task_uid (t); context->target_sessionid =audit_get_sessionid (t); -security_task_getlsmprop_obj (t, &context->target_ref);strscpy (context->target_comm, t->comm); +security_task_getlsmprop_obj (t, &context->target_ref); }/** @@ -2755,8 +2755,8 @@ int audit_signal_info_syscall(struct task_struct *t) ctx->target_auid =audit_get_loginuid (t); ctx->target_uid = t_uid; ctx->target_sessionid =audit_get_sessionid (t); -security_task_getlsmprop_obj (t, &ctx->target_ref);strscpy (ctx->target_comm, t->comm); +security_task_getlsmprop_obj (t, &ctx->target_ref);return 0 ; } --2.43.5
Signature · 1 line
paul-moore.com
Quoted 45 lines · Paul Moore
Quoted 39 lines · Yafang Shao
From: Yafang shao <[email protected]>
A build failure has been reported with the following details:
In file included from
include/linux/string.h:390,
frominclude/linux/bitmap.h:13, frominclude/linux/cpumask.h:12, frominclude/linux/smp.h:13, frominclude/linux/lockdep.h:14, frominclude/linux/spinlock.h:63, frominclude/linux/wait.h:9, frominclude/linux/wait_bit.h:8, frominclude/linux/fs.h:6, fromkernel/auditsc.c:37:
In function 'sized_strscpy',inlined from '__audit_ptrace' at kernel/auditsc.c:2732:2:Quoted 1 line
Quoted 1 line
include/linux/fortify-string.h:293:17: error: call to '__write_overflow' declared with attribute error: detected write beyond size of object (1st parameter)293 | __write_overflow(); | ^~~~~~~~~~~~~~~~~~In function '
sized_strscpy',
inlined from 'audit_signal_info_syscall' atkernel/auditsc.c:2759:3:Quoted 1 line
Quoted 1 line
include/linux/fortify-string.h:293:17: error: call to '__write_overflow' declared with attribute error: detected write beyond size of object (1st parameter)293 | __write_overflow(); | ^~~~~~~~~~~~~~~~~~The issue appears to be a GCC bug, though the root cause remains unclear at this time. For now, let's implement a workaround.
Reported-by kernel test robot <[email protected]>Reported-by Steven Rostedt (Google) <[email protected]>Reported-by "Zhuo, Qiuxu" <[email protected]>Closes https://lore.kernel.org/all/CY8PR11MB71348E568DBDA576F17DAFF389362@CY8PR11MB7134.namprd11.prod.outlook.com/ open hereOriginally-by Kees Cook <[email protected]>Signed-off-by Yafang shao <[email protected]>Quoted 3 lines
--- kernel/auditsc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 2 lines
Thanks, does anyone have a link to the GCC bug report? We really should mention that in the commit description and/or metadata.
I came across a GCC bug report [0] while researching online. This issue was reportedly fixed in GCC-12.1 [1], yet it seems the same bug is still being triggered in GCC-14.2.0[2].
Should I file a new bug report with GCC to address this?
[0] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101941
[1] https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=76fe494230477a69f8fa8c8ca2d493acaf343eb1
[2] https://lore.kernel.org/all/[email protected]/
--
Regards
Yafang
Paul Moore
maintainerQuoted 45 lines · Yafang Shao
Quoted 44 lines · Paul Moore
Quoted 42 lines · Yafang Shao
From: Yafang shao <[email protected]>
A build failure has been reported with the following details:
In file included from
include/linux/string.h:390,
frominclude/linux/bitmap.h:13, frominclude/linux/cpumask.h:12, frominclude/linux/smp.h:13, frominclude/linux/lockdep.h:14, frominclude/linux/spinlock.h:63, frominclude/linux/wait.h:9, frominclude/linux/wait_bit.h:8, frominclude/linux/fs.h:6, fromkernel/auditsc.c:37:
In function 'sized_strscpy',inlined from '__audit_ptrace' at kernel/auditsc.c:2732:2:Quoted 1 line
Quoted 1 line
include/linux/fortify-string.h:293:17: error: call to '__write_overflow' declared with attribute error: detected write beyond size of object (1st parameter)293 | __write_overflow(); | ^~~~~~~~~~~~~~~~~~In function '
sized_strscpy',
inlined from 'audit_signal_info_syscall' atkernel/auditsc.c:2759:3:Quoted 1 line
Quoted 1 line
include/linux/fortify-string.h:293:17: error: call to '__write_overflow' declared with attribute error: detected write beyond size of object (1st parameter)293 | __write_overflow(); | ^~~~~~~~~~~~~~~~~~The issue appears to be a GCC bug, though the root cause remains unclear at this time. For now, let's implement a workaround.
Reported-by kernel test robot <[email protected]>Reported-by Steven Rostedt (Google) <[email protected]>Reported-by "Zhuo, Qiuxu" <[email protected]>Closes https://lore.kernel.org/all/CY8PR11MB71348E568DBDA576F17DAFF389362@CY8PR11MB7134.namprd11.prod.outlook.com/ open hereOriginally-by Kees Cook <[email protected]>Signed-off-by Yafang shao <[email protected]>--- kernel/auditsc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 7 lines
Quoted 2 lines
Thanks, does anyone have a link to the GCC bug report? We really should mention that in the commit description and/or metadata.
I came across a GCC bug report [0] while researching online. This issue was reportedly fixed in GCC-12.1 [1], yet it seems the same bug is still being triggered in GCC-14.2.0[2].
Should I file a new bug report with GCC to address this?
I was under the impression that this had already been reported, if it hasn't, then yes, please report the bug to the GCC team so we can get this fixed. Once you have the bug report, please post it here so it can be included in the commit.
Quoted 3 lines
[0] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101941
[1] https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=76fe494230477a69f8fa8c8ca2d493acaf343eb1
[2] https://lore.kernel.org/all/[email protected]/
Signature · 1 line
paul-moore.com
Quoted 55 lines · Paul Moore
Quoted 45 lines · Yafang Shao
Quoted 44 lines · Paul Moore
Quoted 42 lines · Yafang Shao
From: Yafang shao <[email protected]>
A build failure has been reported with the following details:
In file included from
include/linux/string.h:390,
frominclude/linux/bitmap.h:13, frominclude/linux/cpumask.h:12, frominclude/linux/smp.h:13, frominclude/linux/lockdep.h:14, frominclude/linux/spinlock.h:63, frominclude/linux/wait.h:9, frominclude/linux/wait_bit.h:8, frominclude/linux/fs.h:6, fromkernel/auditsc.c:37:
In function 'sized_strscpy',inlined from '__audit_ptrace' at kernel/auditsc.c:2732:2:Quoted 1 line
Quoted 1 line
include/linux/fortify-string.h:293:17: error: call to '__write_overflow' declared with attribute error: detected write beyond size of object (1st parameter)293 | __write_overflow(); | ^~~~~~~~~~~~~~~~~~In function '
sized_strscpy',
inlined from 'audit_signal_info_syscall' atkernel/auditsc.c:2759:3:Quoted 1 line
Quoted 1 line
include/linux/fortify-string.h:293:17: error: call to '__write_overflow' declared with attribute error: detected write beyond size of object (1st parameter)293 | __write_overflow(); | ^~~~~~~~~~~~~~~~~~The issue appears to be a GCC bug, though the root cause remains unclear at this time. For now, let's implement a workaround.
Reported-by kernel test robot <[email protected]>Reported-by Steven Rostedt (Google) <[email protected]>Reported-by "Zhuo, Qiuxu" <[email protected]>Closes https://lore.kernel.org/all/CY8PR11MB71348E568DBDA576F17DAFF389362@CY8PR11MB7134.namprd11.prod.outlook.com/ open hereOriginally-by Kees Cook <[email protected]>Signed-off-by Yafang shao <[email protected]>--- kernel/auditsc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Quoted 7 lines
Quoted 2 lines
Thanks, does anyone have a link to the GCC bug report? We really should mention that in the commit description and/or metadata.
I came across a GCC bug report [0] while researching online. This issue was reportedly fixed in GCC-12.1 [1], yet it seems the same bug is still being triggered in GCC-14.2.0[2].
Should I file a new bug report with GCC to address this?
Quoted 4 lines
I was under the impression that this had already been reported, if it hasn't, then yes, please report the bug to the GCC team so we can get this fixed. Once you have the bug report, please post it here so it can be included in the commit.
Sure, I’ll file a new report. However, it seems I need to create a new account for the bug tracker and wait for its approval. Please bear with me—I’ll provide an update as soon as it’s completed.
--
Regards
Yafang
Quoted 57 lines · Yafang Shao
Quoted 55 lines · Paul Moore
Quoted 52 lines · Yafang Shao
Quoted 44 lines · Paul Moore
Quoted 39 lines · Yafang Shao
From: Yafang shao <[email protected]>
A build failure has been reported with the following details:
In file included from
include/linux/string.h:390,
frominclude/linux/bitmap.h:13, frominclude/linux/cpumask.h:12, frominclude/linux/smp.h:13, frominclude/linux/lockdep.h:14, frominclude/linux/spinlock.h:63, frominclude/linux/wait.h:9, frominclude/linux/wait_bit.h:8, frominclude/linux/fs.h:6, fromkernel/auditsc.c:37:
In function 'sized_strscpy',inlined from '__audit_ptrace' at kernel/auditsc.c:2732:2:Quoted 1 line
Quoted 1 line
include/linux/fortify-string.h:293:17: error: call to '__write_overflow' declared with attribute error: detected write beyond size of object (1st parameter)293 | __write_overflow(); | ^~~~~~~~~~~~~~~~~~In function '
sized_strscpy',
inlined from 'audit_signal_info_syscall' atkernel/auditsc.c:2759:3:Quoted 1 line
Quoted 1 line
include/linux/fortify-string.h:293:17: error: call to '__write_overflow' declared with attribute error: detected write beyond size of object (1st parameter)293 | __write_overflow(); | ^~~~~~~~~~~~~~~~~~The issue appears to be a GCC bug, though the root cause remains unclear at this time. For now, let's implement a workaround.
Reported-by kernel test robot <[email protected]>Reported-by Steven Rostedt (Google) <[email protected]>Reported-by "Zhuo, Qiuxu" <[email protected]>Closes https://lore.kernel.org/all/CY8PR11MB71348E568DBDA576F17DAFF389362@CY8PR11MB7134.namprd11.prod.outlook.com/ open hereOriginally-by Kees Cook <[email protected]>Signed-off-by Yafang shao <[email protected]>Quoted 3 lines
--- kernel/auditsc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Quoted 2 lines
Thanks, does anyone have a link to the GCC bug report? We really should mention that in the commit description and/or metadata.
I came across a GCC bug report [0] while researching online. This issue was reportedly fixed in GCC-12.1 [1], yet it seems the same bug is still being triggered in GCC-14.2.0[2].
Should I file a new bug report with GCC to address this?
Quoted 8 lines
Quoted 4 lines
I was under the impression that this had already been reported, if it hasn't, then yes, please report the bug to the GCC team so we can get this fixed. Once you have the bug report, please post it here so it can be included in the commit.
Sure, I’ll file a new report. However, it seems I need to create a new account for the bug tracker and wait for its approval. Please bear with me—I’ll provide an update as soon as it’s completed.
JFYI, the bug report has been filed:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117912
Signature · 2 lines
Regards Yafang