Re: [RFC PATCH 0/2] kpatch: dynamic kernel patching

2014-05-07 Thread Josh Poimboeuf
On Wed, May 07, 2014 at 02:24:44PM +0200, Ingo Molnar wrote: * Josh Poimboeuf jpoim...@redhat.com wrote: Ah this reminds me when we chased kprobes dangerous spots and we tried to declare __kprobes the functions which were too dangerous to hot patch. We eventually gave up

Re: [RFC PATCH 0/2] kpatch: dynamic kernel patching

2014-05-07 Thread Josh Poimboeuf
On Wed, May 07, 2014 at 05:57:54PM +0200, Ingo Molnar wrote: Live patching does not enter into this question, ever. The correctness of a patch to the source does not depend on 'live patching' considerations in any way, shape or form. Any mechanism that tries to blur these lines is broken

Re: [RFC PATCH 0/2] kpatch: dynamic kernel patching

2014-05-08 Thread Josh Poimboeuf
On Thu, May 08, 2014 at 09:08:15AM +0200, Ingo Molnar wrote: * David Lang da...@lang.hm wrote: On Thu, 8 May 2014, Ingo Molnar wrote: No! A patch to the kernel source is 'safe' if it results in a correctly patched kernel source. Full stop! Live patching does not enter

Re: [PATCH ftrace/core 0/2] ftrace, kprobes: Introduce IPMODIFY flag for ftrace_ops to detect conflicts

2014-06-11 Thread Josh Poimboeuf
On Tue, Jun 10, 2014 at 10:50:01AM +, Masami Hiramatsu wrote: Hi, Here is a pair of patches which introduces IPMODIFY flag for ftrace_ops to detect conflicts of ftrace users who can modify regs-ip in their handler. Currently, only kprobes can change the regs-ip in the handler, but

Re: [PATCH ftrace/core 0/2] ftrace, kprobes: Introduce IPMODIFY flag for ftrace_ops to detect conflicts

2014-06-12 Thread Josh Poimboeuf
On Thu, Jun 12, 2014 at 02:44:35PM +0900, Masami Hiramatsu wrote: (2014/06/12 1:58), Josh Poimboeuf wrote: On Tue, Jun 10, 2014 at 10:50:01AM +, Masami Hiramatsu wrote: Hi, Here is a pair of patches which introduces IPMODIFY flag for ftrace_ops to detect conflicts of ftrace users

Re: [PATCH ftrace/core 0/2] ftrace, kprobes: Introduce IPMODIFY flag for ftrace_ops to detect conflicts

2014-06-12 Thread Josh Poimboeuf
On Thu, Jun 12, 2014 at 12:28:53PM +0900, Namhyung Kim wrote: Hi Josh, On Wed, 11 Jun 2014 11:58:26 -0500, Josh Poimboeuf wrote: On Tue, Jun 10, 2014 at 10:50:01AM +, Masami Hiramatsu wrote: Hi, Here is a pair of patches which introduces IPMODIFY flag for ftrace_ops to detect

Re: [RFC PATCH 0/2] kpatch: dynamic kernel patching

2014-05-20 Thread Josh Poimboeuf
On Tue, May 20, 2014 at 11:37:16AM +0200, Jiri Kosina wrote: On Fri, 16 May 2014, Josh Poimboeuf wrote: Consider this scenario: void foo() { for (i=0; i1; i++) { bar(i); something_else(i

Re: [RFC PATCH 0/2] kpatch: dynamic kernel patching

2014-05-16 Thread Josh Poimboeuf
On Fri, May 16, 2014 at 06:27:27PM +0200, Jiri Kosina wrote: On Tue, 6 May 2014, Steven Rostedt wrote: However, I also think if users can accept such freezing wait-time, it means they can also accept kexec based checkpoint-restart patching. So, I think the final goal of the kpatch will

[RFC PATCH 0/2] kpatch: dynamic kernel patching

2014-05-01 Thread Josh Poimboeuf
is removed. - kretprobes removes the probed function's calling function's IP from the stack, which could lead to a false negative in the kpatch backtrace safety check. [1] http://thread.gmane.org/gmane.linux.kernel/1694304 [2] https://github.com/dynup/kpatch Josh Poimboeuf (2

[RFC PATCH 2/2] kpatch: add kpatch core module

2014-05-01 Thread Josh Poimboeuf
(thanks to Masami for helping with this) Signed-off-by: Josh Poimboeuf jpoim...@redhat.com Cc: Seth Jennings sjenn...@redhat.com Cc: Masami Hiramatsu masami.hiramatsu...@hitachi.com --- Documentation/kpatch.txt | 193 +++ MAINTAINERS | 9 + arch/Kconfig | 14

[RFC PATCH 1/2] kpatch: add TAINT_KPATCH flag

2014-05-01 Thread Josh Poimboeuf
Add a TAINT_KPATCH flag to be set whenever a kpatch patch module successfully replaces a function. Signed-off-by: Josh Poimboeuf jpoim...@redhat.com Cc: Seth Jennings sjenn...@redhat.com --- Documentation/oops-tracing.txt | 3 +++ Documentation/sysctl/kernel.txt | 1 + include/linux/kernel.h

Re: [RFC PATCH 0/2] kpatch: dynamic kernel patching

2014-05-01 Thread Josh Poimboeuf
On Thu, May 01, 2014 at 01:45:33PM -0700, Andi Kleen wrote: Josh Poimboeuf jpoim...@redhat.com writes: kpatch checks the backtraces of all tasks in stop_machine() to ensure that no instances of the old function are running when the new function is applied. How does that work for tail

Re: [RFC PATCH 0/2] kpatch: dynamic kernel patching

2014-05-01 Thread Josh Poimboeuf
On Thu, May 01, 2014 at 11:06:01PM +0200, Andi Kleen wrote: When bar returns, would it skip foo and go straight back to foo's caller? If so, then it should be safe to patch foo after it jumps to bar. foo is no problem, you see it in the backtrace. But you don't see bar. Sorry, I missed

Re: [RFC PATCH 0/2] kpatch: dynamic kernel patching

2014-05-01 Thread Josh Poimboeuf
On Thu, May 01, 2014 at 04:27:46PM -0500, Josh Poimboeuf wrote: On Thu, May 01, 2014 at 11:06:01PM +0200, Andi Kleen wrote: When bar returns, would it skip foo and go straight back to foo's caller? If so, then it should be safe to patch foo after it jumps to bar. foo is no problem

Re: [RFC PATCH 0/2] kpatch: dynamic kernel patching

2014-05-02 Thread Josh Poimboeuf
On Fri, May 02, 2014 at 10:37:53AM +0200, Jiri Kosina wrote: On Thu, 1 May 2014, Josh Poimboeuf wrote: Since Jiri posted the kGraft patches [1], I wanted to share an alternative live patching solution called kpatch, which is something we've been working on at Red Hat for quite a while

Re: [RFC PATCH 0/2] kpatch: dynamic kernel patching

2014-05-02 Thread Josh Poimboeuf
On Fri, May 02, 2014 at 03:10:58PM +0200, Jiri Kosina wrote: On Thu, 1 May 2014, Josh Poimboeuf wrote: kpatch vs kGraft I think the biggest difference between kpatch and kGraft is how they ensure that the patch is applied atomically and safely. kpatch checks

Re: [RFC PATCH 0/2] kpatch: dynamic kernel patching

2014-05-05 Thread Josh Poimboeuf
On Mon, May 05, 2014 at 10:55:37AM +0200, Ingo Molnar wrote: * Josh Poimboeuf jpoim...@redhat.com wrote: [...] kpatch checks the backtraces of all tasks in stop_machine() to ensure that no instances of the old function are running when the new function is applied. I think

Re: [RFC PATCH 0/2] kpatch: dynamic kernel patching

2014-05-06 Thread Josh Poimboeuf
On Mon, May 05, 2014 at 11:49:23PM +0200, Frederic Weisbecker wrote: On Mon, May 05, 2014 at 08:43:04PM +0200, Ingo Molnar wrote: If a kernel refuses to patch with certain threads running, that will drive those kernel threads being fixed and such. It's a deterministic, recoverable,

Re: [RFC PATCH 0/2] kpatch: dynamic kernel patching

2014-05-06 Thread Josh Poimboeuf
On Mon, May 05, 2014 at 06:59:29PM -0700, David Lang wrote: On Tue, 6 May 2014, Jiri Kosina wrote: On Mon, 5 May 2014, David Lang wrote: how would you know that all instances of the datastructure in memory have= been touched? just because all tasks have run and are outside the function in

Re: [RFC PATCH 0/2] kpatch: dynamic kernel patching

2014-05-06 Thread Josh Poimboeuf
On Tue, May 06, 2014 at 09:32:28AM +0200, Ingo Molnar wrote: * Jiri Kosina jkos...@suse.cz wrote: On Mon, 5 May 2014, David Lang wrote: how would you know that all instances of the datastructure in memory have= been touched? just because all tasks have run and are outside the

Re: [RFC PATCH 0/2] kpatch: dynamic kernel patching

2014-05-06 Thread Josh Poimboeuf
On Tue, May 06, 2014 at 04:05:21PM +0200, Frederic Weisbecker wrote: On Tue, May 06, 2014 at 07:12:11AM -0500, Josh Poimboeuf wrote: On Mon, May 05, 2014 at 11:49:23PM +0200, Frederic Weisbecker wrote: On Mon, May 05, 2014 at 08:43:04PM +0200, Ingo Molnar wrote: If a kernel refuses

Re: [RFC][PATCH 0/3] ftrace: Add dynamically allocated trampolines

2014-07-10 Thread Josh Poimboeuf
On Thu, Jul 03, 2014 at 04:07:50PM -0400, Steven Rostedt wrote: [ NOT READY FOR INCLUSION! ] Note, this is based off of my remove ftrace_start/stop() patch set. I've been wanting to do this for years, and just never gotten around to it. But with all this talk of kpatch and kgraft live

Re: [RFC][PATCH 0/3] ftrace: Add dynamically allocated trampolines

2014-07-10 Thread Josh Poimboeuf
On Thu, Jul 10, 2014 at 11:44:43PM +0200, Jiri Kosina wrote: On Thu, 10 Jul 2014, Josh Poimboeuf wrote: I did some testing with kpatch and I found one minor issue. The dynamically allocated trampoline seems to confuse dump_stack() somewhat. I added a dump_stack() call in my ftrace_ops

Re: [RFC][PATCH 0/3] ftrace: Add dynamically allocated trampolines

2014-07-11 Thread Josh Poimboeuf
951d2aec17885a62905df6b910dc705d99c63993 Mon Sep 17 00:00:00 2001 From: Josh Poimboeuf jpoim...@redhat.com Date: Fri, 11 Jul 2014 08:58:33 -0500 Subject: [PATCH] x86/dumpstack: fix stack traces for generated code If a function in the stack trace is dynamically generated, for example an ftrace dynamically

Re: [PATCH -tip v2 0/3] ftrace, kprobes: Introduce IPMODIFY flag for ftrace_ops to detect conflicts

2014-06-18 Thread Josh Poimboeuf
On Tue, Jun 17, 2014 at 11:04:36AM +, Masami Hiramatsu wrote: Hi, Here is the version 2 of the series of patches which introduces IPMODIFY flag for ftrace_ops to detect conflicts of ftrace users who can modify regs-ip in their handler. In this version, I fixed some bugs in previous

Re: [PATCH -tip v2 0/3] ftrace, kprobes: Introduce IPMODIFY flag for ftrace_ops to detect conflicts

2014-06-19 Thread Josh Poimboeuf
On Thu, Jun 19, 2014 at 02:03:31PM +0900, Masami Hiramatsu wrote: (2014/06/19 11:08), Josh Poimboeuf wrote: On Tue, Jun 17, 2014 at 11:04:36AM +, Masami Hiramatsu wrote: Hi, Here is the version 2 of the series of patches which introduces IPMODIFY flag for ftrace_ops to detect

[PATCH v2 1/2] kpatch: add TAINT_KPATCH flag

2014-07-14 Thread Josh Poimboeuf
Add a TAINT_KPATCH flag to be set whenever a kpatch patch module successfully replaces a function. Signed-off-by: Josh Poimboeuf jpoim...@redhat.com Cc: Seth Jennings sjenn...@redhat.com --- Documentation/oops-tracing.txt | 3 +++ Documentation/sysctl/kernel.txt | 1 + include/linux/kernel.h

[PATCH v2 0/2] kpatch: dynamic kernel patching

2014-07-14 Thread Josh Poimboeuf
Jennings - Masami Hiramatsu - Jincheng Miao - Jan Stancek - Gaetan Trellu [1] https://github.com/dynup/kpatch Josh Poimboeuf (2): kpatch: add TAINT_KPATCH flag kpatch: add kpatch core module Documentation/kpatch.txt| 209 Documentation/oops-tracing.txt |3

[PATCH v2 2/2] kpatch: add kpatch core module

2014-07-14 Thread Josh Poimboeuf
- ability to force skip the activeness safety stack check for a given function - kpatch_[register|unregister] are properly synchronized with kpatch_ftrace_handler() when it runs in NMI context (thanks to Masami for helping with this) Signed-off-by: Josh Poimboeuf jpoim...@redhat.com Cc: Seth

Re: [PATCH v2 0/2] kpatch: dynamic kernel patching

2014-07-15 Thread Josh Poimboeuf
On Tue, Jul 15, 2014 at 07:30:38PM +0200, Xypron wrote: Hello Josh, being able to patch a live kernel is very interesting feature. I looked through you patch and some questions remained: In Documentation/kpatch.txt I found no description on how an out of kernel program uses the new code.

Re: kGraft to -next [was: 00/21 kGraft]

2014-07-02 Thread Josh Poimboeuf
On Wed, Jul 02, 2014 at 08:30:02AM -0400, Tejun Heo wrote: Hello, On Wed, Jul 02, 2014 at 02:04:38PM +0200, Jiri Slaby wrote: On 06/25/2014 01:05 PM, Jiri Slaby wrote: ... https://git.kernel.org/cgit/linux/kernel/git/jirislaby/kgraft.git/log/?h=kgraft Stephen, may I ask you to

Re: (ltc-kernel 9786) [PATCH ftrace/core v4 0/4] ftrace, kprobes: Introduce IPMODIFY flag for ftrace_ops to detect conflicts

2014-08-08 Thread Josh Poimboeuf
On Fri, Aug 08, 2014 at 08:05:13PM +0900, Masami Hiramatsu wrote: Ping? For the series: Tested-by: Josh Poimboeuf jpoim...@redhat.com BTW, I'd like to add this testcase if ftracetest is accepted. Thank you, (2014/07/28 14:22), Masami Hiramatsu wrote: Hi, Here is the 4th version

Re: [PATCH] kprobes: add kprobe_is_function_probed()

2014-10-21 Thread Josh Poimboeuf
On Tue, Oct 21, 2014 at 05:48:30PM +0200, Jiri Kosina wrote: Add a function that allows external users (such as live patching mechanisms) to check whether a given function (identified by symbol name) has a kprobe installed in it. Functions aren't uniquely identifiable by name. Perhaps it

Re: [PATCH] kprobes: add kprobe_is_function_probed()

2014-10-21 Thread Josh Poimboeuf
On Tue, Oct 21, 2014 at 10:19:30PM +0200, Jiri Kosina wrote: On Tue, 21 Oct 2014, Josh Poimboeuf wrote: Add a function that allows external users (such as live patching mechanisms) to check whether a given function (identified by symbol name) has a kprobe installed

Re: [PATCH] kprobes: add kprobe_is_function_probed()

2014-10-21 Thread Josh Poimboeuf
On Tue, Oct 21, 2014 at 11:25:56PM +0200, Jiri Kosina wrote: On Tue, 21 Oct 2014, Josh Poimboeuf wrote: This is a rather difficult call actually. I am of course aware of the fact that kernel fucntions can't be uniquely identified by name, but when thinking about this, one has

Re: [PATCH 0/2] Kernel Live Patching

2014-11-18 Thread Josh Poimboeuf
On Tue, Nov 18, 2014 at 01:47:46PM +0100, Petr Mladek wrote: On Thu 2014-11-13 17:38:04, Vojtech Pavlik wrote: On Fri, Nov 14, 2014 at 12:56:38AM +0900, Masami Hiramatsu wrote: It'd be mostly based on your refcounting code, including stack checking (when a process sleeps, counter gets

Re: [PATCHv2 2/3] kernel: add support for live patching

2014-11-20 Thread Josh Poimboeuf
On Sun, Nov 16, 2014 at 07:29:23PM -0600, Seth Jennings wrote: +static int lpc_module_notify(struct notifier_block *nb, unsigned long action, + void *data) +{ + struct module *mod = data; + struct lpc_patch *patch; + struct lpc_object *obj; + +

Re: [PATCHv2 2/3] kernel: add support for live patching

2014-11-20 Thread Josh Poimboeuf
On Thu, Nov 20, 2014 at 02:10:33PM +0100, Miroslav Benes wrote: On Sun, 16 Nov 2014, Seth Jennings wrote: This commit introduces code for the live patching core. It implements an ftrace-based mechanism and kernel interface for doing live patching of kernel and kernel module functions.

Re: [PATCHv3 2/3] kernel: add support for live patching

2014-11-21 Thread Josh Poimboeuf
On Fri, Nov 21, 2014 at 03:44:35PM +0100, Miroslav Benes wrote: On Fri, 21 Nov 2014, Jiri Kosina wrote: [...] [ ... snip ... ] +static int klp_init_patch(struct klp_patch *patch) +{ + int ret; + + mutex_lock(klp_mutex); + + /* init */ + patch-state = LPC_DISABLED;

Re: [PATCHv3 2/3] kernel: add support for live patching

2014-11-21 Thread Josh Poimboeuf
On Fri, Nov 21, 2014 at 01:22:33AM +0100, Jiri Kosina wrote: On Thu, 20 Nov 2014, Seth Jennings wrote: --- /dev/null +++ b/kernel/livepatch/Kconfig @@ -0,0 +1,18 @@ +config ARCH_HAVE_LIVE_PATCHING + boolean + help + Arch supports kernel live patching + +config

Re: [PATCHv3 2/3] kernel: add support for live patching

2014-11-21 Thread Josh Poimboeuf
On Fri, Nov 21, 2014 at 04:27:57PM +0100, Jiri Kosina wrote: On Fri, 21 Nov 2014, Josh Poimboeuf wrote: I think we can use depends on HAVE_FENTRY to accomplish this, since CC_USING_FENTRY gets set by the top level kernel Makefile if CONFIG_HAVE_FENTRY is set. The problem

Re: [PATCHv3 2/3] kernel: add support for live patching

2014-11-24 Thread Josh Poimboeuf
On Mon, Nov 24, 2014 at 12:13:20PM +0100, Thomas Gleixner wrote: On Thu, 20 Nov 2014, Seth Jennings wrote: This commit introduces code for the live patching core. It implements an ftrace-based mechanism and kernel interface for doing live patching of kernel and kernel module functions.

Re: [PATCH 0/2] Kernel Live Patching

2014-11-10 Thread Josh Poimboeuf
On Sat, Nov 08, 2014 at 09:07:54AM +0100, Vojtech Pavlik wrote: On Fri, Nov 07, 2014 at 09:45:53PM -0600, Josh Poimboeuf wrote: On Fri, Nov 07, 2014 at 10:27:35PM +0100, Vojtech Pavlik wrote: On Fri, Nov 07, 2014 at 09:45:00AM -0600, Josh Poimboeuf wrote: LEAVE_FUNCTION

Re: [PATCH 2/2] kernel: add support for live patching

2014-11-10 Thread Josh Poimboeuf
On Mon, Nov 10, 2014 at 11:08:00AM +0100, Jiri Kosina wrote: On Thu, 6 Nov 2014, Seth Jennings wrote: diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c new file mode 100644 index 000..b32dbb5 --- /dev/null +++ b/kernel/livepatch/core.c [ ... snip ... ]

Re: [PATCH 0/2] Kernel Live Patching

2014-11-11 Thread Josh Poimboeuf
On Tue, Nov 11, 2014 at 10:05:05AM +0100, Vojtech Pavlik wrote: On Mon, Nov 10, 2014 at 11:09:03AM -0600, Josh Poimboeuf wrote: But there are a few (probably much less than 10%) cases like the locking one I used above, where SWITCH_THREAD just isn't going to cut it and for those I would

Re: [PATCH 2/2] kernel: add support for live patching

2014-11-13 Thread Josh Poimboeuf
On Thu, Nov 13, 2014 at 11:16:00AM +0100, Miroslav Benes wrote: Hi, thank you for the first version of the united live patching core. The patch below implements some of our review objections. Changes are described in the commit log. It simplifies the hierarchy of data structures,

Re: livepatching tree for linux-next

2014-12-23 Thread Josh Poimboeuf
On Tue, Dec 23, 2014 at 01:46:07AM -0800, Christoph Hellwig wrote: On Mon, Dec 22, 2014 at 08:52:02PM +0100, Jiri Kosina wrote: Hi Stephen, a substantial amount of work has been invested into abstracing Live Patching core functionality out of the already existing implementations, so

[PATCH] samples/livepatch: fix usage example comments

2014-12-23 Thread Josh Poimboeuf
Fix a few typos in the livepatch-sample.c usage example comments and add some whitespace to make the comments a little more legible. Reported-by: Udo Seidel udosei...@gmx.de Signed-off-by: Josh Poimboeuf jpoim...@redhat.com --- samples/livepatch/livepatch-sample.c | 6 +- 1 file changed, 5

Re: [PATCHv4 0/3] Kernel Live Patching

2014-11-26 Thread Josh Poimboeuf
On Wed, Nov 26, 2014 at 10:18:24AM +0100, Jiri Kosina wrote: On Wed, 26 Nov 2014, Masami Hiramatsu wrote: Note to Steve: Masami's IPMODIFY patch is heading for -next via your tree. Once it arrives, I'll rebase and make the change to set IPMODIFY. Do not pull this for -next

Re: [PATCHv4 2/3] kernel: add support for live patching

2014-11-26 Thread Josh Poimboeuf
Hi Miroslav, Just addressing one of your comments below. I'll let Seth respond to the others :-) On Wed, Nov 26, 2014 at 03:19:17PM +0100, Miroslav Benes wrote: +/** + * struct klp_func - function structure for live patching + * @old_name: name of the function to be patched + *

Re: [PATCHv4 0/3] Kernel Live Patching

2014-11-26 Thread Josh Poimboeuf
On Wed, Nov 26, 2014 at 06:00:54PM +0900, Masami Hiramatsu wrote: (2014/11/26 2:15), Seth Jennings wrote: Note to Steve: Masami's IPMODIFY patch is heading for -next via your tree. Once it arrives, I'll rebase and make the change to set IPMODIFY. Do not pull this for -next yet. This

Re: [PATCH 1/6] livepatch v5: avoid race when checking for state of the patch

2014-12-11 Thread Josh Poimboeuf
On Thu, Dec 11, 2014 at 12:17:33PM +0100, Petr Mladek wrote: On Wed 2014-12-10 09:25:06, Josh Poimboeuf wrote: On Wed, Dec 10, 2014 at 11:11:47AM +0100, Petr Mladek wrote: On Tue 2014-12-09 12:32:49, Josh Poimboeuf wrote: But livepatch isn't a module, it's part of the kernel. Ah, I

Re: [PATCHv6 2/3] kernel: add support for live patching

2014-12-13 Thread Josh Poimboeuf
On Fri, Dec 12, 2014 at 05:58:19PM +0100, Miroslav Benes wrote: Hi, I think we are really close (or I hope so). I found few suspicious things or nitpicks though. They might have applied also to v5, but I didn't manage to look at that. Sorry about that. On Wed, 10 Dec 2014, Josh

Re: [PATCH 2/2] kernel: add support for live patching

2014-11-06 Thread Josh Poimboeuf
On Thu, Nov 06, 2014 at 10:20:49AM -0600, Seth Jennings wrote: On Thu, Nov 06, 2014 at 04:11:37PM +0100, Jiri Kosina wrote: On Thu, 6 Nov 2014, Seth Jennings wrote: +/ + * dynamic relocations (load-time linker) +

Re: [PATCH 2/2] kernel: add support for live patching

2014-11-06 Thread Josh Poimboeuf
On Thu, Nov 06, 2014 at 10:57:48AM -0600, Seth Jennings wrote: On Thu, Nov 06, 2014 at 04:51:02PM +0100, Jiri Slaby wrote: On 11/06/2014, 03:39 PM, Seth Jennings wrote: +/* must be called with lpc_mutex held */ +static int lpc_enable_patch(struct lpc_patch *patch) The question I want

Re: [PATCH 0/2] Kernel Live Patching

2014-11-06 Thread Josh Poimboeuf
On Thu, Nov 06, 2014 at 10:58:57AM -0800, Christoph Hellwig wrote: On Thu, Nov 06, 2014 at 07:51:57PM +0100, Vojtech Pavlik wrote: I don't think this specific example was generated. So there are two ways to use this live patching API: using a generated module (e.g., using the kpatch-build

Re: [PATCH 0/2] Kernel Live Patching

2014-11-06 Thread Josh Poimboeuf
On Thu, Nov 06, 2014 at 02:49:26PM -0500, Steven Rostedt wrote: On Thu, 6 Nov 2014 13:34:33 -0600 Josh Poimboeuf jpoim...@redhat.com wrote: On Thu, Nov 06, 2014 at 10:58:57AM -0800, Christoph Hellwig wrote: On Thu, Nov 06, 2014 at 07:51:57PM +0100, Vojtech Pavlik wrote: I don't think

Re: [PATCH 0/2] Kernel Live Patching

2014-11-07 Thread Josh Poimboeuf
On Thu, Nov 06, 2014 at 09:24:23PM +0100, Vojtech Pavlik wrote: On Thu, Nov 06, 2014 at 10:58:57AM -0800, Christoph Hellwig wrote: On Thu, Nov 06, 2014 at 07:51:57PM +0100, Vojtech Pavlik wrote: I don't think this specific example was generated. I also don't think including the

Re: [PATCH 2/2] kernel: add support for live patching

2014-11-07 Thread Josh Poimboeuf
On Thu, Nov 06, 2014 at 11:20:48PM +0100, Jiri Kosina wrote: On Thu, 6 Nov 2014, Seth Jennings wrote: Thanks a lot for having started the work on this! We will be reviewing it carefully in the coming days and will getting back to you (I was surprised to see that that diffstat

Re: [PATCH 0/2] Kernel Live Patching

2014-11-07 Thread Josh Poimboeuf
On Fri, Nov 07, 2014 at 01:48:45PM +0100, Vojtech Pavlik wrote: On Fri, Nov 07, 2014 at 06:31:54AM -0600, Josh Poimboeuf wrote: On Thu, Nov 06, 2014 at 09:24:23PM +0100, Vojtech Pavlik wrote: On Thu, Nov 06, 2014 at 10:58:57AM -0800, Christoph Hellwig wrote: On Thu, Nov 06, 2014

Re: [PATCH 0/2] Kernel Live Patching

2014-11-07 Thread Josh Poimboeuf
On Thu, Nov 06, 2014 at 11:47:45PM -0800, Christoph Hellwig wrote: On Thu, Nov 06, 2014 at 09:24:23PM +0100, Vojtech Pavlik wrote: One reason is that there are currently at least two generators using very different methods of generation (in addition to the option of doing the patch module

Re: [PATCH 2/2] kernel: add support for live patching

2014-11-07 Thread Josh Poimboeuf
On Fri, Nov 07, 2014 at 02:13:37PM +0100, Jiri Kosina wrote: On Fri, 7 Nov 2014, Josh Poimboeuf wrote: Also, lpc_create_object(), lpc_create_func(), lpc_create_patch(), lpc_create_objects(), lpc_create_funcs(), ... they all are pretty much alike, and are asking for some kind

Re: [PATCH 0/2] Kernel Live Patching

2014-11-07 Thread Josh Poimboeuf
On Fri, Nov 07, 2014 at 03:04:58PM +0100, Vojtech Pavlik wrote: On Fri, Nov 07, 2014 at 07:11:53AM -0600, Josh Poimboeuf wrote: 2. Add consistency model(s) (e.g. kpatch stop_machine, kGraft per-task consistency, Masami's per task ref counting) I have given some thought

Re: [PATCH 2/2] kernel: add support for live patching

2014-11-07 Thread Josh Poimboeuf
On Fri, Nov 07, 2014 at 07:21:03PM +0100, Petr Mladek wrote: On Thu 2014-11-06 10:57:48, Seth Jennings wrote: On Thu, Nov 06, 2014 at 04:51:02PM +0100, Jiri Slaby wrote: On 11/06/2014, 03:39 PM, Seth Jennings wrote: +/* + * Core structures +

Re: more patches for the same func: was Re: [PATCH 2/2] kernel: add support for live patching

2014-11-07 Thread Josh Poimboeuf
On Fri, Nov 07, 2014 at 06:39:03PM +0100, Petr Mladek wrote: On Thu 2014-11-06 08:39:08, Seth Jennings wrote: This commit introduces code for the live patching core. It implements an ftrace-based mechanism and kernel interface for doing live patching of kernel and kernel module functions.

Re: [PATCH 0/2] Kernel Live Patching

2014-11-07 Thread Josh Poimboeuf
On Fri, Nov 07, 2014 at 10:27:35PM +0100, Vojtech Pavlik wrote: On Fri, Nov 07, 2014 at 09:45:00AM -0600, Josh Poimboeuf wrote: LEAVE_FUNCTION LEAVE_PATCHED_SET LEAVE_KERNEL SWITCH_FUNCTION SWITCH_THREAD SWITCH_KERNEL Now with those definitions

[PATCH] livepatch: use FTRACE_OPS_FL_IPMODIFY

2014-12-18 Thread Josh Poimboeuf
. Signed-off-by: Josh Poimboeuf jpoim...@redhat.com --- kernel/livepatch/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c index 0004a71..bdd99975 100644 --- a/kernel/livepatch/core.c +++ b/kernel/livepatch/core.c @@ -640,7

Re: [PATCHv7 0/3] Kernel Live Patching

2014-12-18 Thread Josh Poimboeuf
On Wed, Dec 17, 2014 at 10:21:47AM -0600, Josh Poimboeuf wrote: On Tue, Dec 16, 2014 at 11:58:17AM -0600, Seth Jennings wrote: Changelog: Thanks for all the feedback! I think that we have something that is workable for everyone now. Barring functional defects, I think we should put

Re: [kpatch] [PATCH] livepatch v7: move x86 specific ftrace handler code to arch/x86

2014-12-19 Thread Josh Poimboeuf
-by: Li Bin huawei.li...@huawei.com --- arch/x86/include/asm/livepatch.h |5 + kernel/livepatch/core.c |2 +- 2 files changed, 6 insertions(+), 1 deletions(-) Acked-by: Josh Poimboeuf jpoim...@redhat.com -- Josh -- To unsubscribe from this list: send the line unsubscribe

Re: [PATCH] livepatch: use FTRACE_OPS_FL_IPMODIFY

2014-12-22 Thread Josh Poimboeuf
On Mon, Dec 22, 2014 at 06:34:09PM +0100, Petr Mladek wrote: On Fri 2014-12-19 10:43:35, Petr Mladek wrote: On Thu 2014-12-18 09:49:35, Josh Poimboeuf wrote: On Thu, Dec 18, 2014 at 08:55:21PM +0900, Masami Hiramatsu wrote: (2014/12/17 2:58), Seth Jennings wrote: changes in v7

Re: [PATCHv7 0/3] Kernel Live Patching

2014-12-17 Thread Josh Poimboeuf
gathering acks so that we are in a position to go into -next when the 3.19 window closes. Also, I don't think patches 1/3 and 3/3 have changed since v5, so if you reviewed them then, they haven't changed. For the set: Reviewed-by: Josh Poimboeuf jpoim...@redhat.com -- Josh -- To unsubscribe from

Re: [PATCHv4 2/3] kernel: add support for live patching

2014-12-01 Thread Josh Poimboeuf
On Mon, Dec 01, 2014 at 02:31:35PM +0100, Miroslav Benes wrote: On Wed, 26 Nov 2014, Josh Poimboeuf wrote: Hi Miroslav, Just addressing one of your comments below. I'll let Seth respond to the others :-) On Wed, Nov 26, 2014 at 03:19:17PM +0100, Miroslav Benes wrote

Re: [PATCHv5 2/3] kernel: add support for live patching

2014-12-05 Thread Josh Poimboeuf
On Fri, Dec 05, 2014 at 06:55:04PM +0100, Jiri Slaby wrote: On 12/04/2014, 04:53 PM, Seth Jennings wrote: ... --- /dev/null +++ b/kernel/livepatch/core.c @@ -0,0 +1,902 @@ ... +static struct kobj_type klp_ktype_patch = { + .sysfs_ops = kobj_sysfs_ops, + .default_attrs =

Re: [PATCH 1/6] livepatch v5: avoid race when checking for state of the patch

2014-12-09 Thread Josh Poimboeuf
On Tue, Dec 09, 2014 at 07:05:02PM +0100, Petr Mladek wrote: klp_patch_enable() and klp_patch_disable() should check the current state of the patch under the klp_lock. Otherwise, it might detect that the operation is valid but the situation might change before it takes the lock. Hi Petr,

Re: [PATCH 6/6] livepatch v5: clean up usage of the old and new addresses

2014-12-09 Thread Josh Poimboeuf
On Tue, Dec 09, 2014 at 07:05:07PM +0100, Petr Mladek wrote: The situation with variables storing the address of the old and new code is not ideal. One is called func and the other is called addr. The one is pointer and the other is unsigned long. It makes sense from the point of how the

Re: [PATCH 5/6] livepatch v5: split init and free code that is done only for loaded modules

2014-12-09 Thread Josh Poimboeuf
On Tue, Dec 09, 2014 at 07:05:06PM +0100, Petr Mladek wrote: This patch makes it clear what initialization and freeing steps need to be done when an object (module) is being loaded or removed. It will help to maintain the module coming and going handlers. Also it will remove duplicated code

Re: [PATCH 1/6] livepatch v5: avoid race when checking for state of the patch

2014-12-10 Thread Josh Poimboeuf
On Wed, Dec 10, 2014 at 11:11:47AM +0100, Petr Mladek wrote: On Tue 2014-12-09 12:32:49, Josh Poimboeuf wrote: On Tue, Dec 09, 2014 at 07:05:02PM +0100, Petr Mladek wrote: klp_patch_enable() and klp_patch_disable() should check the current state of the patch under the klp_lock. Otherwise

Re: [PATCH 5/6] livepatch v5: split init and free code that is done only for loaded modules

2014-12-10 Thread Josh Poimboeuf
On Wed, Dec 10, 2014 at 11:30:16AM +0100, Petr Mladek wrote: On Tue 2014-12-09 12:51:41, Josh Poimboeuf wrote: On Tue, Dec 09, 2014 at 07:05:06PM +0100, Petr Mladek wrote: This patch makes it clear what initialization and freeing steps need to be done when an object (module) is being

Re: [PATCH 6/6] livepatch v5: clean up usage of the old and new addresses

2014-12-10 Thread Josh Poimboeuf
On Wed, Dec 10, 2014 at 02:50:54PM +0100, Petr Mladek wrote: On Tue 2014-12-09 13:20:09, Josh Poimboeuf wrote: On Tue, Dec 09, 2014 at 07:05:07PM +0100, Petr Mladek wrote: The situation with variables storing the address of the old and new code is not ideal. One is called func

[PATCHv6 2/3] kernel: add support for live patching

2014-12-10 Thread Josh Poimboeuf
change that can not execute safely with the old version of the function can _not_ be safely applied in this version. Signed-off-by: Seth Jennings sjenn...@redhat.com Signed-off-by: Josh Poimboeuf jpoim...@redhat.com --- Documentation/ABI/testing/sysfs-kernel-livepatch | 44 ++ MAINTAINERS

[PATCHv6 1/3] kernel: add TAINT_LIVEPATCH

2014-12-10 Thread Josh Poimboeuf
From: Seth Jennings sjenn...@redhat.com This adds a new taint flag to indicate when the kernel or a kernel module has been live patched. This will provide a clean indication in bug reports that live patching was used. Additionally, if the crash occurs in a live patched function, the live patch

[PATCHv6 0/3] Kernel Live Patching

2014-12-10 Thread Josh Poimboeuf
Thanks for all the patches and comments for v5. Seth is out this week, so I'm sending this latest patch set in his absence. Changelog: changes in v6: - add empty patch release function - Petr's patches 2-5: - do not quietly ignore wrong usage - find and verify the old address in

[PATCHv6 3/3] samples: add sample live patching module

2014-12-10 Thread Josh Poimboeuf
From: Seth Jennings sjenn...@redhat.com Add a sample live patching module. Signed-off-by: Seth Jennings sjenn...@redhat.com --- MAINTAINERS | 1 + samples/Kconfig | 7 +++ samples/Makefile | 2 +- samples/livepatch/Makefile

Re: [PATCH 2/2] livepatch: disable/enable_patch manners for interdependent patches

2015-01-22 Thread Josh Poimboeuf
On Thu, Jan 22, 2015 at 05:54:23PM +0800, Li Bin wrote: On 2015/1/22 16:39, Li Bin wrote: On 2015/1/22 11:51, Josh Poimboeuf wrote: On Thu, Jan 22, 2015 at 08:42:29AM +0800, Li Bin wrote: On 2015/1/21 22:08, Jiri Kosina wrote: On Wed, 21 Jan 2015, Li Bin wrote: By this you limit

[PATCH] livepatch: add missing newline to error message

2015-02-06 Thread Josh Poimboeuf
Signed-off-by: Josh Poimboeuf jpoim...@redhat.com --- kernel/livepatch/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c index 9adf86b..ff7f47d 100644 --- a/kernel/livepatch/core.c +++ b/kernel/livepatch/core.c @@ -211,7

[PATCH] livepatch: rename config to CONFIG_LIVEPATCH

2015-02-03 Thread Josh Poimboeuf
Rename CONFIG_LIVE_PATCHING to CONFIG_LIVEPATCH to make the naming of the config and the code more consistent. Signed-off-by: Josh Poimboeuf jpoim...@redhat.com --- arch/x86/Kconfig | 2 +- arch/x86/include/asm/livepatch.h | 4 ++-- arch/x86/kernel/Makefile | 2

Re: [PATCH] livepatch: change ARCH_HAVE_LIVE_PATCHING to HAVE_LIVE_PATCHING

2015-01-20 Thread Josh Poimboeuf
Acked-by: Josh Poimboeuf jpoim...@redhat.com --- arch/x86/Kconfig | 2 +- kernel/livepatch/Kconfig | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 460b31b..29b0952 100644 --- a/arch/x86/Kconfig +++ b/arch/x86

Re: [PATCH] livepatch: support for repatching a function

2015-01-20 Thread Josh Poimboeuf
On Tue, Jan 20, 2015 at 10:56:33AM +0100, Miroslav Benes wrote: On Fri, 9 Jan 2015, Josh Poimboeuf wrote: +struct klp_ops { + struct list_head node; + struct list_head func_stack; + struct ftrace_ops fops; +}; I think it would be useful to add some comments for this structure

[PATCH v2 2/2] livepatch: support for repatching a function

2015-01-20 Thread Josh Poimboeuf
between function versions to happen instantaneously by updating the klp_ops struct's func_stack list. The winner is the klp_func at the top of the func_stack (front of the list). Signed-off-by: Josh Poimboeuf jpoim...@redhat.com --- include/linux/livepatch.h | 4 +- kernel/livepatch/core.c

[PATCH v2 0/2] support for stacked patches

2015-01-20 Thread Josh Poimboeuf
Add support for properly stacking patches. This includes enforcing patch stack semantics and allowing functions to be repatched. v2 changes: - add enforce stacking semantics patch - add documentation comments for new klp_ops struct Josh Poimboeuf (2): livepatch: enforce patch stacking

[PATCH v2 1/2] livepatch: enforce patch stacking semantics

2015-01-20 Thread Josh Poimboeuf
Only allow the topmost patch on the stack to be enabled or disabled, so that patches can't be removed or added in an arbitrary order. Suggested-by: Jiri Kosina jkos...@suse.cz Signed-off-by: Josh Poimboeuf jpoim...@redhat.com --- kernel/livepatch/core.c | 10 ++ 1 file changed, 10

Re: [PATCH v2 2/2] livepatch: support for repatching a function

2015-01-20 Thread Josh Poimboeuf
On Tue, Jan 20, 2015 at 04:37:59PM +0100, Jiri Slaby wrote: On 01/20/2015, 04:26 PM, Josh Poimboeuf wrote: Add support for patching a function multiple times. If multiple patches affect a function, the function in the most recently enabled patch wins. This enables a cumulative patch

[PATCH] livepatch: fix uninitialized return value

2015-01-20 Thread Josh Poimboeuf
Fix a potentially uninitialized return value. Signed-off-by: Josh Poimboeuf jpoim...@redhat.com --- kernel/livepatch/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c index bc05d39..9adf86b 100644 --- a/kernel/livepatch

Re: [PATCH 2/2] livepatch: disable/enable_patch manners for interdependent patches

2015-01-21 Thread Josh Poimboeuf
On Thu, Jan 22, 2015 at 08:42:29AM +0800, Li Bin wrote: On 2015/1/21 22:08, Jiri Kosina wrote: On Wed, 21 Jan 2015, Li Bin wrote: By this you limit the definition of the patch inter-dependency to just symbols. But that's not the only way how patches can depend on it other -- the

Re: [PATCH] livepatch: support for repatching a function

2015-01-19 Thread Josh Poimboeuf
On Fri, Jan 16, 2015 at 05:51:11PM +0100, Jiri Kosina wrote: One thing that makes me worried here is we basically apply patches in a 'stackable' manner, but then this allows them to be removed (disabled) in an arbitrary order. Is this really the semantics we want? The scenario I am

Re: [PATCH] livepatch: support for repatching a function

2015-01-19 Thread Josh Poimboeuf
On Mon, Jan 19, 2015 at 08:48:42PM +0100, Jiri Kosina wrote: On Mon, 19 Jan 2015, Josh Poimboeuf wrote: If this is implemented really in a fully stackable manner (i.e. you basically would be able to disable only the function that is currently active, i.e. on top of the stack

Re: [RFC PATCH 8/9] livepatch: allow patch modules to be removed

2015-02-11 Thread Josh Poimboeuf
On Wed, Feb 11, 2015 at 11:55:05AM +0100, Jiri Slaby wrote: On 02/10/2015, 08:57 PM, Josh Poimboeuf wrote: On Tue, Feb 10, 2015 at 08:02:34PM +0100, Jiri Slaby wrote: On 02/09/2015, 06:31 PM, Josh Poimboeuf wrote: --- a/kernel/livepatch/core.c +++ b/kernel/livepatch/core.c

Re: [RFC PATCH 5/9] sched: move task rq locking functions to sched.h

2015-02-10 Thread Josh Poimboeuf
On Tue, Feb 10, 2015 at 07:48:17PM +0900, Masami Hiramatsu wrote: (2015/02/10 2:31), Josh Poimboeuf wrote: Move task_rq_lock/unlock() to sched.h so they can be used elsewhere. The livepatch code needs to lock each task's rq in order to safely examine its stack and switch it to a new patch

Re: [RFC PATCH 6/9] livepatch: create per-task consistency model

2015-02-10 Thread Josh Poimboeuf
On Tue, Feb 10, 2015 at 07:58:30PM +0900, Masami Hiramatsu wrote: (2015/02/10 2:31), Josh Poimboeuf wrote: +/* + * Try to safely transition a task to the universe goal. If the task is + * currently running or is sleeping on a to-be-patched or to-be-unpatched + * function, return false

Re: [RFC PATCH 0/9] livepatch: consistency model

2015-02-10 Thread Josh Poimboeuf
On Tue, Feb 10, 2015 at 09:57:44AM +0100, Jiri Kosina wrote: On Mon, 9 Feb 2015, Josh Poimboeuf wrote: 2) As mentioned above, kthreads which are always sleeping on a patched function will never transition to the new universe. This is really a minor issue (less than 1% of patches

  1   2   3   4   5   6   7   8   9   10   >