Difference between revisions of "User talk:NonerKao"

From ArchWiki
Jump to navigation Jump to search
(talk pages should not be categorized)
(Tag: wiki-scripts)
(clear the KLP part)
Line 1: Line 1:
--[[User:NonerKao|NonerKao]] ([[User talk:NonerKao|talk]]) 13:49, 19 October 2015 (UTC)
--[[User:NonerKao|NonerKao]] ([[User talk:NonerKao|talk]]) 13:49, 19 October 2015 (UTC)
== The implementation of a new page: Live Patching ==
--[[User:NonerKao|NonerKao]] ([[User talk:NonerKao|talk]]) 05:07, 5 August 2017 (UTC)
Kernel Live Patching (KLP) allows quick fixes to the kernel space without rebooting the whole system.  Since version 4.0, related patches have been accepted [https://lwn.net/Articles/619390/][https://lwn.net/Articles/622936/][https://lwn.net/Articles/634649/], so one can configure his/her kernel to enable this feature.  Generally, KLP is achieved by the following steps:
# Obtain the source tree of the running kernel
# Prepare the patch against the kernel
# Apply some tools (as follows) to help transform and load the patch
Some projects provide the live patching utilities even before KLP was officially supported, such as Oracle's [[#ksplice]], SuSE's [[#kGraft]], and RedHat's [[#kpatch]].  They implement the KLP functionality in different ways.  The minimalistic set of patches entered mainstream kernel were derived from kpatch and kGraft.
{{Related articles start}}
{{Related|Kernel modules}}
{{Related articles end}}
== kpatch[https://en.wikipedia.org/wiki/Kpatch] ==
=== Installation ===
Install {{AUR|linux-kpatch}} for an appropriate kernel and {{AUR|kpatch-git}} for userspace tools.
{{Note|You can also manually build a kernel that supports kpatch usage, by enabling ''ONFIG_LIVEPATCH'', ''CONFIG_DEBUG_INFO'', and ''CONFIG_KALLSYMS''.}}
{{Note|Remember to update the bootloader.}}
=== Usage ===
Once both packages are successfully built and after reboot, you may
$ export ROOTDIR=some/dir/aur/linux-kpatch/src/linux-x-y
Assume that you have done some modifications and have a patch ''some.patch'' (against the source tree after a {{ic|makepkg -o}}, not the vanilla kernel of version ''x.y'') in the working directory. Launch the kpatch utility,
$ kpatch-build -s $(pwd) -t $(pwd)/vmlinux ''some.patch''
This command involves two kernel builds, the original one and the patched one, so it may take a period of time to complete.  After the build is over, there should be a ''kpatch-some.ko'' module in the same directory.  And then,
# insmod ''kpatch-some.ko''
should do the trick.
For further information, please check the manpages or [https://github.com/dynup/kpatch the github repository].
== kGraft[https://en.wikipedia.org/wiki/KGraft] ==
KGraft hasn't been tested in Arch environment, so is not supported as of this writing.
== ksplice ==
{{Warning|The support of ksplice for Arch is not maintained.  This section serves as an archive.}}
=== Installation ===
Install the {{AUR|ksplice-git}}{{Broken package link|{{aur-mirror|ksplice-git}}}} package from the [[Arch User Repository]].
=== Usage ===
First, you need the kernel source tree for the kernel you are currently running, and some files from the previous kernel build: {{ic|System.map}} and {{ic|.config}}.
If you don't have {{ic|System.map}} from the previous build, you can copy {{ic|/proc/kallsyms}} as an equivalent. If the {{ic|kernel.kptr_restrict}} kernel parameter is enabled, remember to copy it as root.
This example makes use of the {{ic|--diffext}} option which creates a patch based on the differences between the old and the new source files.
Make a {{ic|ksplice}} directory in the kernel source tree, copy {{ic|System.map}} over from the previous build, and copy {{ic|.config}} into the tree if it is not already in the source tree:
# mkdir -p src/ksplice
# cp System.map src/ksplice
# cp .config src/
Create a ksplice patch and wait for the kernel to rebuild.
All files that end with {{ic|new}} will be compiled into the ksplice patch. C source files, for example, should end in {{ic|.cnew}} as the diffext is appended directly.
# ksplice-create --diffext=new src/
Apply the newly generated patch to the running kernel:
# ksplice-apply ksplice-*.tar.gz
See man pages for {{ic|ksplice-apply}}, {{ic|ksplice-create}}, {{ic|ksplice-view}}, and {{ic|ksplice-undo}}.
== See also ==
* [https://www.kernel.org/doc/Documentation/livepatch/livepatch.txt The kernel document of livepatch]
* [[wikipedia:Kpatch]]
* [[wikipedia:KGraft]]
* [[wikipedia:Ksplice]]

Latest revision as of 05:07, 5 August 2017

--NonerKao (talk) 13:49, 19 October 2015 (UTC)

--NonerKao (talk) 05:07, 5 August 2017 (UTC)