Skip to contentSkip to conversation

include/linux/seqlock.h:1257:undefined reference to `__scoped_seqlock_bug'

DISCUSSION kernel test robot 3 participants 3 messages Jan 29

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw

Hi Oleg,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   8dfce8991b95d8625d0a1d2896e42f93b9d7f68d
commit: 488f48b32654dc6be04d9cc12f75ce030c9cb21b seqlock: Change thread_group_cputime() to use scoped_seqlock_read()
date:   3 months ago
config: s390-randconfig-002-20260129 (https://download.01.org/0day-ci/archive/20260129/[email protected]/config)
compiler: s390-linux-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260129/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

s390-linux-ld: kernel/sched/build_policy.o: in function `__scoped_seqlock_next':

>> include/linux/seqlock.h:1257:(.text+0x3ee04): undefined reference to `__scoped_seqlock_bug'

vim +1257 include/linux/seqlock.h

cc39f3872c0865 Peter Zijlstra 2025-10-09  1251  
cc39f3872c0865 Peter Zijlstra 2025-10-09  1252  static inline void
cc39f3872c0865 Peter Zijlstra 2025-10-09  1253  __scoped_seqlock_next(struct ss_tmp *sst, seqlock_t *lock, enum ss_state target)
cc39f3872c0865 Peter Zijlstra 2025-10-09  1254  {
cc39f3872c0865 Peter Zijlstra 2025-10-09  1255  	switch (sst->state) {
cc39f3872c0865 Peter Zijlstra 2025-10-09  1256  	case ss_done:
cc39f3872c0865 Peter Zijlstra 2025-10-09 @1257  		__scoped_seqlock_bug();
cc39f3872c0865 Peter Zijlstra 2025-10-09  1258  		return;
cc39f3872c0865 Peter Zijlstra 2025-10-09  1259  
cc39f3872c0865 Peter Zijlstra 2025-10-09  1260  	case ss_lock:
cc39f3872c0865 Peter Zijlstra 2025-10-09  1261  	case ss_lock_irqsave:
cc39f3872c0865 Peter Zijlstra 2025-10-09  1262  		sst->state = ss_done;
cc39f3872c0865 Peter Zijlstra 2025-10-09  1263  		return;
cc39f3872c0865 Peter Zijlstra 2025-10-09  1264  
cc39f3872c0865 Peter Zijlstra 2025-10-09  1265  	case ss_lockless:
cc39f3872c0865 Peter Zijlstra 2025-10-09  1266  		if (!read_seqretry(lock, sst->data)) {
cc39f3872c0865 Peter Zijlstra 2025-10-09  1267  			sst->state = ss_done;
cc39f3872c0865 Peter Zijlstra 2025-10-09  1268  			return;
cc39f3872c0865 Peter Zijlstra 2025-10-09  1269  		}
cc39f3872c0865 Peter Zijlstra 2025-10-09  1270  		break;
cc39f3872c0865 Peter Zijlstra 2025-10-09  1271  	}
cc39f3872c0865 Peter Zijlstra 2025-10-09  1272  
cc39f3872c0865 Peter Zijlstra 2025-10-09  1273  	switch (target) {
cc39f3872c0865 Peter Zijlstra 2025-10-09  1274  	case ss_done:
cc39f3872c0865 Peter Zijlstra 2025-10-09  1275  		__scoped_seqlock_invalid_target();
cc39f3872c0865 Peter Zijlstra 2025-10-09  1276  		return;
cc39f3872c0865 Peter Zijlstra 2025-10-09  1277  
cc39f3872c0865 Peter Zijlstra 2025-10-09  1278  	case ss_lock:
cc39f3872c0865 Peter Zijlstra 2025-10-09  1279  		sst->lock = &lock->lock;
cc39f3872c0865 Peter Zijlstra 2025-10-09  1280  		spin_lock(sst->lock);
cc39f3872c0865 Peter Zijlstra 2025-10-09  1281  		sst->state = ss_lock;
cc39f3872c0865 Peter Zijlstra 2025-10-09  1282  		return;
cc39f3872c0865 Peter Zijlstra 2025-10-09  1283  
cc39f3872c0865 Peter Zijlstra 2025-10-09  1284  	case ss_lock_irqsave:
cc39f3872c0865 Peter Zijlstra 2025-10-09  1285  		sst->lock_irqsave = &lock->lock;
cc39f3872c0865 Peter Zijlstra 2025-10-09  1286  		spin_lock_irqsave(sst->lock_irqsave, sst->data);
cc39f3872c0865 Peter Zijlstra 2025-10-09  1287  		sst->state = ss_lock_irqsave;
cc39f3872c0865 Peter Zijlstra 2025-10-09  1288  		return;
cc39f3872c0865 Peter Zijlstra 2025-10-09  1289  
cc39f3872c0865 Peter Zijlstra 2025-10-09  1290  	case ss_lockless:
cc39f3872c0865 Peter Zijlstra 2025-10-09  1291  		sst->data = read_seqbegin(lock);
cc39f3872c0865 Peter Zijlstra 2025-10-09  1292  		return;
cc39f3872c0865 Peter Zijlstra 2025-10-09  1293  	}
cc39f3872c0865 Peter Zijlstra 2025-10-09  1294  }
cc39f3872c0865 Peter Zijlstra 2025-10-09  1295  

:::::: The code at line 1257 was first introduced by commit
:::::: cc39f3872c0865bef992b713338df369554fa9e0 seqlock: Introduce scoped_seqlock_read()

:::::: TO: Peter Zijlstra <[email protected]>
:::::: CC: Peter Zijlstra <[email protected]>

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#1 lore raw
Quoted 12 lines · kernel test robot

Hi Oleg,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   8dfce8991b95d8625d0a1d2896e42f93b9d7f68d
commit: 488f48b32654dc6be04d9cc12f75ce030c9cb21b seqlock: Change thread_group_cputime() to use scoped_seqlock_read()
date:   3 months ago
config: s390-randconfig-002-20260129 (https://download.01.org/0day-ci/archive/20260129/[email protected]/config)
compiler: s390-linux-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260129/[email protected]/reproduce)
Quoted 10 lines

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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

s390-linux-ld: kernel/sched/build_policy.o: in function `__scoped_seqlock_next':

Quoted 1 line
Quoted 1 line

include/linux/seqlock.h:1257:(.text+0x3ee04): undefined reference to `__scoped_seqlock_bug'

Yeah, this is an UBSAN build, and those sanitizers keep confusing things.

The problem is, some distros seem to actually ship with that crap on :-(.

I need to go prod some compiler folks.

Uros, do compiler folks care about optimizer quality in the face of UBSAN or should I go kick distros for shipping with UBSAN enabled?

If s390 isn't your cup of tea, I think Ingo has a x86 config somewhere that shows this same.

Quoted 57 lines

vim +1257 include/linux/seqlock.h

cc39f3872c0865 Peter Zijlstra 2025-10-09  1251  
cc39f3872c0865 Peter Zijlstra 2025-10-09  1252  static inline void
cc39f3872c0865 Peter Zijlstra 2025-10-09  1253  __scoped_seqlock_next(struct ss_tmp *sst, seqlock_t *lock, enum ss_state target)
cc39f3872c0865 Peter Zijlstra 2025-10-09  1254  {
cc39f3872c0865 Peter Zijlstra 2025-10-09  1255  	switch (sst->state) {
cc39f3872c0865 Peter Zijlstra 2025-10-09  1256  	case ss_done:
cc39f3872c0865 Peter Zijlstra 2025-10-09 @1257  		__scoped_seqlock_bug();
cc39f3872c0865 Peter Zijlstra 2025-10-09  1258  		return;
cc39f3872c0865 Peter Zijlstra 2025-10-09  1259  
cc39f3872c0865 Peter Zijlstra 2025-10-09  1260  	case ss_lock:
cc39f3872c0865 Peter Zijlstra 2025-10-09  1261  	case ss_lock_irqsave:
cc39f3872c0865 Peter Zijlstra 2025-10-09  1262  		sst->state = ss_done;
cc39f3872c0865 Peter Zijlstra 2025-10-09  1263  		return;
cc39f3872c0865 Peter Zijlstra 2025-10-09  1264  
cc39f3872c0865 Peter Zijlstra 2025-10-09  1265  	case ss_lockless:
cc39f3872c0865 Peter Zijlstra 2025-10-09  1266  		if (!read_seqretry(lock, sst->data)) {
cc39f3872c0865 Peter Zijlstra 2025-10-09  1267  			sst->state = ss_done;
cc39f3872c0865 Peter Zijlstra 2025-10-09  1268  			return;
cc39f3872c0865 Peter Zijlstra 2025-10-09  1269  		}
cc39f3872c0865 Peter Zijlstra 2025-10-09  1270  		break;
cc39f3872c0865 Peter Zijlstra 2025-10-09  1271  	}
cc39f3872c0865 Peter Zijlstra 2025-10-09  1272  
cc39f3872c0865 Peter Zijlstra 2025-10-09  1273  	switch (target) {
cc39f3872c0865 Peter Zijlstra 2025-10-09  1274  	case ss_done:
cc39f3872c0865 Peter Zijlstra 2025-10-09  1275  		__scoped_seqlock_invalid_target();
cc39f3872c0865 Peter Zijlstra 2025-10-09  1276  		return;
cc39f3872c0865 Peter Zijlstra 2025-10-09  1277  
cc39f3872c0865 Peter Zijlstra 2025-10-09  1278  	case ss_lock:
cc39f3872c0865 Peter Zijlstra 2025-10-09  1279  		sst->lock = &lock->lock;
cc39f3872c0865 Peter Zijlstra 2025-10-09  1280  		spin_lock(sst->lock);
cc39f3872c0865 Peter Zijlstra 2025-10-09  1281  		sst->state = ss_lock;
cc39f3872c0865 Peter Zijlstra 2025-10-09  1282  		return;
cc39f3872c0865 Peter Zijlstra 2025-10-09  1283  
cc39f3872c0865 Peter Zijlstra 2025-10-09  1284  	case ss_lock_irqsave:
cc39f3872c0865 Peter Zijlstra 2025-10-09  1285  		sst->lock_irqsave = &lock->lock;
cc39f3872c0865 Peter Zijlstra 2025-10-09  1286  		spin_lock_irqsave(sst->lock_irqsave, sst->data);
cc39f3872c0865 Peter Zijlstra 2025-10-09  1287  		sst->state = ss_lock_irqsave;
cc39f3872c0865 Peter Zijlstra 2025-10-09  1288  		return;
cc39f3872c0865 Peter Zijlstra 2025-10-09  1289  
cc39f3872c0865 Peter Zijlstra 2025-10-09  1290  	case ss_lockless:
cc39f3872c0865 Peter Zijlstra 2025-10-09  1291  		sst->data = read_seqbegin(lock);
cc39f3872c0865 Peter Zijlstra 2025-10-09  1292  		return;
cc39f3872c0865 Peter Zijlstra 2025-10-09  1293  	}
cc39f3872c0865 Peter Zijlstra 2025-10-09  1294  }
cc39f3872c0865 Peter Zijlstra 2025-10-09  1295  

:::::: The code at line 1257 was first introduced by commit
:::::: cc39f3872c0865bef992b713338df369554fa9e0 seqlock: Introduce scoped_seqlock_read()

:::::: TO: Peter Zijlstra <[email protected]>
:::::: CC: Peter Zijlstra <[email protected]>

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#2 lore raw
Quoted 31 lines · Peter Zijlstra
Quoted 12 lines · kernel test robot

Hi Oleg,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   8dfce8991b95d8625d0a1d2896e42f93b9d7f68d
commit: 488f48b32654dc6be04d9cc12f75ce030c9cb21b seqlock: Change thread_group_cputime() to use scoped_seqlock_read()
date:   3 months ago
config: s390-randconfig-002-20260129 (https://download.01.org/0day-ci/archive/20260129/[email protected]/config)
compiler: s390-linux-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260129/[email protected]/reproduce)
Quoted 10 lines

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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

s390-linux-ld: kernel/sched/build_policy.o: in function `__scoped_seqlock_next':

Quoted 1 line
Quoted 1 line

include/linux/seqlock.h:1257:(.text+0x3ee04): undefined reference to `__scoped_seqlock_bug'

Yeah, this is an UBSAN build, and those sanitizers keep confusing things.

The problem is, some distros seem to actually ship with that crap on :-(.

Quoted 7 lines

I need to go prod some compiler folks.

Uros, do compiler folks care about optimizer quality in the face of UBSAN or should I go kick distros for shipping with UBSAN enabled?

If s390 isn't your cup of tea, I think Ingo has a x86 config somewhere that shows this same.

Please file a bug in GCC bugzilla under the "sanitizer" component. This is more a question for people that deal with sanitizers in GCC.

Thanks,
Uros.