[Bug 296727] rk8xx_rtc: Stack buffer overflow

[email protected] Sun, 12 Jul 2026 14:09:40 +0000
Newsgroups gmane.os.freebsd.bugs
Message-ID <[email protected]/bugzilla/>
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=296727

            Bug ID: 296727
           Summary: rk8xx_rtc: Stack buffer overflow
           Product: Base System
           Version: CURRENT
          Hardware: arm64
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: kern
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]

Created attachment 272764
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=272764&action=edit
0001-rk8xx_rtc-Fix-stack-buffer-overflow.patch

My rockpro64 panics after bootup since -fstack-protector-strong has been turned
on.
There is an overflow of rk8xx_settime's char data[7], caused by a typo in the
attach functions which is initializing rtc_regs.weeks to RK8xx_RTC_WEEKS_MASK
(0x07) instead of RK8xx_RTC_WEEKS (0x06). The attached patch fixes this issue
for me (rk808): the board no longer panics.

vpanic() at vpanic+0x1c8
panic() at panic+0x48
__stack_chk_fail() at __stack_chk_fail+0x14
rk8xx_settime() at rk8xx_settime+0x1a0
settime_task_func() at settime_task_func+0xc8
taskqueue_run_locked() at taskqueue_run_locked+0x1cc
taskqueue_thread_loop() at taskqueue_thread_loop+0x120

-- 
You are receiving this mail because:
You are the assignee for the bug.