lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200813073325.GK3480@piout.net>
Date:   Thu, 13 Aug 2020 09:33:25 +0200
From:   Alexandre Belloni <alexandre.belloni@...tlin.com>
To:     Victor Ding <victording@...gle.com>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        Alessandro Zummo <a.zummo@...ertech.it>,
        linux-rtc@...r.kernel.org
Subject: Re: [PATCH] rtc: cmos: initialize rtc time when reading alarm

Hi,

On 13/08/2020 15:41:34+1000, Victor Ding wrote:
> cmos_read_alarm() may leave certain fields of a struct rtc_time
> untouched; therefore, these fields contain garbage if not properly
> initialized, leading to inconsistent values when converting into
> time64_t.
> This patch to set all fields of a struct rtc_time to -1 before calling
> cmos_read_alarm().
> 

I don't think this actually helps with the conversion as mktime64
is taking unsigned int so I would think you need the whole logic that is
in __rtc_read_alarm

> Signed-off-by: Victor Ding <victording@...gle.com>
> ---
> 
>  drivers/rtc/rtc-cmos.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
> index bcc96ab7793f..c99af567780d 100644
> --- a/drivers/rtc/rtc-cmos.c
> +++ b/drivers/rtc/rtc-cmos.c
> @@ -1006,6 +1006,7 @@ static int cmos_suspend(struct device *dev)
>  			enable_irq_wake(cmos->irq);
>  	}
>  
> +	memset(&cmos->saved_wkalrm.time, -1, sizeof(struct rtc_time));
>  	cmos_read_alarm(dev, &cmos->saved_wkalrm);
>  
>  	dev_dbg(dev, "suspend%s, ctrl %02x\n",
> @@ -1054,6 +1055,7 @@ static void cmos_check_wkalrm(struct device *dev)
>  		return;
>  	}
>  
> +	memset(&current_alarm.time, -1, sizeof(struct rtc_time));
>  	cmos_read_alarm(dev, &current_alarm);
>  	t_current_expires = rtc_tm_to_time64(&current_alarm.time);
>  	t_saved_expires = rtc_tm_to_time64(&cmos->saved_wkalrm.time);
> -- 
> 2.28.0.236.gb10cc79966-goog
> 

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ