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: <fa472dc7-7e5a-aaba-2953-27f68a01d872@roeck-us.net>
Date:   Sat, 20 Jan 2018 09:56:48 -0800
From:   Guenter Roeck <linux@...ck-us.net>
To:     PrasannaKumar Muralidharan <prasannatsmkumar@...il.com>
Cc:     Paul Cercueil <paul@...pouillou.net>,
        Ralf Baechle <ralf@...ux-mips.org>,
        Rob Herring <robh+dt@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Wim Van Sebroeck <wim@...ana.be>,
        "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
        <devicetree@...r.kernel.org>,
        Linux-MIPS <linux-mips@...ux-mips.org>,
        open list <linux-kernel@...r.kernel.org>,
        linux-watchdog@...r.kernel.org
Subject: Re: [PATCH v2 3/8] watchdog: JZ4740: Register a restart handler

On 01/20/2018 08:04 AM, PrasannaKumar Muralidharan wrote:
> Hi Guenter,
> 
> On 20 January 2018 at 21:15, Guenter Roeck <linux@...ck-us.net> wrote:
>> On 01/19/2018 11:31 PM, PrasannaKumar Muralidharan wrote:
>>>
>>> Hi Paul,
>>>
>>> On 30 December 2017 at 19:21, Paul Cercueil <paul@...pouillou.net> wrote:
>>>>
>>>> The watchdog driver can restart the system by simply configuring the
>>>> hardware for a timeout of 0 seconds.
>>>>
>>>> Signed-off-by: Paul Cercueil <paul@...pouillou.net>
>>>> Reviewed-by: Guenter Roeck <linux@...ck-us.net>
>>>> ---
>>>>    drivers/watchdog/jz4740_wdt.c | 9 +++++++++
>>>>    1 file changed, 9 insertions(+)
>>>>
>>>>    v2: No change
>>>>
>>>> diff --git a/drivers/watchdog/jz4740_wdt.c
>>>> b/drivers/watchdog/jz4740_wdt.c
>>>> index 92d6ca8ceb49..fa7f49a3212c 100644
>>>> --- a/drivers/watchdog/jz4740_wdt.c
>>>> +++ b/drivers/watchdog/jz4740_wdt.c
>>>> @@ -130,6 +130,14 @@ static int jz4740_wdt_stop(struct watchdog_device
>>>> *wdt_dev)
>>>>           return 0;
>>>>    }
>>>>
>>>> +static int jz4740_wdt_restart(struct watchdog_device *wdt_dev,
>>>> +                             unsigned long action, void *data)
>>>> +{
>>>> +       wdt_dev->timeout = 0;
>>>> +       jz4740_wdt_start(wdt_dev);
>>>> +       return 0;
>>>> +}
>>>> +
>>>>    static const struct watchdog_info jz4740_wdt_info = {
>>>>           .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING |
>>>> WDIOF_MAGICCLOSE,
>>>>           .identity = "jz4740 Watchdog",
>>>> @@ -141,6 +149,7 @@ static const struct watchdog_ops jz4740_wdt_ops = {
>>>>           .stop = jz4740_wdt_stop,
>>>>           .ping = jz4740_wdt_ping,
>>>>           .set_timeout = jz4740_wdt_set_timeout,
>>>> +       .restart = jz4740_wdt_restart,
>>>>    };
>>>>
>>>>    #ifdef CONFIG_OF
>>>> --
>>>> 2.11.0
>>>>
>>>>
>>>
>>> Noticed that min_timeout of the watchdog device is set to 1 but this
>>> function calls start with timeout set to 0. Even though this works I
>>> feel it is better to set min_timeout to 0.
>>>
>>
>> No. That would be wrong. If you want to be pedantic, write a new function
>> __jz4740_wdt_set_timeout(u16 clock_div, u16 timeout_value) and call it
>> instead, but don't mess with min_timeout.
>>
>> Guenter
> 
> What is the effect of changing min_timeout? I could see only
> validation checks with it.
> 
Let me ask you - you want to let userspace set a timeout of 0, which would
effectively reboot the system through the backdoor. Why ?

Guenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ