Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1446322

Re: [PATCH][v2] timekeeping: Fix memory overwrite of sleep_time_bin array

From Thomas Gleixner <tglx@linutronix.de>
Newsgroups linux.kernel
Subject Re: [PATCH][v2] timekeeping: Fix memory overwrite of sleep_time_bin array
Date 2016-07-19 12:50 +0200
Message-ID <rWAL7-2W9-13@gated-at.bofh.it> (permalink)
References <rWv8J-7LS-11@gated-at.bofh.it> <rWyJk-1Ja-15@gated-at.bofh.it> <rWz2G-1PI-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Tue, 19 Jul 2016, Chen Yu wrote:
> On 2016年07月19日 16:36, Thomas Gleixner wrote:
> > On Tue, 19 Jul 2016, Chen Yu wrote:
> > > Further investigation shows that, the problem is caused by setting
> > > /sys/power/pm_trace to 1 before the 1st hibernation, since once
> > > pm_trace is enabled, the rtc becomes an unmeaningful value after resumed,
> >
> > So why is the RTC value useless if pm_trace is enabled? I really have a hard
> > time to understand why pm_trace would affect the sleep time readout from
> > RTC.
>
> After pm_trace is enabled, during system suspend/hibernate, the hash name of
> each devices will be written to rtc, so the rtc value depends on what we
> write in last suspend round, thus pm_trace can be used for diagnose which
> device failed to suspend(eg, the suspending on this device hang the system,
> we reboot the system , and check rtc hash value).
> 
> In our case, after first hibernate/resume round, we found our current system
> time is at 2117, so syscore_resume -> timekeeping_resume :
> __timekeeping_inject_sleeptime(tk, &ts_delta) would inject a quite large
> delta : 2117 - 2017 year, thus the sleep_time_bin is overflow.

While the range check is certainly correct and a good thing to have it's wrong
in the first place to call __timekeeping_inject_sleeptime() in case that
pm_trace is enabled simply because that "hash" time value will also wreckage
timekeeping. Your patch is just curing the symptom in the debug code but not
fixing the root cause.

Thanks,

	tglx

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH][v2] timekeeping: Fix memory overwrite of sleep_time_bin array Chen Yu <yu.c.chen@intel.com> - 2016-07-19 06:50 +0200
  Re: [PATCH][v2] timekeeping: Fix memory overwrite of sleep_time_bin  array Thomas Gleixner <tglx@linutronix.de> - 2016-07-19 10:40 +0200
    Re: [PATCH][v2] timekeeping: Fix memory overwrite of sleep_time_bin  array Chen Yu <yu.c.chen@intel.com> - 2016-07-19 11:00 +0200
      Re: [PATCH][v2] timekeeping: Fix memory overwrite of sleep_time_bin  array Thomas Gleixner <tglx@linutronix.de> - 2016-07-19 12:50 +0200
        Re: [PATCH][v2] timekeeping: Fix memory overwrite of sleep_time_bin  array Chen Yu <yu.c.chen@intel.com> - 2016-07-20 13:00 +0200
          Re: [PATCH][v2] timekeeping: Fix memory overwrite of sleep_time_bin array "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-07-20 15:00 +0200
            RE: [PATCH][v2] timekeeping: Fix memory overwrite of sleep_time_bin  array "Chen, Yu C" <yu.c.chen@intel.com> - 2016-07-20 19:00 +0200

csiph-web