All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] jump_label: Robustify jump label patching
@ 2018-02-14 16:40 Josh Poimboeuf
  2018-02-14 16:40 ` [PATCH 1/3] jump_label: Warn on failed jump_label patch Josh Poimboeuf
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Josh Poimboeuf @ 2018-02-14 16:40 UTC (permalink / raw)
  To: x86
  Cc: linux-kernel, Steven Rostedt, Ingo Molnar, Thomas Gleixner,
	Linus Torvalds, Peter Zijlstra, Jason Baron, Borislav Petkov

Warn if a jump_label fails to patch, and fix up a couple of issues found
by the warning.

Josh Poimboeuf (3):
  jump_label: Warn on failed jump_label patch
  x86/xen: Remove inert tracepoint in __init code
  percpu: Remove inert tracepoint in __init code

 arch/x86/xen/enlighten_pv.c | 2 --
 kernel/jump_label.c         | 8 ++++++--
 mm/percpu.c                 | 1 -
 3 files changed, 6 insertions(+), 5 deletions(-)

-- 
2.14.3

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 1/3] jump_label: Warn on failed jump_label patch
  2018-02-14 16:40 [PATCH 0/3] jump_label: Robustify jump label patching Josh Poimboeuf
@ 2018-02-14 16:40 ` Josh Poimboeuf
  2018-02-14 17:01   ` Steven Rostedt
  2018-02-14 17:01   ` Borislav Petkov
  2018-02-14 16:40 ` [PATCH 2/3] x86/xen: Remove inert tracepoint in __init code Josh Poimboeuf
  2018-02-14 16:40 ` [PATCH 3/3] percpu: " Josh Poimboeuf
  2 siblings, 2 replies; 17+ messages in thread
From: Josh Poimboeuf @ 2018-02-14 16:40 UTC (permalink / raw)
  To: x86
  Cc: linux-kernel, Steven Rostedt, Ingo Molnar, Thomas Gleixner,
	Linus Torvalds, Peter Zijlstra, Jason Baron, Borislav Petkov

When the jump label code encounters an address which isn't recognized by
kernel_text_address(), it just silently fails.

This can be dangerous because jump labels are used in a variety of
places, and are generally expected to work.  Convert the silent failure
to a warning.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
---
 kernel/jump_label.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/kernel/jump_label.c b/kernel/jump_label.c
index b4517095db6a..c71fb7cdfc41 100644
--- a/kernel/jump_label.c
+++ b/kernel/jump_label.c
@@ -370,8 +370,12 @@ static void __jump_label_update(struct static_key *key,
 		 * kernel_text_address() verifies we are not in core kernel
 		 * init code, see jump_label_invalidate_module_init().
 		 */
-		if (entry->code && kernel_text_address(entry->code))
-			arch_jump_label_transform(entry, jump_label_type(entry));
+		if (entry->code) {
+			if (kernel_text_address(entry->code))
+				arch_jump_label_transform(entry, jump_label_type(entry));
+			else
+				WARN_ONCE(1, "can't patch jump_label at %pS", (void *)entry->code);
+		}
 	}
 }
 
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 2/3] x86/xen: Remove inert tracepoint in __init code
  2018-02-14 16:40 [PATCH 0/3] jump_label: Robustify jump label patching Josh Poimboeuf
  2018-02-14 16:40 ` [PATCH 1/3] jump_label: Warn on failed jump_label patch Josh Poimboeuf
@ 2018-02-14 16:40 ` Josh Poimboeuf
  2018-02-14 16:49   ` Juergen Gross
  2018-02-14 16:40 ` [PATCH 3/3] percpu: " Josh Poimboeuf
  2 siblings, 1 reply; 17+ messages in thread
From: Josh Poimboeuf @ 2018-02-14 16:40 UTC (permalink / raw)
  To: x86
  Cc: linux-kernel, Steven Rostedt, Ingo Molnar, Thomas Gleixner,
	Linus Torvalds, Peter Zijlstra, Jason Baron, Borislav Petkov,
	Juergen Gross

The jump_label code doesn't patch init code, so this tracepoint can
never be enabled.  Remove it.

Cc: Juergen Gross <jgross@suse.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
---
 arch/x86/xen/enlighten_pv.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c
index c047f42552e1..0dbfad92f442 100644
--- a/arch/x86/xen/enlighten_pv.c
+++ b/arch/x86/xen/enlighten_pv.c
@@ -803,8 +803,6 @@ static void xen_write_gdt_entry(struct desc_struct *dt, int entry,
 static void __init xen_write_gdt_entry_boot(struct desc_struct *dt, int entry,
 					    const void *desc, int type)
 {
-	trace_xen_cpu_write_gdt_entry(dt, entry, desc, type);
-
 	switch (type) {
 	case DESC_LDT:
 	case DESC_TSS:
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 3/3] percpu: Remove inert tracepoint in __init code
  2018-02-14 16:40 [PATCH 0/3] jump_label: Robustify jump label patching Josh Poimboeuf
  2018-02-14 16:40 ` [PATCH 1/3] jump_label: Warn on failed jump_label patch Josh Poimboeuf
  2018-02-14 16:40 ` [PATCH 2/3] x86/xen: Remove inert tracepoint in __init code Josh Poimboeuf
@ 2018-02-14 16:40 ` Josh Poimboeuf
  2018-02-15 15:22   ` Tejun Heo
  2 siblings, 1 reply; 17+ messages in thread
From: Josh Poimboeuf @ 2018-02-14 16:40 UTC (permalink / raw)
  To: x86
  Cc: linux-kernel, Steven Rostedt, Ingo Molnar, Thomas Gleixner,
	Linus Torvalds, Peter Zijlstra, Jason Baron, Borislav Petkov,
	Tejun Heo

The jump_label code doesn't patch init code, so this tracepoint can
never be enabled.  Remove it.

Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
---
 mm/percpu.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/mm/percpu.c b/mm/percpu.c
index 50e7fdf84055..3216364ad91b 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -2156,7 +2156,6 @@ int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,
 	pcpu_chunk_relocate(pcpu_first_chunk, -1);
 
 	pcpu_stats_chunk_alloc();
-	trace_percpu_create_chunk(base_addr);
 
 	/* we're done */
 	pcpu_base_addr = base_addr;
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH 2/3] x86/xen: Remove inert tracepoint in __init code
  2018-02-14 16:40 ` [PATCH 2/3] x86/xen: Remove inert tracepoint in __init code Josh Poimboeuf
@ 2018-02-14 16:49   ` Juergen Gross
  0 siblings, 0 replies; 17+ messages in thread
From: Juergen Gross @ 2018-02-14 16:49 UTC (permalink / raw)
  To: Josh Poimboeuf, x86
  Cc: linux-kernel, Steven Rostedt, Ingo Molnar, Thomas Gleixner,
	Linus Torvalds, Peter Zijlstra, Jason Baron, Borislav Petkov

On 14/02/18 17:40, Josh Poimboeuf wrote:
> The jump_label code doesn't patch init code, so this tracepoint can
> never be enabled.  Remove it.
> 
> Cc: Juergen Gross <jgross@suse.com>
> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>

Reviewed-by: Juergen Gross <jgross@suse.com>


Juergen

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 1/3] jump_label: Warn on failed jump_label patch
  2018-02-14 16:40 ` [PATCH 1/3] jump_label: Warn on failed jump_label patch Josh Poimboeuf
@ 2018-02-14 17:01   ` Steven Rostedt
  2018-02-14 17:18     ` Jason Baron
  2018-02-14 17:01   ` Borislav Petkov
  1 sibling, 1 reply; 17+ messages in thread
From: Steven Rostedt @ 2018-02-14 17:01 UTC (permalink / raw)
  To: Josh Poimboeuf
  Cc: x86, linux-kernel, Ingo Molnar, Thomas Gleixner, Linus Torvalds,
	Peter Zijlstra, Jason Baron, Borislav Petkov

On Wed, 14 Feb 2018 10:40:41 -0600
Josh Poimboeuf <jpoimboe@redhat.com> wrote:

> When the jump label code encounters an address which isn't recognized by
> kernel_text_address(), it just silently fails.
> 
> This can be dangerous because jump labels are used in a variety of
> places, and are generally expected to work.  Convert the silent failure
> to a warning.

I made ftrace function tracing work on init code, can we do the same
with tracepoints (aka jump labels)?

But I have to say that this goes with my argument that there exists
tracepoints in the kernel that nobody cares about ;-)

-- Steve

> 
> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
> ---
>  kernel/jump_label.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/jump_label.c b/kernel/jump_label.c
> index b4517095db6a..c71fb7cdfc41 100644
> --- a/kernel/jump_label.c
> +++ b/kernel/jump_label.c
> @@ -370,8 +370,12 @@ static void __jump_label_update(struct static_key *key,
>  		 * kernel_text_address() verifies we are not in core kernel
>  		 * init code, see jump_label_invalidate_module_init().
>  		 */
> -		if (entry->code && kernel_text_address(entry->code))
> -			arch_jump_label_transform(entry, jump_label_type(entry));
> +		if (entry->code) {
> +			if (kernel_text_address(entry->code))
> +				arch_jump_label_transform(entry, jump_label_type(entry));
> +			else
> +				WARN_ONCE(1, "can't patch jump_label at %pS", (void *)entry->code);
> +		}
>  	}
>  }
>  

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 1/3] jump_label: Warn on failed jump_label patch
  2018-02-14 16:40 ` [PATCH 1/3] jump_label: Warn on failed jump_label patch Josh Poimboeuf
  2018-02-14 17:01   ` Steven Rostedt
@ 2018-02-14 17:01   ` Borislav Petkov
  1 sibling, 0 replies; 17+ messages in thread
From: Borislav Petkov @ 2018-02-14 17:01 UTC (permalink / raw)
  To: Josh Poimboeuf
  Cc: x86, linux-kernel, Steven Rostedt, Ingo Molnar, Thomas Gleixner,
	Linus Torvalds, Peter Zijlstra, Jason Baron

On Wed, Feb 14, 2018 at 10:40:41AM -0600, Josh Poimboeuf wrote:
> When the jump label code encounters an address which isn't recognized by
> kernel_text_address(), it just silently fails.
> 
> This can be dangerous because jump labels are used in a variety of
> places, and are generally expected to work.  Convert the silent failure
> to a warning.
> 
> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
> ---
>  kernel/jump_label.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/jump_label.c b/kernel/jump_label.c
> index b4517095db6a..c71fb7cdfc41 100644
> --- a/kernel/jump_label.c
> +++ b/kernel/jump_label.c
> @@ -370,8 +370,12 @@ static void __jump_label_update(struct static_key *key,
>  		 * kernel_text_address() verifies we are not in core kernel
>  		 * init code, see jump_label_invalidate_module_init().
>  		 */
> -		if (entry->code && kernel_text_address(entry->code))
> -			arch_jump_label_transform(entry, jump_label_type(entry));
> +		if (entry->code) {
> +			if (kernel_text_address(entry->code))
> +				arch_jump_label_transform(entry, jump_label_type(entry));
> +			else
> +				WARN_ONCE(1, "can't patch jump_label at %pS", (void *)entry->code);
> +		}
>  	}
>  }
>  
> -- 
> 2.14.3

Good idea.

Reviewed-by: Borislav Petkov <bp@suse.de>

-- 
Regards/Gruss,
    Boris.

SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
-- 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 1/3] jump_label: Warn on failed jump_label patch
  2018-02-14 17:01   ` Steven Rostedt
@ 2018-02-14 17:18     ` Jason Baron
  2018-02-14 17:34       ` Josh Poimboeuf
  0 siblings, 1 reply; 17+ messages in thread
From: Jason Baron @ 2018-02-14 17:18 UTC (permalink / raw)
  To: Steven Rostedt, Josh Poimboeuf
  Cc: x86, linux-kernel, Ingo Molnar, Thomas Gleixner, Linus Torvalds,
	Peter Zijlstra, Borislav Petkov



On 02/14/2018 12:01 PM, Steven Rostedt wrote:
> On Wed, 14 Feb 2018 10:40:41 -0600
> Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> 
>> When the jump label code encounters an address which isn't recognized by
>> kernel_text_address(), it just silently fails.
>>
>> This can be dangerous because jump labels are used in a variety of
>> places, and are generally expected to work.  Convert the silent failure
>> to a warning.
> 
> I made ftrace function tracing work on init code, can we do the same
> with tracepoints (aka jump labels)?
> 

jump labels do work on init code, except they don't work on it after it
has been freed :)

It uses 'kernel_text_address()', which will return true for init code if
system_state < SYSTEM_RUNNING. See: core_kernel_text().

So I'm guessing that the warnings here are coming from init code that
has already been freed. Are we sure that these warnings are coming from
init code that hasn't already been freed?

Thanks,

-Jason

> But I have to say that this goes with my argument that there exists
> tracepoints in the kernel that nobody cares about ;-)
> 
> -- Steve
> 
>>
>> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
>> ---
>>  kernel/jump_label.c | 8 ++++++--
>>  1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/kernel/jump_label.c b/kernel/jump_label.c
>> index b4517095db6a..c71fb7cdfc41 100644
>> --- a/kernel/jump_label.c
>> +++ b/kernel/jump_label.c
>> @@ -370,8 +370,12 @@ static void __jump_label_update(struct static_key *key,
>>  		 * kernel_text_address() verifies we are not in core kernel
>>  		 * init code, see jump_label_invalidate_module_init().
>>  		 */
>> -		if (entry->code && kernel_text_address(entry->code))
>> -			arch_jump_label_transform(entry, jump_label_type(entry));
>> +		if (entry->code) {
>> +			if (kernel_text_address(entry->code))
>> +				arch_jump_label_transform(entry, jump_label_type(entry));
>> +			else
>> +				WARN_ONCE(1, "can't patch jump_label at %pS", (void *)entry->code);
>> +		}
>>  	}
>>  }
>>  
> 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 1/3] jump_label: Warn on failed jump_label patch
  2018-02-14 17:18     ` Jason Baron
@ 2018-02-14 17:34       ` Josh Poimboeuf
  2018-02-14 17:40         ` Steven Rostedt
  0 siblings, 1 reply; 17+ messages in thread
From: Josh Poimboeuf @ 2018-02-14 17:34 UTC (permalink / raw)
  To: Jason Baron
  Cc: Steven Rostedt, x86, linux-kernel, Ingo Molnar, Thomas Gleixner,
	Linus Torvalds, Peter Zijlstra, Borislav Petkov, Juergen Gross,
	Tejun Heo

On Wed, Feb 14, 2018 at 12:18:20PM -0500, Jason Baron wrote:
> 
> 
> On 02/14/2018 12:01 PM, Steven Rostedt wrote:
> > On Wed, 14 Feb 2018 10:40:41 -0600
> > Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> > 
> >> When the jump label code encounters an address which isn't recognized by
> >> kernel_text_address(), it just silently fails.
> >>
> >> This can be dangerous because jump labels are used in a variety of
> >> places, and are generally expected to work.  Convert the silent failure
> >> to a warning.
> > 
> > I made ftrace function tracing work on init code, can we do the same
> > with tracepoints (aka jump labels)?
> > 
> 
> jump labels do work on init code, except they don't work on it after it
> has been freed :)
> 
> It uses 'kernel_text_address()', which will return true for init code if
> system_state < SYSTEM_RUNNING. See: core_kernel_text().
> 
> So I'm guessing that the warnings here are coming from init code that
> has already been freed. Are we sure that these warnings are coming from
> init code that hasn't already been freed?

Ah, I see.  I missed that 'system_state < SYSTEM_RUNNING' check.  It was
nicely hidden. :-)

So I guess patches 2 & 3 can be dropped, as those tracepoints can still
be used during boot.

And in patch 1 the warning conditions need to be tweaked a bit to
exclude the __init case.

-- 
Josh

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 1/3] jump_label: Warn on failed jump_label patch
  2018-02-14 17:34       ` Josh Poimboeuf
@ 2018-02-14 17:40         ` Steven Rostedt
  2018-02-14 21:17           ` Josh Poimboeuf
  0 siblings, 1 reply; 17+ messages in thread
From: Steven Rostedt @ 2018-02-14 17:40 UTC (permalink / raw)
  To: Josh Poimboeuf
  Cc: Jason Baron, x86, linux-kernel, Ingo Molnar, Thomas Gleixner,
	Linus Torvalds, Peter Zijlstra, Borislav Petkov, Juergen Gross,
	Tejun Heo

On Wed, 14 Feb 2018 11:34:07 -0600
Josh Poimboeuf <jpoimboe@redhat.com> wrote:


> And in patch 1 the warning conditions need to be tweaked a bit to
> exclude the __init case.
> 

Hmm, I wonder if we could simply remove the references from the jump
label table when init is freed.

-- Steve

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 1/3] jump_label: Warn on failed jump_label patch
  2018-02-14 17:40         ` Steven Rostedt
@ 2018-02-14 21:17           ` Josh Poimboeuf
  2018-02-15 22:35             ` Josh Poimboeuf
  0 siblings, 1 reply; 17+ messages in thread
From: Josh Poimboeuf @ 2018-02-14 21:17 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Jason Baron, x86, linux-kernel, Ingo Molnar, Thomas Gleixner,
	Linus Torvalds, Peter Zijlstra, Borislav Petkov, Juergen Gross,
	Tejun Heo

On Wed, Feb 14, 2018 at 12:40:34PM -0500, Steven Rostedt wrote:
> On Wed, 14 Feb 2018 11:34:07 -0600
> Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> 
> 
> > And in patch 1 the warning conditions need to be tweaked a bit to
> > exclude the __init case.
> > 
> 
> Hmm, I wonder if we could simply remove the references from the jump
> label table when init is freed.

Interesting idea.  The static key's entries (i.e. tracepoint sites) are
in a static array.  Maybe we could rewrite the affected arrays when init
memory is freed.  I'm not sure whether that would be overkill though.  I
can tinker with it and see how it compares to the current solution.

-- 
Josh

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 3/3] percpu: Remove inert tracepoint in __init code
  2018-02-14 16:40 ` [PATCH 3/3] percpu: " Josh Poimboeuf
@ 2018-02-15 15:22   ` Tejun Heo
  2018-02-15 15:33     ` Josh Poimboeuf
  0 siblings, 1 reply; 17+ messages in thread
From: Tejun Heo @ 2018-02-15 15:22 UTC (permalink / raw)
  To: Josh Poimboeuf
  Cc: x86, linux-kernel, Steven Rostedt, Ingo Molnar, Thomas Gleixner,
	Linus Torvalds, Peter Zijlstra, Jason Baron, Borislav Petkov

On Wed, Feb 14, 2018 at 10:40:43AM -0600, Josh Poimboeuf wrote:
> The jump_label code doesn't patch init code, so this tracepoint can
> never be enabled.  Remove it.
> 
> Cc: Tejun Heo <tj@kernel.org>
> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>

Applied to percpu/for-4.17.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 3/3] percpu: Remove inert tracepoint in __init code
  2018-02-15 15:22   ` Tejun Heo
@ 2018-02-15 15:33     ` Josh Poimboeuf
  2018-02-16  9:02       ` Ingo Molnar
  0 siblings, 1 reply; 17+ messages in thread
From: Josh Poimboeuf @ 2018-02-15 15:33 UTC (permalink / raw)
  To: Tejun Heo
  Cc: x86, linux-kernel, Steven Rostedt, Ingo Molnar, Thomas Gleixner,
	Linus Torvalds, Peter Zijlstra, Jason Baron, Borislav Petkov

On Thu, Feb 15, 2018 at 07:22:46AM -0800, Tejun Heo wrote:
> On Wed, Feb 14, 2018 at 10:40:43AM -0600, Josh Poimboeuf wrote:
> > The jump_label code doesn't patch init code, so this tracepoint can
> > never be enabled.  Remove it.
> > 
> > Cc: Tejun Heo <tj@kernel.org>
> > Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
> 
> Applied to percpu/for-4.17.

Actually, I think this patch should be dropped.  As Jason pointed out,
tracepoints *can* be enabled at boot time for __init code, so it's
possible for this tracepoint to be used.

-- 
Josh

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 1/3] jump_label: Warn on failed jump_label patch
  2018-02-14 21:17           ` Josh Poimboeuf
@ 2018-02-15 22:35             ` Josh Poimboeuf
  2018-02-16 17:31               ` Steven Rostedt
  0 siblings, 1 reply; 17+ messages in thread
From: Josh Poimboeuf @ 2018-02-15 22:35 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Jason Baron, x86, linux-kernel, Ingo Molnar, Thomas Gleixner,
	Linus Torvalds, Peter Zijlstra, Borislav Petkov, Juergen Gross,
	Tejun Heo

On Wed, Feb 14, 2018 at 03:17:07PM -0600, Josh Poimboeuf wrote:
> On Wed, Feb 14, 2018 at 12:40:34PM -0500, Steven Rostedt wrote:
> > On Wed, 14 Feb 2018 11:34:07 -0600
> > Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> > 
> > 
> > > And in patch 1 the warning conditions need to be tweaked a bit to
> > > exclude the __init case.
> > > 
> > 
> > Hmm, I wonder if we could simply remove the references from the jump
> > label table when init is freed.
> 
> Interesting idea.  The static key's entries (i.e. tracepoint sites) are
> in a static array.  Maybe we could rewrite the affected arrays when init
> memory is freed.  I'm not sure whether that would be overkill though.  I
> can tinker with it and see how it compares to the current solution.

It turns out that something like this is already done for module init
code.  It doesn't *remove* the entry, but it does disable it by setting
entry->code to zero.  I'll just do the same thing right before initmem
is freed.

-- 
Josh

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 3/3] percpu: Remove inert tracepoint in __init code
  2018-02-15 15:33     ` Josh Poimboeuf
@ 2018-02-16  9:02       ` Ingo Molnar
  2018-02-16 12:52         ` Josh Poimboeuf
  0 siblings, 1 reply; 17+ messages in thread
From: Ingo Molnar @ 2018-02-16  9:02 UTC (permalink / raw)
  To: Josh Poimboeuf
  Cc: Tejun Heo, x86, linux-kernel, Steven Rostedt, Thomas Gleixner,
	Linus Torvalds, Peter Zijlstra, Jason Baron, Borislav Petkov


* Josh Poimboeuf <jpoimboe@redhat.com> wrote:

> On Thu, Feb 15, 2018 at 07:22:46AM -0800, Tejun Heo wrote:
> > On Wed, Feb 14, 2018 at 10:40:43AM -0600, Josh Poimboeuf wrote:
> > > The jump_label code doesn't patch init code, so this tracepoint can
> > > never be enabled.  Remove it.
> > > 
> > > Cc: Tejun Heo <tj@kernel.org>
> > > Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
> > 
> > Applied to percpu/for-4.17.
> 
> Actually, I think this patch should be dropped.  As Jason pointed out,
> tracepoints *can* be enabled at boot time for __init code, so it's
> possible for this tracepoint to be used.

Would it still be useful to have the warning for failed patching?

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 3/3] percpu: Remove inert tracepoint in __init code
  2018-02-16  9:02       ` Ingo Molnar
@ 2018-02-16 12:52         ` Josh Poimboeuf
  0 siblings, 0 replies; 17+ messages in thread
From: Josh Poimboeuf @ 2018-02-16 12:52 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Tejun Heo, x86, linux-kernel, Steven Rostedt, Thomas Gleixner,
	Linus Torvalds, Peter Zijlstra, Jason Baron, Borislav Petkov

On Fri, Feb 16, 2018 at 10:02:33AM +0100, Ingo Molnar wrote:
> 
> * Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> 
> > On Thu, Feb 15, 2018 at 07:22:46AM -0800, Tejun Heo wrote:
> > > On Wed, Feb 14, 2018 at 10:40:43AM -0600, Josh Poimboeuf wrote:
> > > > The jump_label code doesn't patch init code, so this tracepoint can
> > > > never be enabled.  Remove it.
> > > > 
> > > > Cc: Tejun Heo <tj@kernel.org>
> > > > Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
> > > 
> > > Applied to percpu/for-4.17.
> > 
> > Actually, I think this patch should be dropped.  As Jason pointed out,
> > tracepoints *can* be enabled at boot time for __init code, so it's
> > possible for this tracepoint to be used.
> 
> Would it still be useful to have the warning for failed patching?

Yes, I'm working on a v2.

-- 
Josh

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 1/3] jump_label: Warn on failed jump_label patch
  2018-02-15 22:35             ` Josh Poimboeuf
@ 2018-02-16 17:31               ` Steven Rostedt
  0 siblings, 0 replies; 17+ messages in thread
From: Steven Rostedt @ 2018-02-16 17:31 UTC (permalink / raw)
  To: Josh Poimboeuf
  Cc: Jason Baron, x86, linux-kernel, Ingo Molnar, Thomas Gleixner,
	Linus Torvalds, Peter Zijlstra, Borislav Petkov, Juergen Gross,
	Tejun Heo

On Thu, 15 Feb 2018 16:35:58 -0600
Josh Poimboeuf <jpoimboe@redhat.com> wrote:


> > Interesting idea.  The static key's entries (i.e. tracepoint sites) are
> > in a static array.  Maybe we could rewrite the affected arrays when init
> > memory is freed.  I'm not sure whether that would be overkill though.  I
> > can tinker with it and see how it compares to the current solution.  
> 
> It turns out that something like this is already done for module init
> code.  It doesn't *remove* the entry, but it does disable it by setting
> entry->code to zero.  I'll just do the same thing right before initmem
> is freed.

Yes, I was actually going to mention to do it like the module code does.

Thanks!

-- Steve

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2018-02-16 17:32 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-14 16:40 [PATCH 0/3] jump_label: Robustify jump label patching Josh Poimboeuf
2018-02-14 16:40 ` [PATCH 1/3] jump_label: Warn on failed jump_label patch Josh Poimboeuf
2018-02-14 17:01   ` Steven Rostedt
2018-02-14 17:18     ` Jason Baron
2018-02-14 17:34       ` Josh Poimboeuf
2018-02-14 17:40         ` Steven Rostedt
2018-02-14 21:17           ` Josh Poimboeuf
2018-02-15 22:35             ` Josh Poimboeuf
2018-02-16 17:31               ` Steven Rostedt
2018-02-14 17:01   ` Borislav Petkov
2018-02-14 16:40 ` [PATCH 2/3] x86/xen: Remove inert tracepoint in __init code Josh Poimboeuf
2018-02-14 16:49   ` Juergen Gross
2018-02-14 16:40 ` [PATCH 3/3] percpu: " Josh Poimboeuf
2018-02-15 15:22   ` Tejun Heo
2018-02-15 15:33     ` Josh Poimboeuf
2018-02-16  9:02       ` Ingo Molnar
2018-02-16 12:52         ` Josh Poimboeuf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.