From: Vivek Goyal <vgoyal-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: "Michael Kerrisk (man-pages)"
<mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: lkml <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
kexec-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
Andy Lutomirski <luto-kltTT9wpgjJwATOyAt5JVQ@public.gmane.org>,
Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
"H. Peter Anvin" <hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>,
Borislav Petkov <bp-Gina5bIWoIWzQB+pC5nmwQ@public.gmane.org>,
"Eric W. Biederman"
<ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
Subject: Re: Edited kexec_load(2) [kexec_file_load()] man page for review
Date: Tue, 27 Jan 2015 09:24:59 -0500 [thread overview]
Message-ID: <20150127142459.GA12851@redhat.com> (raw)
In-Reply-To: <54B91271.3000600-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
On Fri, Jan 16, 2015 at 02:30:25PM +0100, Michael Kerrisk (man-pages) wrote:
[..]
>
Hi Michael,
Please find my responses below. Sorry, I got stuck in other work and
forgot about this thread.
> So, returning to the kexeec_segment structure:
>
> struct kexec_segment {
> void *buf; /* Buffer in user space */
> size_t bufsz; /* Buffer length in user space */
> void *mem; /* Physical address of kernel */
> size_t memsz; /* Physical address length */
> };
>
> Are the following statements correct:
> * buf + bufsz identify a memory region in the caller's virtual
> address space that is the source of the copy
Yes.
> * mem + memsz specify the target memory region of the copy
Yes.
> * mem is physical memory address, as seen from kernel space
Yes.
> * the number of bytes copied from userspace is min(bufsz, memsz)
Yes. bufsz can not be more than memsz. There is a check to validate
this in kernel.
result = -EINVAL;
for (i = 0; i < nr_segments; i++) {
if (image->segment[i].bufsz > image->segment[i].memsz)
return result;
}
> * if bufsz > memsz, then excess bytes in the user-space buffer
> are ignored.
You will get -EINVAL.
> * if memsz > bufsz, then excess bytes in the target kernel buffer
> are filled with zeros.
Yes.
> Also, it seems to me that 'mem' need not be page aligned.
> Is that correct? Should the man page say something about that?
> (E.g., is it generally desirable that 'mem' should be page aligned?)
mem and memsz need to be page aligned. There is a check for that too.
mstart = image->segment[i].mem;
mend = mstart + image->segment[i].memsz;
if ((mstart & ~PAGE_MASK) || (mend & ~PAGE_MASK))
return result;
>
> Likewise, 'memsz' doesn't need to beta page multiple, IIUC.
> Should the man page say anything about this? For example, should
> it note that the initialized kernel segment will be of size:
>
> (mem % PAGE_SIZE + memsz) rounded up to the next multiple of PAGE_SIZE
>
> And should it note that if 'mem' is not a multiple of the page size, then
> the initial bytes (mem % PAGE_SIZE)) in the first page of the kernel segment
> will be zeros?
>
> (Hopefully I have read kimage_load_normal_segment() correctly.)
Both mem and memsz need to be page aligned.
>
> And one further question. Other than the fact that they are used with
> different system calls, what is the difference between KEXEC_ON_CRASH
> and KEXEC_FILE_ON_CRASH?
Right now I can't think of any other difference. They both tell respective
system call that this kernel needs to be loaded in reserved memory region
for crash kernel.
Thanks
Vivek
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2015-01-27 14:24 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-09 19:17 Edited kexec_load(2) [kexec_file_load()] man page for review Michael Kerrisk (man-pages)
[not found] ` <545FBDDD.9060801-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-11-11 21:30 ` Vivek Goyal
[not found] ` <20141111213037.GA31445-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-01-07 21:17 ` Michael Kerrisk (man-pages)
[not found] ` <54ADA284.30502-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-01-12 22:16 ` Vivek Goyal
[not found] ` <20150112221634.GD16162-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-01-16 13:30 ` Michael Kerrisk (man-pages)
2015-01-27 8:07 ` Michael Kerrisk (man-pages)
[not found] ` <54B91271.3000600-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-01-27 14:24 ` Vivek Goyal [this message]
[not found] ` <20150127142459.GA12851-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-01-28 8:04 ` Michael Kerrisk (man-pages)
[not found] ` <54C89816.8030709-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-01-28 14:48 ` Vivek Goyal
[not found] ` <20150128144803.GC15342-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-01-28 15:49 ` Michael Kerrisk (man-pages)
[not found] ` <CAKgNAkhhVq5fuqwH0aPdgR1bKkAPPPuS84hfAFg3grGEJNxS4w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-28 20:34 ` Vivek Goyal
[not found] ` <20150128203402.GG15342-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-01-28 21:14 ` Scot Doyle
[not found] ` <alpine.DEB.2.11.1501282104490.9275-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2015-01-28 21:31 ` Vivek Goyal
[not found] ` <20150128213125.GH15342-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-01-28 22:10 ` Scot Doyle
[not found] ` <alpine.DEB.2.11.1501282207570.5656-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2015-01-28 22:25 ` Vivek Goyal
2015-01-29 1:27 ` Scot Doyle
[not found] ` <alpine.DEB.2.11.1501290010120.6022-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2015-01-29 5:39 ` Michael Kerrisk (man-pages)
[not found] ` <CAKgNAkjBBRmcpu8DuaGCCRhvXP_AFotK5xrHx2HaR6g_8omULw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-29 16:06 ` Scot Doyle
[not found] ` <alpine.DEB.2.11.1501291429001.1597-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2015-01-30 15:25 ` Michael Kerrisk (man-pages)
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=20150127142459.GA12851@redhat.com \
--to=vgoyal-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
--cc=bp-Gina5bIWoIWzQB+pC5nmwQ@public.gmane.org \
--cc=dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org \
--cc=hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org \
--cc=kexec-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=luto-kltTT9wpgjJwATOyAt5JVQ@public.gmane.org \
--cc=mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
/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;
as well as URLs for NNTP newsgroup(s).