kexec_stack is misaligned

未關閉
#472 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
3/5
預估耗時
1-2 天
新手友好度
48/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
c, linux

研究方向

從 a/p/kexec/core_64.c 中的 kexec_stack 宣告開始,檢查 __init_task_data 如何針對 powerpc 展開,包括所參照的 commit。重新建置核心並檢查 .build/System.map;當 kexec_stack 以 16384 位元組對齊且不破壞 kexec 路徑時即表示完成。

由索引模型根據 Issue 內容生成。

描述

bug easy

There is code in a/p/kexec/core_64.c:

/*
 * kexec thread structure and stack.
 *
 * We need to make sure that this is 16384-byte aligned due to the
 * way process stacks are handled.  It also must be statically allocated
 * or allocated as part of the kimage, because everything else may be
 * overwritten when we copy the kexec image.  We piggyback on the
 * "init_task" linker section here to statically allocate a stack.
 *
 * We could use a smaller stack if we don't care about anything using
 * current, but that audit has not been performed.
 */
static union thread_union kexec_stack __init_task_data =
	{ };

But since commit torvalds/linux@d11ed3ab3166a2bfad60681aebf3e13e1c3408a9 the __init_task_data macro has expanded to nothing on powerpc, because CONFIG_ARCH_TASK_STRUCT_ON_STACK is not set.

That means kexec_stack is not 16K aligned:

$ grep kexec_stack .build/System.map
c000000002a86800 b kexec_stack

In practice it probably doesn't matter, and no one has reported any breakage.

With modern kernels the only thing that's found by doing arithmetic on the stack pointer is pt_regs, via current_pt_regs(). That tends to only get used in ptrace and exec and so on, so is probably not called during the kexec sequence.

However it's still possible that bugs could be lurking due to the misaligned stack, so it should be properly aligned.

主要語言
沒有語言資料
星號
14
分支
0
PR 合併指標
30 天內沒有已合併 PR

環境準備

這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

linuxppc/issues 的其他 Issue

查看 linuxppc/issues 的全部 Issue

相似的 Issue

更多 Operating Systems Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。