NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/60364: if_spppsubr.c uses nonportable 64-bit atomics



>Number:         60364
>Category:       kern
>Synopsis:       if_spppsubr.c uses nonportable 64-bit atomics
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jun 24 15:20:00 +0000 2026
>Originator:     Taylor R Campbell
>Release:        current as of today
>Organization:
The NetPPP Foundatime, Inc.
>Environment:
>Description:

	The recent change to use atomic_load/store for last tx/rx
	activity in if_spppsubr.c broke the build on most or all 32-bit
	platforms because it operates on time_t, which is 64-bit, wider
	than allowed for atomic loads and stores:

--- if_spppsubr.o ---
In file included from /tmp/build/2026.06.24.13.51.21-i386/src/sys/rump/net/lib/libnet/../../../../net/if_spppsubr.c:43:
/tmp/build/2026.06.24.13.51.21-i386/src/sys/rump/net/lib/libnet/../../../../net/if_spppsubr.c: In function 'sppp_input':
/tmp/build/2026.06.24.13.51.21-i386/src/sys/rump/net/lib/libnet/../../../../sys/cdefs.h:172:48: error: negative width in bit-field '__ctassert27'
...
/tmp/build/2026.06.24.13.51.21-i386/src/sys/rump/net/lib/libnet/../../../../sys/atomic.h:427:9: note: in expansion of macro 'CTASSERT'
  427 |         CTASSERT(sizeof(*(p)) <= __ATOMIC_SIZE_MAX);                          \
      |         ^~~~~~~~
/tmp/build/2026.06.24.13.51.21-i386/src/sys/rump/net/lib/libnet/../../../../sys/atomic.h:485:9: note: in expansion of macro '__ATOMIC_PTR_CHECK'
  485 |         __ATOMIC_PTR_CHECK(__as_ptr);                                         \
      |         ^~~~~~~~~~~~~~~~~~
/tmp/build/2026.06.24.13.51.21-i386/src/sys/rump/net/lib/libnet/../../../../net/if_spppsubr.c:759:25: note: in expansion of macro 'atomic_store_relaxed'
  759 |                         atomic_store_relaxed(&sp->pp_last_activity, time_uptime);
      |                         ^~~~~~~~~~~~~~~~~~~~

>How-To-Repeat:

	./build.sh -m i386 kernel=GENERIC

>Fix:

	Use uint32_t and time_uptime32 -- the times are checked
	periodically long before a 32-bit number of seconds can roll
	over, and it is not reasonable to set >=68-year timeouts.




Home | Main Index | Thread Index | Old Index