mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* include/linux/fortify-string.h:293:17: error: call to '__write_overflow' declared with attribute error: detected write beyond size of object (1st parameter)
@ 2024-11-26 14:58 Naresh Kamboju
  2024-11-26 15:12 ` Arnd Bergmann
  0 siblings, 1 reply; 3+ messages in thread
From: Naresh Kamboju @ 2024-11-26 14:58 UTC (permalink / raw)
  To: audit, open list, lkft-triage, Linux Regressions
  Cc: eparis, Paul Moore, Arnd Bergmann, Dan Carpenter, Anders Roxell

The arm64 hardening.config builds failed on the Linux mainline master
for the arm64 architectures.

First seen on Linux mainline master 7eef7e306d3c40a0c5b9ff6adc9b273cc894dbd5.
  Good: 9f16d5e6f220661f73b36a4be1b21575651d8833
  Bad:  7eef7e306d3c40a0c5b9ff6adc9b273cc894dbd5

arm64:
  build:
    * gcc-8-lkftconfig-hardening
    * gcc-13-lkftconfig-hardening

Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>

Build error:
---------
In function 'sized_strscpy',
    inlined from '__audit_ptrace' at kernel/auditsc.c:2732:2:
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:
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();
      |                 ^~~~~~~~~~~~~~~~~~
make[4]: *** [scripts/Makefile.build:229: kernel/auditsc.o] Error 1

Build image:
-----------
- https://storage.tuxsuite.com/public/linaro/lkft/builds/2pNLRwWNgNgfh4C67CGISDtalxY/
- https://qa-reports.linaro.org/lkft/linux-mainline-master/build/v6.12-9567-g7eef7e306d3c/testrun/26066025/suite/build/test/gcc-13-lkftconfig-hardening/log
- https://qa-reports.linaro.org/lkft/linux-mainline-master/build/v6.12-9567-g7eef7e306d3c/testrun/26066025/suite/build/test/gcc-13-lkftconfig-hardening/details/
- https://qa-reports.linaro.org/lkft/linux-mainline-master/build/v6.12-9567-g7eef7e306d3c/testrun/26066025/suite/build/test/gcc-13-lkftconfig-hardening/history/

Steps to reproduce:
------------
- # tuxmake --runtime podman --target-arch arm64 --toolchain gcc-13 \
--kconfig defconfig \
--kconfig-add https://gitlab.com/Linaro/lkft/kernel-fragments/-/raw/main/netdev.config
\
--kconfig-add hardening.config

metadata:
----
  git describe: v6.12-9567-g7eef7e306d3c
  git repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
  git sha: 7eef7e306d3c40a0c5b9ff6adc9b273cc894dbd5
  kernel config:
https://storage.tuxsuite.com/public/linaro/lkft/builds/2pNLRwWNgNgfh4C67CGISDtalxY/config
  build url: https://storage.tuxsuite.com/public/linaro/lkft/builds/2pNLRwWNgNgfh4C67CGISDtalxY/
  toolchain: gcc-13 and gcc-8
  config: hardening.config
  arch: arm64

--
Linaro LKFT
https://lkft.linaro.org

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

* Re: include/linux/fortify-string.h:293:17: error: call to '__write_overflow' declared with attribute error: detected write beyond size of object (1st parameter)
  2024-11-26 14:58 include/linux/fortify-string.h:293:17: error: call to '__write_overflow' declared with attribute error: detected write beyond size of object (1st parameter) Naresh Kamboju
@ 2024-11-26 15:12 ` Arnd Bergmann
  2024-11-26 16:26   ` Arnd Bergmann
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2024-11-26 15:12 UTC (permalink / raw)
  To: Naresh Kamboju, audit, open list, lkft-triage, Linux Regressions
  Cc: Eric Paris, Paul Moore, Dan Carpenter, Anders Roxell, Yafang Shao

On Tue, Nov 26, 2024, at 15:58, Naresh Kamboju wrote:
> Build error:
> ---------
> In function 'sized_strscpy',
>     inlined from '__audit_ptrace' at kernel/auditsc.c:2732:2:
> 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:
> 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();
>       |                 ^~~~~~~~~~~~~~~~~~
> make[4]: *** [scripts/Makefile.build:229: kernel/auditsc.o] Error 1

I have run into this specific one before but failed to
come up with a working fix.

I think the specific warning started with

https://lore.kernel.org/all/20240828030321.20688-3-laoar.shao@gmail.com/

but reverting that just replaces it with a slightly different
warning. In my randconfig tree I have a patch that comments out
the two security_task_getlsmprop_obj(), and I don't think I get
warnings at the moment, but I no longer see why I would have done
that.

      Arnd

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

* Re: include/linux/fortify-string.h:293:17: error: call to '__write_overflow' declared with attribute error: detected write beyond size of object (1st parameter)
  2024-11-26 15:12 ` Arnd Bergmann
@ 2024-11-26 16:26   ` Arnd Bergmann
  0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2024-11-26 16:26 UTC (permalink / raw)
  To: Naresh Kamboju, audit, open list, lkft-triage, Linux Regressions
  Cc: Eric Paris, Paul Moore, Dan Carpenter, Anders Roxell,
	Yafang Shao, Gustavo A. R. Silva, Kees Cook

On Tue, Nov 26, 2024, at 16:12, Arnd Bergmann wrote:
> On Tue, Nov 26, 2024, at 15:58, Naresh Kamboju wrote:
>> Build error:
>> ---------
>> In function 'sized_strscpy',
>>     inlined from '__audit_ptrace' at kernel/auditsc.c:2732:2:
>> 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:
>> 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();
>>       |                 ^~~~~~~~~~~~~~~~~~
>> make[4]: *** [scripts/Makefile.build:229: kernel/auditsc.o] Error 1
>
> I have run into this specific one before but failed to
> come up with a working fix.
>
> I think the specific warning started with
>
> https://lore.kernel.org/all/20240828030321.20688-3-laoar.shao@gmail.com/
>
> but reverting that just replaces it with a slightly different
> warning. In my randconfig tree I have a patch that comments out
> the two security_task_getlsmprop_obj(), and I don't think I get
> warnings at the moment, but I no longer see why I would have done
> that.

Update: this seems to reliably avoid the warning, but I'm
still a bit lost about what exactly gcc warns about. I assume
this is a false-positive warning somewhere.

Added Kees and Gustavo to Cc in case they know what's going on.

      Arnd

diff --git a/kernel/audit.h b/kernel/audit.h
index 0211cb307d30..31cc41b167ae 100644
--- a/kernel/audit.h
+++ b/kernel/audit.h
@@ -145,7 +145,9 @@ struct audit_context {
 	kuid_t		    target_uid;
 	unsigned int	    target_sessionid;
 	struct lsm_prop	    target_ref;
-	char		    target_comm[TASK_COMM_LEN];
+	struct_group(_target_comm,
+		char	    target_comm[TASK_COMM_LEN];
+	);
 
 	struct audit_tree_refs *trees, *first_trees;
 	struct list_head killed_trees;

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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-26 14:58 include/linux/fortify-string.h:293:17: error: call to '__write_overflow' declared with attribute error: detected write beyond size of object (1st parameter) Naresh Kamboju
2024-11-26 15:12 ` Arnd Bergmann
2024-11-26 16:26   ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®