All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] gcov: use atomic counter updates to fix concurrent access crashes
@ 2026-04-17 11:28 kernel test robot
  0 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2026-04-17 11:28 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp

:::::: 
:::::: Manual check reason: "only suspicious fbc files changed"
:::::: 

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20260402141831.1437357-2-khorenko@virtuozzo.com>
References: <20260402141831.1437357-2-khorenko@virtuozzo.com>
TO: Konstantin Khorenko <khorenko@virtuozzo.com>
TO: Peter Oberparleiter <oberpar@linux.ibm.com>
TO: Mikhail Zaslonko <zaslonko@linux.ibm.com>
TO: Nathan Chancellor <nathan@kernel.org>
TO: Nicolas Schier <nsc@kernel.org>
CC: Masahiro Yamada <masahiroy@kernel.org>
CC: "Thomas Weißschuh" <linux@weissschuh.net>
CC: Arnd Bergmann <arnd@arndb.de>
CC: Steffen Klassert <steffen.klassert@secunet.com>
CC: Herbert Xu <herbert@gondor.apana.org.au>
CC: linux-kbuild@vger.kernel.org
CC: linux-kernel@vger.kernel.org
CC: netdev@vger.kernel.org
CC: Konstantin Khorenko <khorenko@virtuozzo.com>
CC: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
CC: Vasileios Almpanis <vasileios.almpanis@virtuozzo.com>
CC: Jakub Kicinski <kuba@kernel.org>

Hi Konstantin,

kernel test robot noticed the following build errors:

[auto build test ERROR on soc/for-next]
[also build test ERROR on v7.0 next-20260416]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Konstantin-Khorenko/gcov-use-atomic-counter-updates-to-fix-concurrent-access-crashes/20260411-133428
base:   https://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git for-next
patch link:    https://lore.kernel.org/r/20260402141831.1437357-2-khorenko%40virtuozzo.com
patch subject: [PATCH] gcov: use atomic counter updates to fix concurrent access crashes
:::::: branch date: 6 days ago
:::::: commit date: 6 days ago
config: i386-buildonly-randconfig-005-20260417 (https://download.01.org/0day-ci/archive/20260417/202604171926.AK0Gl5MD-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260417/202604171926.AK0Gl5MD-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/r/202604171926.AK0Gl5MD-lkp@intel.com/

All errors (new ones prefixed by >>):

   ld: kernel/trace/ftrace.o: in function `symbols_cmp':
>> kernel/trace/ftrace.c:9213:(.text+0x18): undefined reference to `__atomic_fetch_add_8'
>> ld: kernel/trace/ftrace.c:9217:(.text+0x36): undefined reference to `__atomic_fetch_add_8'
   ld: kernel/trace/ftrace.o: in function `ftrace_pid_release':
   kernel/trace/ftrace.c:8961:(.text+0x5c): undefined reference to `__atomic_fetch_add_8'
   ld: kernel/trace/ftrace.c:8964:(.text+0x7a): undefined reference to `__atomic_fetch_add_8'
   ld: kernel/trace/ftrace.c:8966:(.text+0x98): undefined reference to `__atomic_fetch_add_8'
   ld: kernel/trace/ftrace.o:kernel/trace/ftrace.c:8852: more undefined references to `__atomic_fetch_add_8' follow


vim +9213 kernel/trace/ftrace.c

b0fc494fae96a7 Steven Rostedt 2008-05-12  9211  
bed0d9a50dacee Jiri Olsa      2022-05-10  9212  static int symbols_cmp(const void *a, const void *b)
bed0d9a50dacee Jiri Olsa      2022-05-10 @9213  {
bed0d9a50dacee Jiri Olsa      2022-05-10  9214  	const char **str_a = (const char **) a;
bed0d9a50dacee Jiri Olsa      2022-05-10  9215  	const char **str_b = (const char **) b;
bed0d9a50dacee Jiri Olsa      2022-05-10  9216  
bed0d9a50dacee Jiri Olsa      2022-05-10 @9217  	return strcmp(*str_a, *str_b);
bed0d9a50dacee Jiri Olsa      2022-05-10  9218  }
bed0d9a50dacee Jiri Olsa      2022-05-10  9219  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: [PATCH] gcov: use atomic counter updates to fix concurrent access crashes
@ 2026-04-11 11:17 kernel test robot
  0 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2026-04-11 11:17 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp

:::::: 
:::::: Manual check reason: "only suspicious fbc files changed"
:::::: 

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20260402141831.1437357-2-khorenko@virtuozzo.com>
References: <20260402141831.1437357-2-khorenko@virtuozzo.com>
TO: Konstantin Khorenko <khorenko@virtuozzo.com>
TO: Peter Oberparleiter <oberpar@linux.ibm.com>
TO: Mikhail Zaslonko <zaslonko@linux.ibm.com>
TO: Nathan Chancellor <nathan@kernel.org>
TO: Nicolas Schier <nsc@kernel.org>
CC: Masahiro Yamada <masahiroy@kernel.org>
CC: "Thomas Weißschuh" <linux@weissschuh.net>
CC: Arnd Bergmann <arnd@arndb.de>
CC: Steffen Klassert <steffen.klassert@secunet.com>
CC: Herbert Xu <herbert@gondor.apana.org.au>
CC: linux-kbuild@vger.kernel.org
CC: linux-kernel@vger.kernel.org
CC: netdev@vger.kernel.org
CC: Konstantin Khorenko <khorenko@virtuozzo.com>
CC: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
CC: Vasileios Almpanis <vasileios.almpanis@virtuozzo.com>
CC: Jakub Kicinski <kuba@kernel.org>

Hi Konstantin,

kernel test robot noticed the following build warnings:

[auto build test WARNING on soc/for-next]
[also build test WARNING on linus/master v7.0-rc7 next-20260410]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Konstantin-Khorenko/gcov-use-atomic-counter-updates-to-fix-concurrent-access-crashes/20260411-133428
base:   https://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git for-next
patch link:    https://lore.kernel.org/r/20260402141831.1437357-2-khorenko%40virtuozzo.com
patch subject: [PATCH] gcov: use atomic counter updates to fix concurrent access crashes
:::::: branch date: 6 hours ago
:::::: commit date: 6 hours ago
config: m68k-allmodconfig (https://download.01.org/0day-ci/archive/20260411/202604111946.Erd3tguU-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260411/202604111946.Erd3tguU-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/r/202604111946.Erd3tguU-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> io_uring/io_uring.c:3224:1: warning: target does not support atomic profile update, single mode is selected
    3224 | __initcall(io_uring_init);
         | ^~~~~~~~~~
--
>> io_uring/opdef.c:890:1: warning: target does not support atomic profile update, single mode is selected
     890 | }
         | ^
--
>> io_uring/kbuf.c:740:1: warning: target does not support atomic profile update, single mode is selected
     740 | }
         | ^
--
>> io_uring/rsrc.c:1555:1: warning: target does not support atomic profile update, single mode is selected
    1555 | }
         | ^
--
>> io_uring/notif.c:141:1: warning: target does not support atomic profile update, single mode is selected
     141 | }
         | ^
--
>> io_uring/tctx.c:388:1: warning: target does not support atomic profile update, single mode is selected
     388 | }
         | ^
--
>> io_uring/filetable.c:158:1: warning: target does not support atomic profile update, single mode is selected
     158 | }
         | ^
--
>> io_uring/rw.c:1397:1: warning: target does not support atomic profile update, single mode is selected
    1397 | }
         | ^
--
>> io_uring/poll.c:963:1: warning: target does not support atomic profile update, single mode is selected
     963 | }
         | ^
--
>> io_uring/tw.c:355:1: warning: target does not support atomic profile update, single mode is selected
     355 | }
         | ^
--
>> io_uring/wait.c:308:1: warning: target does not support atomic profile update, single mode is selected
     308 | }
         | ^
..


vim +3224 io_uring/io_uring.c

76d3ccecfa186a io_uring/io_uring.c Matteo Rizzo 2023-08-21  3221  
2b188cc1bb857a fs/io_uring.c       Jens Axboe   2019-01-07  3222  	return 0;
2b188cc1bb857a fs/io_uring.c       Jens Axboe   2019-01-07  3223  };
2b188cc1bb857a fs/io_uring.c       Jens Axboe   2019-01-07 @3224  __initcall(io_uring_init);

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 7+ messages in thread
* [PATCH 0/1] gcov: add -fprofile-update=atomic to fix concurrent access crashes
@ 2026-04-02 14:18 Konstantin Khorenko
  2026-04-02 14:18 ` [PATCH] gcov: use atomic counter updates " Konstantin Khorenko
  0 siblings, 1 reply; 7+ messages in thread
From: Konstantin Khorenko @ 2026-04-02 14:18 UTC (permalink / raw)
  To: Peter Oberparleiter, Mikhail Zaslonko, Nathan Chancellor,
	Nicolas Schier
  Cc: Masahiro Yamada, Thomas Weißschuh, Arnd Bergmann,
	Steffen Klassert, Herbert Xu, linux-kbuild, linux-kernel, netdev,
	Konstantin Khorenko, Pavel Tikhomirov, Vasileios Almpanis,
	Jakub Kicinski

This patch adds -fprofile-update=atomic to global CFLAGS_GCOV in the
top-level Makefile to fix crashes caused by GCC merging GCOV counters
with loop induction variables in concurrent code paths.

History
-------

This was originally posted as a zlib-only fix:
  https://lore.kernel.org/lkml/20260330143256.306326-1-khorenko@virtuozzo.com/T/#t

During review, it was suggested to apply the flag globally instead of
per-subsystem, as it not only fixes the observed crash but makes GCOV
coverage data more consistent overall.  A combined series was posted:
  https://lore.kernel.org/lkml/20260401142020.1434243-1-khorenko@virtuozzo.com/T/#t

That combined series is now split per subsystem as requested by
reviewers.

The GCC bug report for the underlying compiler issue:
  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124749

Dependencies
------------

This patch requires the following preparatory fixes to be applied first,
otherwise CONFIG_GCOV_PROFILE_ALL=y builds will fail:

 - net: fix skb_ext BUILD_BUG_ON failures with GCOV (sent to netdev):
   __no_profile on skb_ext_total_length() and skb_extensions_init()
   https://lore.kernel.org/lkml/20260402140558.1437002-1-khorenko@virtuozzo.com/T/#t

 - iommu/generic_pt: disable GCOV for iommu_amdv1.o (sent to iommu):
   GCOV_PROFILE_iommu_amdv1.o := n
   https://lore.kernel.org/lkml/20260402141012.1437095-1-khorenko@virtuozzo.com/T/#t

Without those patches, -fprofile-update=atomic prevents GCC from
constant-folding expressions inside profiled inline functions, breaking
BUILD_BUG_ON / FIELD_PREP compile-time checks.

The crash
---------

Observed during LTP IPComp stress testing on a GCOV-enabled kernel:

  BUG: unable to handle page fault for address: ffffd0a3c0902ffa
  RIP: inflate_fast+1431
  Call Trace:
   zlib_inflate
   __deflate_decompress
   crypto_comp_decompress
   ipcomp_decompress [xfrm_ipcomp]
   ipcomp_input [xfrm_ipcomp]
   xfrm_input

GCC merged a global GCOV counter with the loop induction variable.
Another CPU modified the counter between loads, causing a write 3.4 MB
past a 65 KB buffer.  -fprofile-update=atomic forces atomic counter
updates and prevents this merging.

Testing
-------

Build-tested with CONFIG_GCOV_PROFILE_ALL=y using GCC 11.4.1 and
GCC 16.0.1 20260327 (experimental). Both fail without the full set
of patches, both succeed with all three series applied.

Assembly-verified that -fprofile-update=atomic prevents counter-IV
merging in inflate_fast() on both compiler versions.

Also tested by Peter Oberparleiter:

Quote: "Successfully tested this series on s390 (except for patch 3 which
depends on x86) using GCC 15.2.0, GCC 10.1.0, and current Clang from git
(20260401)."

Konstantin Khorenko (1):
  gcov: use atomic counter updates to fix concurrent access crashes

 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.43.5

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

end of thread, other threads:[~2026-04-17 11:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-17 11:28 [PATCH] gcov: use atomic counter updates to fix concurrent access crashes kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2026-04-11 11:17 kernel test robot
2026-04-02 14:18 [PATCH 0/1] gcov: add -fprofile-update=atomic " Konstantin Khorenko
2026-04-02 14:18 ` [PATCH] gcov: use atomic counter updates " Konstantin Khorenko
2026-04-06 19:37   ` Nathan Chancellor
2026-04-09  8:11     ` Peter Oberparleiter
2026-04-15 10:19       ` Andrew Morton
2026-04-11 14:17   ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.