From: Pavel Machek <pavel@ucw.cz>
To: Kees Cook <keescook@chromium.org>
Cc: linux-kernel@vger.kernel.org,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
"H. Peter Anvin" <hpa@zytor.com>,
Randy Dunlap <rdunlap@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>,
x86@kernel.org, Len Brown <len.brown@intel.com>,
Wei Yongjun <yongjun_wei@trendmicro.com.cn>,
linux-doc@vger.kernel.org, linux-pm@vger.kernel.org
Subject: Re: [PATCH v2 1/2] hibernate: create "nohibernate" boot parameter
Date: Fri, 13 Jun 2014 12:56:10 +0200 [thread overview]
Message-ID: <20140613105610.GC4876@amd.pavel.ucw.cz> (raw)
In-Reply-To: <1402606833-9825-2-git-send-email-keescook@chromium.org>
On Thu 2014-06-12 14:00:32, Kees Cook wrote:
> To support using kernel features that are not compatible with hibernation,
> this creates the "nohibernate" kernel boot parameter to disable both
> hibernation and resume. This allows hibernation support to be a boot-time
> choice instead of only a compile-time choice.
>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> @@ -639,6 +645,11 @@ int hibernate(void)
> {
> int error;
>
> + if (!hibernation_available()) {
> + pr_debug("PM: Hibernation not available.\n");
> + return -EINVAL;
> + }
> +
> lock_system_sleep();
> /* The snapshot device should not be opened while we're running */
> if (!atomic_add_unless(&snapshot_device_available, -1, 0)) {
> @@ -931,6 +945,9 @@ static ssize_t disk_store(struct kobject *kobj, struct kobj_attribute *attr,
> char *p;
> int mode = HIBERNATION_INVALID;
>
> + if (!hibernation_available())
> + return -EINVAL;
> +
> p = memchr(buf, '\n', n);
> len = p ? p - buf : n;
>
> diff --git a/kernel/power/user.c b/kernel/power/user.c
> index 98d357584cd6..000b94419182 100644
> --- a/kernel/power/user.c
> +++ b/kernel/power/user.c
> @@ -49,6 +49,9 @@ static int snapshot_open(struct inode *inode, struct file *filp)
> struct snapshot_data *data;
> int error;
>
> + if (!hibernation_available())
> + return -EINVAL;
> +
> lock_system_sleep();
>
> if (!atomic_add_unless(&snapshot_device_available, -1, 0)) {
Is EINVAL right error code for "root disabled that option"?
Otherwise it looks ok, you can add my ack with that fixed.
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
next prev parent reply other threads:[~2014-06-13 10:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-12 21:00 [PATCH v2 0/2] make kASLR vs hibernation boot-time selectable Kees Cook
2014-06-12 21:00 ` [PATCH v2 1/2] hibernate: create "nohibernate" boot parameter Kees Cook
2014-06-13 10:56 ` Pavel Machek [this message]
2014-06-13 11:43 ` Josh Boyer
2014-06-12 21:00 ` [PATCH v2 2/2] x86, kaslr: boot-time selectable with hibernation Kees Cook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140613105610.GC4876@amd.pavel.ucw.cz \
--to=pavel@ucw.cz \
--cc=hpa@zytor.com \
--cc=keescook@chromium.org \
--cc=len.brown@intel.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rdunlap@infradead.org \
--cc=rjw@rjwysocki.net \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--cc=yongjun_wei@trendmicro.com.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®