linux-rtc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bug report] out-of-bound array access in drivers/rtc/lib.c rtc_month_days
@ 2021-02-19 18:51 charley.ashbringer
  2021-02-20  0:35 ` Alexandre Belloni
  0 siblings, 1 reply; 3+ messages in thread
From: charley.ashbringer @ 2021-02-19 18:51 UTC (permalink / raw)
  To: a.zummo, alexandre.belloni; +Cc: linux-rtc

Hi Alessandro and Alexandre,
Greetings, I'm a 2nd year PhD student who is interested in using UBSan to
the kernel.
Through some experiment, I found a out-of-bound array access in function
rtc_month_days.
More specifically, the through the call chain of 
davinci_rtc_set_time/davinci_rtc_set_alarm -> convert2days ->
rtc_month_days,
since davinci_rtc_set_time/davinci_rtc_set_alarm are ioctl functions,
thus the 2nd parameter, struct rtc_time *tm, is passed in purely from
user-space which can be any value.
And such a value, tm->tm_mon is used directly as an index to a fixed length
array, rtc_ydays.
This looks very fishy to me.

Although I know that, syzkaller has applied UBSan to this driver before, and
such a simple error cannot evade its detection, I'm still wondering if this
is a true error,
and more importantly, if it's not, then why, this will help me understand
linux a lot.

Looking forward to your valued response!

Best regards,
Changming Liu


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

end of thread, other threads:[~2021-02-20 17:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-19 18:51 [bug report] out-of-bound array access in drivers/rtc/lib.c rtc_month_days charley.ashbringer
2021-02-20  0:35 ` Alexandre Belloni
2021-02-20 17:27   ` charley.ashbringer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).