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-next>] [day] [month] [year] [list]
Message-Id: <20200726231306.734-1-chris.packham@alliedtelesis.co.nz>
Date:   Mon, 27 Jul 2020 11:13:06 +1200
From:   Chris Packham <chris.packham@...iedtelesis.co.nz>
To:     a.zummo@...ertech.it, alexandre.belloni@...tlin.com,
        linux@...ck-us.net
Cc:     linux-rtc@...r.kernel.org, linux-watchdog@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        Chris Packham <chris.packham@...iedtelesis.co.nz>
Subject: [PATCH v2] rtc: ds1307: provide an indication that the watchdog has fired

There's not much feedback when the ds1388 watchdog fires. Generally it
yanks on the reset line and the board reboots. Capture the fact that the
watchdog has fired in the past so that userspace can retrieve it via
WDIOC_GETBOOTSTATUS. This should help distinguish a watchdog triggered
reset from a power interruption.

Signed-off-by: Chris Packham <chris.packham@...iedtelesis.co.nz>
---
Changes in v2:
- Set bootstatus to WDIOF_CARDRESET and let userspace decide what to do with
  the information.

 drivers/rtc/rtc-ds1307.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index 49702942bb08..209736db510d 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -868,6 +868,14 @@ static int ds1388_wdt_start(struct watchdog_device *wdt_dev)
 	struct ds1307 *ds1307 = watchdog_get_drvdata(wdt_dev);
 	u8 regs[2];
 	int ret;
+	int val;
+
+	ret = regmap_read(ds1307->regmap, DS1388_REG_FLAG, &val);
+	if (ret)
+		return ret;
+
+	if (val & DS1388_BIT_WF)
+		wdt_dev->bootstatus = WDIOF_CARDRESET;
 
 	ret = regmap_update_bits(ds1307->regmap, DS1388_REG_FLAG,
 				 DS1388_BIT_WF, 0);
-- 
2.27.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ