Re: [PATCH] lib: test_objpool: add missing MODULE_DESCRIPTION() macro

2024-06-03 Thread Google
8d937f8666 > > > > Looks good to me. Thanks for the update. > > I added Masami Hiramatsu and linux-trace in the loop. > > Reviewed-by: Matt Wu Thanks, let me pick this to probes/for-next branch. Thank you, > > Regards, > Matt Wu > -- Masami Hiramatsu (Google)

Re: [PATCH v2 11/27] ftrace: Allow subops filtering to be modified

2024-06-02 Thread Google
p_list, list) { > + if ((subops->flags & FTRACE_OPS_FL_ENABLED) && > + subops->func_hash == ops->func_hash) { > + return > ftrace_hash_move_and_update_subops(subops, orig_hash, hash, enable); > + } > + } > + } while_for_each_ftrace_op(op); > + } > + > old_hash = *orig_hash; > old_hash_ops.filter_hash = ops->func_hash->filter_hash; > old_hash_ops.notrace_hash = ops->func_hash->notrace_hash; > -- > 2.43.0 > > -- Masami Hiramatsu (Google)

Re: [PATCH v2 10/27] ftrace: Add subops logic to allow one ops to manage many

2024-06-02 Thread Google
as thinking too much of strcmp() logic :-p Yeah, it's the curse of the C programmer :( (even it is good for sorting.) Thank you, > > > > > Thank you, > > Thanks for the review. > > -- Steve > > > > > > +{ > > > + struct ftrace_func_entry *entry; > > > + int size; > > > + int i; > > > + > > > + if (!A || A == EMPTY_HASH) > > > + return !(!B || B == EMPTY_HASH); > > > + > > > + if (!B || B == EMPTY_HASH) > > > + return !(!A || A == EMPTY_HASH); > > > + > > > + if (A->count != B->count) > > > + return 1; > > > + > > > + size = 1 << A->size_bits; > > > + for (i = 0; i < size; i++) { > > > + hlist_for_each_entry(entry, >buckets[i], hlist) { > > > + if (!__ftrace_lookup_ip(B, entry->ip)) > > > + return 1; > > > + } > > > + } > > > + > > > + return 0; > > > +} > > > + > > > > > -- Masami Hiramatsu (Google)

Re: [PATCH v2 24/27] function_graph: Use static_call and branch to optimize entry function

2024-06-02 Thread Google
On Sat, 01 Jun 2024 23:38:08 -0400 Steven Rostedt wrote: > From: "Steven Rostedt (Google)" > > In most cases function graph is used by a single user. Instead of calling > a loop to call function graph callbacks in this case, call the function > entry callback direct

Re: [PATCH] function_graph: Rename BYTE_NUMBER to CHAR_NUMBER in selftests

2024-06-08 Thread Google
On Thu, 6 Jun 2024 08:18:46 -0400 Steven Rostedt wrote: > From: "Steven Rostedt (Google)" > > The function_graph selftests checks various size variables to pass from > the entry of the function to the exit. It tests 1, 2, 4 and 8 byte words. > The 1 byte mac

Kernel syscall hooks

2005-03-29 Thread Mister Google
Hi, When the kernel gets a particular syscall, is there a way to get it to trigger another program? Or send it a signal? Thanks, The Nomad. _ Don't just search. Find. Check out the new MSN Search!

Keystroke simulator

2005-03-29 Thread Mister Google
Is there a way to simulate a keystroke to a program, ie. have a program send it something so that as far as it's concerned, say, the P key has been pressed? Thanks, The Nomad. _ Express yourself instantly with MSN Messenger!

Invitation to use Google Talk

2013-02-26 Thread Google Talk
--- You've been invited by Dula Dame to use Google Talk. If you already have a Google account, login to Gmail and accept this chat invitation: http://mail.google.com/mail/b-de9a2ad76d-397eb7cc5e-HsnrQQMRxQEBFT80ciL5NgGAPOc

GOOGLE Gewinnbenachrichtigung!!!

2014-03-18 Thread GOOGLE Gewinnbenachrichtigung!!!
GOOGLE INTERNATIONALE Förderung-GEWINNZUTEILUNG GOOGLE Förderung GOOGLE Einarbeitung© UROPA INTERLOTTO/EUROMILLINEN LOTTO BONUS-PROGRAMM BEL-GRAVE HOUSE, 76 BUCKINGHAM PALACE ROAD, LONDON SW1W 9TQ, UNITED KINGDOM.OFFICE; VOM SCHREIBTISCH VON VICE PRESIDENT INTERNATIONAL PROMOTION

googlespeed

2017-07-11 Thread google lotto
Ref: CGSCS /849499/2017 Esteemed Winner. we wish to inform you that you are among the 50 winners of the last Google lottery draw $250,000 ( two hundred and fifty thousand dollars) Congratulations!! You are now $250,000 ( two hundred and fifty thousand dollars) richer! Winning will be remitted

Kernel syscall hooks

2005-03-29 Thread Mister Google
Hi, When the kernel gets a particular syscall, is there a way to get it to trigger another program? Or send it a signal? Thanks, The Nomad. _ Don't just search. Find. Check out the new MSN Search!

Keystroke simulator

2005-03-29 Thread Mister Google
Is there a way to simulate a keystroke to a program, ie. have a program send it something so that as far as it's concerned, say, the "P" key has been pressed? Thanks, The Nomad. _ Express yourself instantly with MSN Messenger!

GOOGLE Gewinnbenachrichtigung!!!

2014-03-18 Thread GOOGLE Gewinnbenachrichtigung!!!
GOOGLE INTERNATIONALE Förderung-GEWINNZUTEILUNG GOOGLE Förderung GOOGLE Einarbeitung© UROPA INTERLOTTO/EUROMILLINEN LOTTO BONUS-PROGRAMM BEL-GRAVE HOUSE, 76 BUCKINGHAM PALACE ROAD, LONDON SW1W 9TQ, UNITED KINGDOM.OFFICE; VOM SCHREIBTISCH VON VICE PRESIDENT INTERNATIONAL PROMOTION

Invitation to use Google Talk

2013-02-26 Thread Google Talk
--- You've been invited by Dula Dame to use Google Talk. If you already have a Google account, login to Gmail and accept this chat invitation: http://mail.google.com/mail/b-de9a2ad76d-397eb7cc5e-HsnrQQMRxQEBFT80ciL5NgGAPOc

googlespeed

2017-07-11 Thread google lotto
Ref: CGSCS /849499/2017 Esteemed Winner. we wish to inform you that you are among the 50 winners of the last Google lottery draw $250,000 ( two hundred and fifty thousand dollars) Congratulations!! You are now $250,000 ( two hundred and fifty thousand dollars) richer! Winning will be remitted

[PATCH -next 1/2] mm/memfd: make F_SEAL_FUTURE_WRITE seal more robust

2018-11-19 Thread Joel Fernandes (Google)
://lore.kernel.org/lkml/69ce06cc-e47c-4992-848a-66eb23ee6...@amacapital.net/ Suggested-by: Andy Lutomirski Fixes: 5e653c2923fd ("mm: Add an F_SEAL_FUTURE_WRITE seal to memfd") Signed-off-by: Joel Fernandes (Google) --- fs/hugetlbfs/inode.c | 2 +- mm/memfd.c

[PATCH -next 2/2] selftests/memfd: modify tests for F_SEAL_FUTURE_WRITE seal

2018-11-19 Thread Joel Fernandes (Google)
Signed-off-by: Joel Fernandes (Google) --- tools/testing/selftests/memfd/memfd_test.c | 88 +++--- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/tools/testing/selftests/memfd/memfd_test.c b/tools/testing/selftests/memfd/memfd_test.c index 32b207ca7372..c67d32eeb668

[PATCH -manpage 1/2] fcntl.2: Update manpage with new memfd F_SEAL_FUTURE_WRITE seal

2018-11-19 Thread Joel Fernandes (Google)
More details of the seal can be found in the LKML patch: https://lore.kernel.org/lkml/20181120052137.74317-1-j...@joelfernandes.org/T/#t Signed-off-by: Joel Fernandes (Google) --- man2/fcntl.2 | 15 +++ 1 file changed, 15 insertions(+) diff --git a/man2/fcntl.2 b/man2/fcntl.2 index

[PATCH -manpage 2/2] memfd_create.2: Update manpage with new memfd F_SEAL_FUTURE_WRITE seal

2018-11-19 Thread Joel Fernandes (Google)
More details of the seal can be found in the LKML patch: https://lore.kernel.org/lkml/20181120052137.74317-1-j...@joelfernandes.org/T/#t Signed-off-by: Joel Fernandes (Google) --- man2/memfd_create.2 | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/man2

[PATCH RFC 5/5] tracing/probes: Support $argN in return probe (kprobe and fprobe)

2024-02-14 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Support accessing $argN in the return probe events. This will help users to record entry data in function return (exit) event for simplfing the function entry/exit information in one event, and record the result values (e.g. allocated object/initialized object

[PATCH RFC 3/5] tracing/probes: Cleanup probe argument parser

2024-02-14 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Cleanup traceprobe_parse_probe_arg_body() to split out the type parser and post-processing part of fetch_insn. This makes no functional change. Signed-off-by: Masami Hiramatsu (Google) --- kernel/trace/trace_probe.c | 230

[PATCH RFC 4/5] tracing/probes: cleanup: Set trace_probe::nr_args at trace_probe_init

2024-02-14 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Instead of incrementing the trace_probe::nr_args, init it at trace_probe_init(). This is a cleanup, so the behavior is not changed. Signed-off-by: Masami Hiramatsu (Google) --- kernel/trace/trace_eprobe.c |2 +- kernel/trace/trace_probe.c | 10

[PATCH RFC 2/5] tracing/fprobe-event: cleanup: Fix a wrong comment in fprobe event

2024-02-14 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Despite the fprobe event, "Kretprobe" was commented. So fix it. Signed-off-by: Masami Hiramatsu (Google) --- kernel/trace/trace_fprobe.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/trace/trace_fprobe.c b/ke

[PATCH RFC 1/5] tracing/probes: Fix to search structure fields correctly

2024-02-14 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Fix to search a field from the structure which has anonymous union correctly. Since the reference `type` pointer was updated in the loop, the search loop suddenly aborted where it hits an anonymous union. Thus it can not find the field after the anonymous union

[PATCH RFC 0/5] tracing/probes: Support function parameter access from return probe

2024-02-14 Thread Masami Hiramatsu (Google)
nitialized at exit. TODO: - update README file - add/update ftracetest - update documents Thank you, --- Masami Hiramatsu (Google) (5): tracing/probes: Fix to search structure fields correctly tracing/fprobe-event: cleanup: Fix a wrong comment in fprobe event tracing/p

[PATCH v7 10/36] ftrace/function_graph: Pass fgraph_ops to function graph callbacks

2024-02-06 Thread Masami Hiramatsu (Google)
to the function graph tracer. Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Masami Hiramatsu (Google) --- Changes in v2: - cleanup to set argument name on function prototype. --- include/linux/ftrace.h | 10 +++--- kernel/trace/fgraph.c| 14

[PATCH v7 11/36] ftrace: Allow function_graph tracer to be enabled in instances

2024-02-06 Thread Masami Hiramatsu (Google)
-by: Steven Rostedt (VMware) Signed-off-by: Masami Hiramatsu (Google) --- Changes in v2: - Fix to remove set_graph_array() completely. --- include/linux/ftrace.h |1 + kernel/trace/ftrace.c|1 + kernel/trace/trace.h | 13 ++- kernel

[PATCH v7 12/36] ftrace: Allow ftrace startup flags exist without dynamic ftrace

2024-02-06 Thread Masami Hiramatsu (Google)
to compile because dynamic ftrace is disabled. This change is needed to move some of the logic of what is passed to ftrace_startup() out of the parameters of ftrace_startup(). Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Masami Hiramatsu (Google) --- include/linux/ftrace.h | 18

[PATCH v7 23/36] function_graph: Add a new exit handler with parent_ip and ftrace_regs

2024-02-06 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Add a new return handler to fgraph_ops as 'retregfunc' which takes parent_ip and ftrace_regs instead of ftrace_graph_ret. This handler is available only if the arch support CONFIG_HAVE_FUNCTION_GRAPH_FREGS. Note that the 'retfunc' and 'reregfunc' are mutual

[PATCH v7 22/36] function_graph: Add a new entry handler with parent_ip and ftrace_regs

2024-02-06 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Add a new entry handler to fgraph_ops as 'entryregfunc' which takes parent_ip and ftrace_regs. Note that the 'entryfunc' and 'entryregfunc' are mutual exclusive. You can set only one of them. Signed-off-by: Masami Hiramatsu (Google) --- Changes in v3

[PATCH v7 34/36] selftests: ftrace: Remove obsolate maxactive syntax check

2024-02-06 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Since the fprobe event does not support maxactive anymore, stop testing the maxactive syntax error checking. Signed-off-by: Masami Hiramatsu (Google) --- .../ftrace/test.d/dynevent/fprobe_syntax_errors.tc |4 +--- 1 file changed, 1 insertion(+), 3 deletions

[PATCH v7 33/36] tracing/fprobe: Remove nr_maxactive from fprobe

2024-02-06 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Remove depercated fprobe::nr_maxactive. This involves fprobe events to rejects the maxactive number. Signed-off-by: Masami Hiramatsu (Google) --- Changes in v2: - Newly added. --- include/linux/fprobe.h |2 -- kernel/trace/trace_fprobe.c | 44

[PATCH v7 21/36] function_graph: Add selftest for passing local variables

2024-02-06 Thread Masami Hiramatsu (Google)
From: Steven Rostedt (VMware) Add boot up selftest that passes variables from a function entry to a function exit, and make sure that they do get passed around. Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Masami Hiramatsu (Google) --- Changes in v2: - Add reserved size test

[PATCH v7 20/36] function_graph: Improve push operation for several interrupts

2024-02-06 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Improve push and data reserve operation on the shadow stack for several sequencial interrupts. To push a ret_stack or data entry on the shadow stack, we need to prepare an index (offset) entry before updating the stack pointer (curr_ret_stack) so that unwinder

[PATCH v7 35/36] selftests/ftrace: Add a test case for repeating register/unregister fprobe

2024-02-06 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) This test case repeats define and undefine the fprobe dynamic event to ensure that the fprobe does not cause any issue with such operations. Signed-off-by: Masami Hiramatsu (Google) --- .../test.d/dynevent/add_remove_fprobe_repeat.tc| 19

[PATCH v7 02/36] tracing: Add a comment about ftrace_regs definition

2024-02-06 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) To clarify what will be expected on ftrace_regs, add a comment to the architecture independent definition of the ftrace_regs. Signed-off-by: Masami Hiramatsu (Google) Acked-by: Mark Rutland --- Changes in v3: - Add instruction pointer Changes in v2

[PATCH v7 04/36] x86: tracing: Add ftrace_regs definition in the header

2024-02-06 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Add ftrace_regs definition for x86_64 in the ftrace header to clarify what register will be accessible from ftrace_regs. Signed-off-by: Masami Hiramatsu (Google) --- Changes in v3: - Add rip to be saved. Changes in v2: - Newly added. --- arch/x86/include

[PATCH v7 03/36] tracing: Rename ftrace_regs_return_value to ftrace_regs_get_return_value

2024-02-06 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Rename ftrace_regs_return_value to ftrace_regs_get_return_value as same as other ftrace_regs_get/set_* APIs. Signed-off-by: Masami Hiramatsu (Google) Acked-by: Mark Rutland --- Changes in v6: - Moved to top of the series. Changes in v3: - Newly added

[PATCH v7 25/36] arm64: ftrace: Enable HAVE_FUNCTION_GRAPH_FREGS

2024-02-06 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Enable CONFIG_HAVE_FUNCTION_GRAPH_FREGS on arm64. Note that this depends on HAVE_DYNAMIC_FTRACE_WITH_ARGS which is enabled if the compiler supports "-fpatchable-function-entry=2". If not, it continue to use ftrace_ret_regs. Signed-off-by: Masami Hiramat

[PATCH v7 24/36] x86/ftrace: Enable HAVE_FUNCTION_GRAPH_FREGS

2024-02-06 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Support HAVE_FUNCTION_GRAPH_FREGS on x86-64, which saves ftrace_regs on the stack in ftrace_graph return trampoline so that the callbacks can access registers via ftrace_regs APIs. Note that this only recovers 'rax' and 'rdx' registers because other registers

[PATCH v7 00/36] tracing: fprobe: function_graph: Multi-function graph and fprobe on fgraph

2024-02-06 Thread Masami Hiramatsu (Google)
-on-fgraph Thank you, --- Masami Hiramatsu (Google) (21): ftrace: Fix DIRECT_CALLS to use SAVE_REGS by default tracing: Add a comment about ftrace_regs definition tracing: Rename ftrace_regs_return_value to ftrace_regs_get_return_value x86: tracing: Add ftrace_regs definition

[PATCH v7 01/36] ftrace: Fix DIRECT_CALLS to use SAVE_REGS by default

2024-02-06 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) The commit 60c8971899f3 ("ftrace: Make DIRECT_CALLS work WITH_ARGS and !WITH_REGS") changed DIRECT_CALLS to use SAVE_ARGS when there are multiple ftrace_ops at the same function, but since the x86 only support to jump to direct_call from ftrace_regs_ca

[PATCH v7 05/36] function_graph: Convert ret_stack to a series of longs

2024-02-06 Thread Masami Hiramatsu (Google)
for the return side of the functions. Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Masami Hiramatsu (Google) --- include/linux/sched.h |2 - kernel/trace/fgraph.c | 124 - 2 files changed, 71 insertions(+), 55 deletions(-) diff --git

[PATCH v7 07/36] function_graph: Add an array structure that will allow multiple callbacks

2024-02-06 Thread Masami Hiramatsu (Google)
on the shadow stack. We need to only save the index, because this will allow the fgraph_ops to be freed before the function returns (which may happen if the function call schedule for a long time). Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Masami Hiramatsu (Google) --- Changes in v2: - Remove

[PATCH v7 06/36] fgraph: Use BUILD_BUG_ON() to make sure we have structures divisible by long

2024-02-06 Thread Masami Hiramatsu (Google)
dt (VMware) Signed-off-by: Masami Hiramatsu (Google) --- Changes in v7: - Use DIV_ROUND_UP() to calculate FGRAPH_RET_INDEX --- kernel/trace/fgraph.c |9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/kernel/trace/fgraph.c b/kernel/trace/fgraph.c index 30

[PATCH v7 19/36] function_graph: Implement fgraph_reserve_data() and fgraph_retrieve_data()

2024-02-06 Thread Masami Hiramatsu (Google)
shadow ret_stack and this then can be retrieved by fgraph_retrieve_data() called by the corresponding retfunc(). Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Masami Hiramatsu (Google) --- Changes in v3: - Store fgraph_array index to the data entry. - Both function requires

[PATCH v7 18/36] function_graph: Move graph notrace bit to shadow stack global var

2024-02-06 Thread Masami Hiramatsu (Google)
are) Signed-off-by: Masami Hiramatsu (Google) --- Changes in v2: - Make description lines shorter than 76 chars. --- include/linux/trace_recursion.h |7 --- kernel/trace/trace.h |9 + kernel/trace/trace_functions_graph.c | 10 ++ 3 files chan

[PATCH v7 36/36] Documentation: probes: Update fprobe on function-graph tracer

2024-02-06 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Update fprobe documentation for the new fprobe on function-graph tracer. This includes some bahvior changes and pt_regs to ftrace_regs interface change. Signed-off-by: Masami Hiramatsu (Google) --- Changes in v2: - Update @fregs parameter explanation

[PATCH v7 08/36] function_graph: Allow multiple users to attach to function graph

2024-02-06 Thread Masami Hiramatsu (Google)
are called is not completely handled yet, but that shouldn't be too hard to manage. Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Masami Hiramatsu (Google) --- Changes in v7: - Fix max limitation check in ftrace_graph_push_return(). - Rewrite the shadow stack implementation using bitmap

[PATCH v7 09/36] function_graph: Remove logic around ftrace_graph_entry and return

2024-02-06 Thread Masami Hiramatsu (Google)
into the function_graph tracer. Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Masami Hiramatsu (Google) --- Changes in v2: - Fix typo and make lines shorter than 76 chars in the description. - Remove unneeded return from return_run() function. --- kernel/trace/fgraph.c | 67

[PATCH v7 29/36] tracing: Add ftrace_fill_perf_regs() for perf event

2024-02-06 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Add ftrace_fill_perf_regs() which should be compatible with the perf_fetch_caller_regs(). In other words, the pt_regs returned from the ftrace_fill_perf_regs() must satisfy 'user_mode(regs) == false' and can be used for stack tracing. Signed-off-by: Masami

[PATCH v7 28/36] tracing: Add ftrace_partial_regs() for converting ftrace_regs to pt_regs

2024-02-06 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Add ftrace_partial_regs() which converts the ftrace_regs to pt_regs. If the architecture defines its own ftrace_regs, this copies partial registers to pt_regs and returns it. If not, ftrace_regs is the same as pt_regs and ftrace_partial_regs() will return

[PATCH v7 27/36] fprobe: Use ftrace_regs in fprobe exit handler

2024-02-06 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Change the fprobe exit handler to use ftrace_regs structure instead of pt_regs. This also introduce HAVE_PT_REGS_TO_FTRACE_REGS_CAST which means the ftrace_regs's memory layout is equal to the pt_regs so that those are able to cast. Fprobe introduces a new

[PATCH v7 26/36] fprobe: Use ftrace_regs in fprobe entry handler

2024-02-06 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) This allows fprobes to be available with CONFIG_DYNAMIC_FTRACE_WITH_ARGS instead of CONFIG_DYNAMIC_FTRACE_WITH_REGS, then we can enable fprobe on arm64. Signed-off-by: Masami Hiramatsu (Google) Acked-by: Florent Revest --- Changes in v6: - Keep using

[PATCH v7 15/36] function_graph: Add "task variables" per task for fgraph_ops

2024-02-06 Thread Masami Hiramatsu (Google)
s on a per task basis having a way to maintain state for each task. Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Masami Hiramatsu (Google) --- Changes in v3: - Move fgraph_ops::idx to previous patch in the series. Changes in v2: - Make description lines shorter than 76 chars. --

[PATCH v7 16/36] function_graph: Move set_graph_function tests to shadow stack global var

2024-02-06 Thread Masami Hiramatsu (Google)
are) Signed-off-by: Masami Hiramatsu (Google) --- include/linux/trace_recursion.h |5 + kernel/trace/trace.h | 32 +--- kernel/trace/trace_functions_graph.c |6 +++--- kernel/trace/trace_irqsoff.c |4 ++-- kernel/tr

[PATCH v7 14/36] function_graph: Use a simple LRU for fgraph_array index number

2024-02-06 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Since the fgraph_array index is used for the bitmap on the shadow stack, it may leave some entries after a function_graph instance is removed. Thus if another instance reuses the fgraph_array index soon after releasing it, the fgraph may confuse to call the newer

[PATCH v7 17/36] function_graph: Move graph depth stored data to shadow stack global var

2024-02-06 Thread Masami Hiramatsu (Google)
are) Signed-off-by: Masami Hiramatsu (Google) --- include/linux/trace_recursion.h | 29 - kernel/trace/trace.h| 34 -- 2 files changed, 32 insertions(+), 31 deletions(-) diff --git a/include/linux/trace_recursion.h b/incl

[PATCH v7 13/36] function_graph: Have the instances use their own ftrace_ops for filtering

2024-02-06 Thread Masami Hiramatsu (Google)
function_graph_enter_ops() instead of function_graph_enter() so that it avoid pushing on shadow stack multiple times on the same function. Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Masami Hiramatsu (Google) --- Changes in v7: - Move FGRAPH_TYPE_BITMAP type implementation to earlier patch

[PATCH v7 32/36] fprobe: Rewrite fprobe on function-graph tracer

2024-02-06 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Rewrite fprobe implementation on function-graph tracer. Major API changes are: - 'nr_maxactive' field is deprecated. - This depends on CONFIG_DYNAMIC_FTRACE_WITH_ARGS or !CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS, and CONFIG_HAVE_FUNCTION_GRAPH_FREGS. So

[PATCH v7 30/36] tracing/fprobe: Enable fprobe events with CONFIG_DYNAMIC_FTRACE_WITH_ARGS

2024-02-06 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Allow fprobe events to be enabled with CONFIG_DYNAMIC_FTRACE_WITH_ARGS. With this change, fprobe events mostly use ftrace_regs instead of pt_regs. Note that if the arch doesn't enable HAVE_PT_REGS_COMPAT_FTRACE_REGS, fprobe events will not be able to be used from

[PATCH v7 31/36] bpf: Enable kprobe_multi feature if CONFIG_FPROBE is enabled

2024-02-06 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Enable kprobe_multi feature if CONFIG_FPROBE is enabled. The pt_regs is converted from ftrace_regs by ftrace_partial_regs(), thus some registers may always returns 0. But it should be enough for function entry (access arguments) and exit (access return value

[PATCH v5 09/34] ftrace: Allow function_graph tracer to be enabled in instances

2023-12-18 Thread Masami Hiramatsu (Google)
-by: Steven Rostedt (VMware) Signed-off-by: Masami Hiramatsu (Google) --- Changes in v2: - Fix to remove set_graph_array() completely. --- include/linux/ftrace.h |1 + kernel/trace/ftrace.c|1 + kernel/trace/trace.h | 13 ++- kernel

[PATCH v5 11/34] function_graph: Have the instances use their own ftrace_ops for filtering

2023-12-18 Thread Masami Hiramatsu (Google)
unc. But that is not enough for the self- recursive tail-call case. Thus fgraph uses the bitmap entry to find it is already set (this means that entry is for previous tail call). Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Masami Hiramatsu (Google) --- Changes in v4: - Simplify get_ret_stack() sanity ch

[PATCH v5 12/34] function_graph: Use a simple LRU for fgraph_array index number

2023-12-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Since the fgraph_array index is used for the bitmap on the shadow stack, it may leave some entries after a function_graph instance is removed. Thus if another instance reuses the fgraph_array index soon after releasing it, the fgraph may confuse to call the newer

[PATCH v5 10/34] ftrace: Allow ftrace startup flags exist without dynamic ftrace

2023-12-18 Thread Masami Hiramatsu (Google)
to compile because dynamic ftrace is disabled. This change is needed to move some of the logic of what is passed to ftrace_startup() out of the parameters of ftrace_startup(). Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Masami Hiramatsu (Google) --- include/linux/ftrace.h | 18

[PATCH v5 20/34] function_graph: Add a new exit handler with parent_ip and ftrace_regs

2023-12-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Add a new return handler to fgraph_ops as 'retregfunc' which takes parent_ip and ftrace_regs instead of ftrace_graph_ret. This handler is available only if the arch support CONFIG_HAVE_FUNCTION_GRAPH_FREGS. Note that the 'retfunc' and 'reregfunc' are mutual

[PATCH v5 19/34] function_graph: Add a new entry handler with parent_ip and ftrace_regs

2023-12-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Add a new entry handler to fgraph_ops as 'entryregfunc' which takes parent_ip and ftrace_regs. Note that the 'entryfunc' and 'entryregfunc' are mutual exclusive. You can set only one of them. Signed-off-by: Masami Hiramatsu (Google) --- Changes in v3

[PATCH v5 21/34] x86/ftrace: Enable HAVE_FUNCTION_GRAPH_FREGS

2023-12-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Support HAVE_FUNCTION_GRAPH_FREGS on x86-64, which saves ftrace_regs on the stack in ftrace_graph return trampoline so that the callbacks can access registers via ftrace_regs APIs. Note that this only recovers 'rax' and 'rdx' registers because other registers

[PATCH v5 22/34] tracing: Rename ftrace_regs_return_value to ftrace_regs_get_return_value

2023-12-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Rename ftrace_regs_return_value to ftrace_regs_get_return_value as same as other ftrace_regs_get/set_* APIs. Signed-off-by: Masami Hiramatsu (Google) --- Changes in v3: - Newly added. --- arch/loongarch/include/asm/ftrace.h |2 +- arch/powerpc/include

[PATCH v5 06/34] function_graph: Allow multiple users to attach to function graph

2023-12-18 Thread Masami Hiramatsu (Google)
are called is not completely handled yet, but that shouldn't be too hard to manage. Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Masami Hiramatsu (Google) --- Changes in v2: - Check return value of the ftrace_pop_return_trace() instead of 'ret' since 'ret' is set to the address of panic

[PATCH v5 07/34] function_graph: Remove logic around ftrace_graph_entry and return

2023-12-18 Thread Masami Hiramatsu (Google)
into the function_graph tracer. Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Masami Hiramatsu (Google) --- Changes in v2: - Fix typo and make lines shorter than 76 chars in the description. - Remove unneeded return from return_run() function. --- kernel/trace/fgraph.c | 71

[PATCH v5 03/34] function_graph: Convert ret_stack to a series of longs

2023-12-18 Thread Masami Hiramatsu (Google)
for the return side of the functions. Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Masami Hiramatsu (Google) --- include/linux/sched.h |2 - kernel/trace/fgraph.c | 124 - 2 files changed, 71 insertions(+), 55 deletions(-) diff --git

[PATCH v5 08/34] ftrace/function_graph: Pass fgraph_ops to function graph callbacks

2023-12-18 Thread Masami Hiramatsu (Google)
to the function graph tracer. Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Masami Hiramatsu (Google) --- Changes in v2: - cleanup to set argument name on function prototype. --- include/linux/ftrace.h | 10 +++--- kernel/trace/fgraph.c| 16

[PATCH v5 05/34] function_graph: Add an array structure that will allow multiple callbacks

2023-12-18 Thread Masami Hiramatsu (Google)
on the shadow stack. We need to only save the index, because this will allow the fgraph_ops to be freed before the function returns (which may happen if the function call schedule for a long time). Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Masami Hiramatsu (Google) --- Changes in v2: - Remove

[PATCH v5 04/34] fgraph: Use BUILD_BUG_ON() to make sure we have structures divisible by long

2023-12-18 Thread Masami Hiramatsu (Google)
dt (VMware) Signed-off-by: Masami Hiramatsu (Google) --- kernel/trace/fgraph.c |9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/kernel/trace/fgraph.c b/kernel/trace/fgraph.c index 30edeb6d4aa9..837daf929d2a 100644 --- a/kernel/trace/fgraph.c +++ b/kernel/trac

[PATCH v5 34/34] Documentation: probes: Update fprobe on function-graph tracer

2023-12-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Update fprobe documentation for the new fprobe on function-graph tracer. This includes some bahvior changes and pt_regs to ftrace_regs interface change. Signed-off-by: Masami Hiramatsu (Google) --- Changes in v2: - Update @fregs parameter explanation

[PATCH v5 33/34] selftests/ftrace: Add a test case for repeating register/unregister fprobe

2023-12-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) This test case repeats define and undefine the fprobe dynamic event to ensure that the fprobe does not cause any issue with such operations. Signed-off-by: Masami Hiramatsu (Google) --- .../test.d/dynevent/add_remove_fprobe_repeat.tc| 19

[PATCH v5 24/34] fprobe: Use ftrace_regs in fprobe entry handler

2023-12-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) This allows fprobes to be available with CONFIG_DYNAMIC_FTRACE_WITH_ARGS instead of CONFIG_DYNAMIC_FTRACE_WITH_REGS, then we can enable fprobe on arm64. Signed-off-by: Masami Hiramatsu (Google) Acked-by: Florent Revest --- Changes from previous series: NOTHING

[PATCH v5 25/34] fprobe: Use ftrace_regs in fprobe exit handler

2023-12-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Change the fprobe exit handler to use ftrace_regs structure instead of pt_regs. This also introduce HAVE_PT_REGS_TO_FTRACE_REGS_CAST which means the ftrace_regs's memory layout is equal to the pt_regs so that those are able to cast. Fprobe introduces a new

[PATCH v5 26/34] tracing: Add ftrace_partial_regs() for converting ftrace_regs to pt_regs

2023-12-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Add ftrace_partial_regs() which converts the ftrace_regs to pt_regs. If the architecture defines its own ftrace_regs, this copies partial registers to pt_regs and returns it. If not, ftrace_regs is the same as pt_regs and ftrace_partial_regs() will return

[PATCH v5 23/34] arm64: ftrace: Enable HAVE_FUNCTION_GRAPH_FREGS

2023-12-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Enable CONFIG_HAVE_FUNCTION_GRAPH_FREGS on arm64. Note that this depends on HAVE_DYNAMIC_FTRACE_WITH_ARGS which is enabled if the compiler supports "-fpatchable-function-entry=2". If not, it continue to use ftrace_ret_regs. Signed-off-by: Masami Hiramat

[PATCH v5 32/34] selftests: ftrace: Remove obsolate maxactive syntax check

2023-12-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Since the fprobe event does not support maxactive anymore, stop testing the maxactive syntax error checking. Signed-off-by: Masami Hiramatsu (Google) --- .../ftrace/test.d/dynevent/fprobe_syntax_errors.tc |4 +--- 1 file changed, 1 insertion(+), 3 deletions

[PATCH v5 31/34] bpf: Enable kprobe_multi feature if CONFIG_FPROBE is enabled

2023-12-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Enable kprobe_multi feature if CONFIG_FPROBE is enabled. The pt_regs is converted from ftrace_regs by ftrace_partial_regs(), thus some registers may always returns 0. But it should be enough for function entry (access arguments) and exit (access return value

[PATCH v5 17/34] function_graph: Implement fgraph_reserve_data() and fgraph_retrieve_data()

2023-12-18 Thread Masami Hiramatsu (Google)
shadow ret_stack and this then can be retrieved by fgraph_retrieve_data() called by the corresponding retfunc(). Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Masami Hiramatsu (Google) --- Changes in v3: - Store fgraph_array index to the data entry. - Both function requires

[PATCH v5 18/34] function_graph: Add selftest for passing local variables

2023-12-18 Thread Masami Hiramatsu (Google)
From: Steven Rostedt (VMware) Add boot up selftest that passes variables from a function entry to a function exit, and make sure that they do get passed around. Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Masami Hiramatsu (Google) --- Changes in v2: - Add reserved size test

[PATCH v5 16/34] function_graph: Move graph notrace bit to shadow stack global var

2023-12-18 Thread Masami Hiramatsu (Google)
are) Signed-off-by: Masami Hiramatsu (Google) --- Changes in v2: - Make description lines shorter than 76 chars. --- include/linux/trace_recursion.h |7 --- kernel/trace/trace.h |9 + kernel/trace/trace_functions_graph.c | 10 ++ 3 files chan

[PATCH v5 00/34] tracing: fprobe: function_graph: Multi-function graph and fprobe on fgraph

2023-12-18 Thread Masami Hiramatsu (Google)
can also be found below branch. https://git.kernel.org/pub/scm/linux/kernel/git/mhiramat/linux.git/log/?h=topic/fprobe-on-fgraph Thank you, --- Masami Hiramatsu (Google) (19): tracing: Add a comment about ftrace_regs definition x86: tracing: Add ftrace_regs definition in the header

[PATCH v5 01/34] tracing: Add a comment about ftrace_regs definition

2023-12-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) To clarify what will be expected on ftrace_regs, add a comment to the architecture independent definition of the ftrace_regs. Signed-off-by: Masami Hiramatsu (Google) --- Changes in v3: - Add instruction pointer Changes in v2: - newly added. --- include

[PATCH v5 02/34] x86: tracing: Add ftrace_regs definition in the header

2023-12-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Add ftrace_regs definition for x86_64 in the ftrace header to clarify what register will be accessible from ftrace_regs. Signed-off-by: Masami Hiramatsu (Google) --- Changes in v3: - Add rip to be saved. Changes in v2: - Newly added. --- arch/x86/include

[PATCH v5 28/34] fprobe: Rewrite fprobe on function-graph tracer

2023-12-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Rewrite fprobe implementation on function-graph tracer. Major API changes are: - 'nr_maxactive' field is deprecated. - This depends on CONFIG_DYNAMIC_FTRACE_WITH_ARGS or !CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS, and CONFIG_HAVE_FUNCTION_GRAPH_FREGS. So

[PATCH v5 30/34] tracing/fprobe: Enable fprobe events with CONFIG_DYNAMIC_FTRACE_WITH_ARGS

2023-12-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Allow fprobe events to be enabled with CONFIG_DYNAMIC_FTRACE_WITH_ARGS. With this change, fprobe events mostly use ftrace_regs instead of pt_regs. Note that if the arch doesn't enable HAVE_PT_REGS_COMPAT_FTRACE_REGS, fprobe events will not be able to be used from

[PATCH v5 27/34] tracing: Add ftrace_fill_perf_regs() for perf event

2023-12-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Add ftrace_fill_perf_regs() which should be compatible with the perf_fetch_caller_regs(). In other words, the pt_regs returned from the ftrace_fill_perf_regs() must satisfy 'user_mode(regs) == false' and can be used for stack tracing. Signed-off-by: Masami

[PATCH v5 29/34] tracing/fprobe: Remove nr_maxactive from fprobe

2023-12-18 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) Remove depercated fprobe::nr_maxactive. This involves fprobe events to rejects the maxactive number. Signed-off-by: Masami Hiramatsu (Google) --- Changes in v2: - Newly added. --- include/linux/fprobe.h |2 -- kernel/trace/trace_fprobe.c | 44

[PATCH v5 15/34] function_graph: Move graph depth stored data to shadow stack global var

2023-12-18 Thread Masami Hiramatsu (Google)
are) Signed-off-by: Masami Hiramatsu (Google) --- include/linux/trace_recursion.h | 29 - kernel/trace/trace.h| 34 -- 2 files changed, 32 insertions(+), 31 deletions(-) diff --git a/include/linux/trace_recursion.h b/incl

[PATCH v5 13/34] function_graph: Add "task variables" per task for fgraph_ops

2023-12-18 Thread Masami Hiramatsu (Google)
s on a per task basis having a way to maintain state for each task. Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Masami Hiramatsu (Google) --- Changes in v3: - Move fgraph_ops::idx to previous patch in the series. Changes in v2: - Make description lines shorter than 76 chars. --

[PATCH v5 14/34] function_graph: Move set_graph_function tests to shadow stack global var

2023-12-18 Thread Masami Hiramatsu (Google)
are) Signed-off-by: Masami Hiramatsu (Google) --- include/linux/trace_recursion.h |5 + kernel/trace/trace.h | 32 +--- kernel/trace/trace_functions_graph.c |6 +++--- kernel/trace/trace_irqsoff.c |4 ++-- kernel/tr

[PATCH] tracing: Fix possible memory leak in ftrace_regsiter_direct()

2023-12-27 Thread Masami Hiramatsu (Google)
From: Masami Hiramatsu (Google) If ftrace_register_direct() called with a large number of target functions (e.g. 65), the free_hash can be updated twice or more in the ftrace_add_rec_direct() without freeing the previous hash memory. Thus this can cause a memory leak. Fix this issue

[PATCH v6 05/36] function_graph: Convert ret_stack to a series of longs

2024-01-12 Thread Masami Hiramatsu (Google)
for the return side of the functions. Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Masami Hiramatsu (Google) --- include/linux/sched.h |2 - kernel/trace/fgraph.c | 124 - 2 files changed, 71 insertions(+), 55 deletions(-) diff --git

[PATCH v6 08/36] function_graph: Allow multiple users to attach to function graph

2024-01-12 Thread Masami Hiramatsu (Google)
are called is not completely handled yet, but that shouldn't be too hard to manage. Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Masami Hiramatsu (Google) --- Changes in v2: - Check return value of the ftrace_pop_return_trace() instead of 'ret' since 'ret' is set to the address of panic

<    1   2   3   4   5   6   7   8   9   10   >