Re: crash binary for latest unreleased kernel

From: Mike Galbraith
Date: Wed Jan 31 2018 - 11:04:22 EST


On Wed, 2018-01-31 at 04:51 +0100, Mike Galbraith wrote:
> On Sun, 2018-01-28 at 12:19 -0800, Joe Smith wrote:
> > Thanks a lot, Mike. Following your suggestions worked !!!!
>
> Until Monday happened :)

And during a rare non-lazy-sod moment...

---
task.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)

--- a/task.c
+++ b/task.c
@@ -438,8 +438,21 @@ task_init(void)
len = SIZE(task_union));
machdep->stacksize = len;
} else if (VALID_SIZE(thread_union) &&
- ((len = SIZE(thread_union)) != STACKSIZE()))
+ ((len = SIZE(thread_union)) != STACKSIZE())) {
machdep->stacksize = len;
+ } else {
+ /*
+ * Post kernel commit 0500871f21b2, init_thread_union size
+ * became zero. Use __end_init_task - __start_init_task.
+ */
+ if (kernel_symbol_exists("__start_init_task") &&
+ kernel_symbol_exists("__end_init_task")) {
+ len = symbol_value("__end_init_task");
+ len -= symbol_value("__start_init_task");
+ ASSIGN_SIZE(thread_union) = len;
+ machdep->stacksize = len;
+ }
+ }

MEMBER_OFFSET_INIT(pid_namespace_idr, "pid_namespace", "idr");
MEMBER_OFFSET_INIT(idr_idr_rt, "idr", "idr_rt");