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] [day] [month] [year] [list]
Message-ID: <CAJZ5v0g-EEw4qgXJ4gBjRe-vt3u0XzmOv4wC0gP0JLnpk7ciXQ@mail.gmail.com>
Date:   Tue, 1 Mar 2022 18:56:04 +0100
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Randy Dunlap <rdunlap@...radead.org>
Cc:     Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Igor Zhbanov <i.zhbanov@...russia.ru>,
        Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Len Brown <len.brown@...el.com>, Pavel Machek <pavel@....cz>,
        Linux PM <linux-pm@...r.kernel.org>
Subject: Re: [PATCH] PM/sleep: fix return value of __setup handler

On Mon, Feb 28, 2022 at 11:05 PM Randy Dunlap <rdunlap@...radead.org> wrote:
>
> If an invalid option is given for "test_suspend=<option>", the entire
> string is added to init's environment, so return 1 instead of 0 from
> the __setup handler.
>
>   Unknown kernel command line parameters "BOOT_IMAGE=/boot/bzImage-517rc5
>     test_suspend=invalid"
>
> and
>
>  Run /sbin/init as init process
>    with arguments:
>      /sbin/init
>    with environment:
>      HOME=/
>      TERM=linux
>      BOOT_IMAGE=/boot/bzImage-517rc5
>      test_suspend=invalid
>
> Fixes: 2ce986892faf ("PM / sleep: Enhance test_suspend option with repeat capability")
> Fixes: 27ddcc6596e5 ("PM / sleep: Add state field to pm_states[] entries")
> Fixes: a9d7052363a6 ("PM: Separate suspend to RAM functionality from core")
> Signed-off-by: Randy Dunlap <rdunlap@...radead.org>
> Reported-by: Igor Zhbanov <i.zhbanov@...russia.ru>
> Link: lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@...russia.ru
> Cc: Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>
> Cc: "Rafael J. Wysocki" <rafael@...nel.org>
> Cc: Len Brown <len.brown@...el.com>
> Cc: Pavel Machek <pavel@....cz>
> Cc: linux-pm@...r.kernel.org
> ---
> Would someone like warning messages added in case of bad option strings?
>
>  kernel/power/suspend_test.c |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> --- linux-next-20220228.orig/kernel/power/suspend_test.c
> +++ linux-next-20220228/kernel/power/suspend_test.c
> @@ -157,22 +157,22 @@ static int __init setup_test_suspend(cha
>         value++;
>         suspend_type = strsep(&value, ",");
>         if (!suspend_type)
> -               return 0;
> +               return 1;
>
>         repeat = strsep(&value, ",");
>         if (repeat) {
>                 if (kstrtou32(repeat, 0, &test_repeat_count_max))
> -                       return 0;
> +                       return 1;
>         }
>
>         for (i = PM_SUSPEND_MIN; i < PM_SUSPEND_MAX; i++)
>                 if (!strcmp(pm_labels[i], suspend_type)) {
>                         test_state_label = pm_labels[i];
> -                       return 0;
> +                       return 1;
>                 }
>
>         printk(warn_bad_state, suspend_type);
> -       return 0;
> +       return 1;
>  }
>  __setup("test_suspend", setup_test_suspend);

Applied as 5.18 material, thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ