On Mon, 12 Mar 2018 11:44:21 +0100
Daniel Borkmann wrote:
> Hi Masami,
>
> On 03/12/2018 11:27 AM, Masami Hiramatsu wrote:
> > On Mon, 12 Mar 2018 19:00:49 +0900
> > Masami Hiramatsu wrote:
> >
> >> Since the kprobe which was optimized by jump can not
On Mon, 12 Mar 2018 19:00:49 +0900
Masami Hiramatsu wrote:
> Since the kprobe which was optimized by jump can not change
> the execution path, the kprobe for error-injection must not
> be optimized. To prohibit it, set a dummy post-handler as
> officially stated in Documentation
ction framework")
Signed-off-by: Masami Hiramatsu
---
kernel/fail_function.c | 10 ++
1 file changed, 10 insertions(+)
diff --git a/kernel/fail_function.c b/kernel/fail_function.c
index 21b0122cb39c..1d5632d8bbcc 100644
--- a/kernel/fail_function.c
+++ b/kernel/fail_function.c
@@ -1
On Sat, 13 Jan 2018 22:28:29 +0900
Akinobu Mita wrote:
> 2018-01-13 2:56 GMT+09:00 Masami Hiramatsu :
> > Support in-kernel fault-injection framework via debugfs.
> > This allows you to inject a conditional error to specified
> > function using debugfs interfaces.
> >
eature for kprobe or ftrace etc.
Signed-off-by: Masami Hiramatsu
Reviewed-by: Josef Bacik
---
Changes in v3:
- Fix a build error for asmlinkage on i386 by including compiler.h
- Fix "CONFIG_FUNCTION_ERROR_INJECT" typo.
- Separate CONFIG_MODULES dependent code
- Add CONFIG_KP
devices: 1
Devices:
IDSIZE PATH
1 1001.00MiB /dev/loop2
mount: mount /dev/loop2 on /opt/tmpmnt failed: Cannot allocate memory
SUCCESS!
===
Signed-off-by: Masami Hiramatsu
Reviewed-by: Josef Bacik
---
Changes in v3:
- Check and adjust error value for
/debug/error_injection/list
open_ctree [btrfs]ERRNO
io_ctl_init [btrfs] ERRNO
Signed-off-by: Masami Hiramatsu
Reviewed-by: Josef Bacik
---
fs/btrfs/disk-io.c|2 +-
fs/btrfs/free-space-cache.c |2 +-
include/asm-generic/error-injection.h | 23
Compare instruction pointer with original one on the
stack instead using per-cpu bpf_kprobe_override flag.
This patch also consolidates reset_current_kprobe() and
preempt_enable_no_resched() blocks. Those can be done
in one place.
Signed-off-by: Masami Hiramatsu
Reviewed-by: Josef Bacik
value, that operation must
be done before the target function starts making stackframe.
As a side effect, bpf error injection is no need to depend on
function-tracer. It can work with sw-breakpoint based kprobe
events too.
Signed-off-by: Masami Hiramatsu
Reviewed-by: Josef Bacik
---
Changes in v3
within_error_injection returns false always.
- [5/5] Update to support multiple function error injection.
Thank you,
---
Masami Hiramatsu (5):
tracing/kprobe: bpf: Check error injectable event is on function entry
tracing/kprobe: bpf: Compare instruction pointer with original one
On Thu, 11 Jan 2018 23:44:57 +0900
Akinobu Mita wrote:
> 2018-01-11 9:51 GMT+09:00 Masami Hiramatsu :
> > Support in-kernel fault-injection framework via debugfs.
> > This allows you to inject a conditional error to specified
> > function using debugfs interfaces.
> >
devices: 1
Devices:
IDSIZE PATH
1 1001.00MiB /dev/loop2
mount: mount /dev/loop2 on /opt/tmpmnt failed: Cannot allocate memory
SUCCESS!
===
Signed-off-by: Masami Hiramatsu
Reviewed-by: Josef Bacik
---
Changes in v3:
- Check and adjust error value for
/debug/error_injection/list
open_ctree [btrfs]ERRNO
io_ctl_init [btrfs] ERRNO
Signed-off-by: Masami Hiramatsu
Reviewed-by: Josef Bacik
---
fs/btrfs/disk-io.c|2 +-
fs/btrfs/free-space-cache.c |2 +-
include/asm-generic/error-injection.h | 23
eature for kprobe or ftrace etc.
Signed-off-by: Masami Hiramatsu
---
Changes in v3:
- Fix a build error for asmlinkage on i386 by including compiler.h
- Fix "CONFIG_FUNCTION_ERROR_INJECT" typo.
- Separate CONFIG_MODULES dependent code
- Add CONFIG_KPROBES dependency for ar
Compare instruction pointer with original one on the
stack instead using per-cpu bpf_kprobe_override flag.
This patch also consolidates reset_current_kprobe() and
preempt_enable_no_resched() blocks. Those can be done
in one place.
Signed-off-by: Masami Hiramatsu
Reviewed-by: Josef Bacik
value, that operation must
be done before the target function starts making stackframe.
As a side effect, bpf error injection is no need to depend on
function-tracer. It can work with sw-breakpoint based kprobe
events too.
Signed-off-by: Masami Hiramatsu
Reviewed-by: Josef Bacik
---
Changes in v3
/858176/
Changes in v3:
- [3/5] Change error-injection.h including points to each file
which uses ALLOW_ERROR_INJECTION instead of bpf.h
- Add Reviewed-by from Josef Bacik except [3/5]
Thank you,
---
Masami Hiramatsu (5):
tracing/kprobe: bpf: Check error injectable event is on function
On Wed, 10 Jan 2018 10:36:15 -0500
Josef Bacik wrote:
> On Wed, Jan 10, 2018 at 07:18:05PM +0900, Masami Hiramatsu wrote:
> > Since error-injection framework is not limited to be used
> > by kprobes, nor bpf. Other kernel subsystems can use it
> > freely for checking safene
Compare instruction pointer with original one on the
stack instead using per-cpu bpf_kprobe_override flag.
This patch also consolidates reset_current_kprobe() and
preempt_enable_no_resched() blocks. Those can be done
in one place.
Signed-off-by: Masami Hiramatsu
---
kernel/trace/bpf_trace.c
eature for kprobe or ftrace etc.
Signed-off-by: Masami Hiramatsu
---
Changes in v3:
- Fix a build error for asmlinkage on i386 by including compiler.h
- Fix "CONFIG_FUNCTION_ERROR_INJECT" typo.
- Separate CONFIG_MODULES dependent code
- Add CONFIG_KPROBES dependency for ar
/debug/error_injection/list
open_ctree [btrfs]ERRNO
io_ctl_init [btrfs] ERRNO
Signed-off-by: Masami Hiramatsu
---
fs/btrfs/disk-io.c|2 +-
fs/btrfs/free-space-cache.c |2 +-
include/asm-generic/error-injection.h | 23 +++---
include
devices: 1
Devices:
IDSIZE PATH
1 1001.00MiB /dev/loop2
mount: mount /dev/loop2 on /opt/tmpmnt failed: Cannot allocate memory
SUCCESS!
===
Signed-off-by: Masami Hiramatsu
---
Changes in v3:
- Check and adjust error value for each target function
value, that operation must
be done before the target function starts making stackframe.
As a side effect, bpf error injection is no need to depend on
function-tracer. It can work with sw-breakpoint based kprobe
events too.
Signed-off-by: Masami Hiramatsu
---
Changes in v3:
- Move
n late_initcall stage.
- [4/5] Newly added
- [5/5] Check and adjust error value for each target function
and add more documents and example.
Thank you,
---
Masami Hiramatsu (5):
tracing/kprobe: bpf: Check error injectable event is on function entry
tracing/kprobe: bpf: Co
On Thu, 4 Jan 2018 11:07:16 -0500
Josef Bacik wrote:
> On Tue, Dec 26, 2017 at 04:46:28PM +0900, Masami Hiramatsu wrote:
> > Hi Josef and Alexei,
> >
> > Here are the 2nd version of patches to moving error injection
> > table from kprobes. In this series I did a small
On Sun, 7 Jan 2018 19:01:57 -0800
Alexei Starovoitov wrote:
> On 12/29/17 12:20 AM, Masami Hiramatsu wrote:
> >> Please run Josef's test in the !ftrace setup.
> > Yes, I'll add the result of the test case.
>
> if Josef's test is passing in !ftrace config,
On Thu, 28 Dec 2017 17:03:24 -0800
Alexei Starovoitov wrote:
> On 12/28/17 12:20 AM, Masami Hiramatsu wrote:
> > On Wed, 27 Dec 2017 20:32:07 -0800
> > Alexei Starovoitov wrote:
> >
> >> On 12/27/17 8:16 PM, Steven Rostedt wrote:
> >>> On Wed, 27 Dec 20
On Thu, 28 Dec 2017 17:11:31 -0800
Alexei Starovoitov wrote:
> On 12/27/17 11:51 PM, Masami Hiramatsu wrote:
> >
> > Then what happen if the user set invalid retval to those functions?
> > even if we limit the injectable functions, it can cause a problem,
> >
&g
ll cover this situation.
> Probably only special .config is needed to disable ftrace, so
> "kprobe on entry but not ftrace" check will kick in.
Right. If you need to test it, you can run Josef's test case without
CONFIG_DYNAMIC_FTRACE.
> But I didn't get an impression that this
On Wed, 27 Dec 2017 19:45:42 -0800
Alexei Starovoitov wrote:
> On 12/27/17 6:34 PM, Masami Hiramatsu wrote:
> > On Wed, 27 Dec 2017 14:46:24 -0800
> > Alexei Starovoitov wrote:
> >
> >> On 12/26/17 9:56 PM, Masami Hiramatsu wrote:
> >>> On Tu
On Wed, 27 Dec 2017 19:49:28 -0800
Alexei Starovoitov wrote:
> On 12/27/17 5:38 PM, Masami Hiramatsu wrote:
> > On Wed, 27 Dec 2017 14:49:46 -0800
> > Alexei Starovoitov wrote:
> >
> >> On 12/27/17 12:09 AM, Masami Hiramatsu wrote:
> >>> On Tu
On Wed, 27 Dec 2017 14:46:24 -0800
Alexei Starovoitov wrote:
> On 12/26/17 9:56 PM, Masami Hiramatsu wrote:
> > On Tue, 26 Dec 2017 17:57:32 -0800
> > Alexei Starovoitov wrote:
> >
> >> On Tue, Dec 26, 2017 at 04:46:59PM +0900, Masami Hiramatsu wrote:
> >>
On Wed, 27 Dec 2017 14:49:46 -0800
Alexei Starovoitov wrote:
> On 12/27/17 12:09 AM, Masami Hiramatsu wrote:
> > On Tue, 26 Dec 2017 18:12:56 -0800
> > Alexei Starovoitov wrote:
> >
> >> On Tue, Dec 26, 2017 at 04:48:25PM +0900, Masami Hiramatsu wrote:
> >
On Tue, 26 Dec 2017 18:12:56 -0800
Alexei Starovoitov wrote:
> On Tue, Dec 26, 2017 at 04:48:25PM +0900, Masami Hiramatsu wrote:
> > Support in-kernel fault-injection framework via debugfs.
> > This allows you to inject a conditional error to specified
> > function usi
On Tue, 26 Dec 2017 17:57:32 -0800
Alexei Starovoitov wrote:
> On Tue, Dec 26, 2017 at 04:46:59PM +0900, Masami Hiramatsu wrote:
> > Check whether error injectable event is on function entry or not.
> > Currently it checks the event is ftrace-based kprobes or not,
> >
Support in-kernel fault-injection framework via debugfs.
This allows you to inject a conditional error to specified
function using debugfs interfaces.
Signed-off-by: Masami Hiramatsu
---
Documentation/fault-injection/fault-injection.txt |5 +
kernel/Makefile
eature for kprobe or ftrace etc.
Signed-off-by: Masami Hiramatsu
---
Changes in v2:
- Fix the override function name to override_function_with_return()
- Show only function name in the list, user don't have to care about
it's size, since function override only happens at the entr
Compare instruction pointer with original one on the
stack instead using per-cpu bpf_kprobe_override flag.
This patch also consolidates reset_current_kprobe() and
preempt_enable_no_resched() blocks. Those can be done
in one place.
Signed-off-by: Masami Hiramatsu
---
kernel/trace/bpf_trace.c
value, that operation must
be done before the target function starts making stackframe.
As a side effect, bpf error injection is no need to depend on
function-tracer. It can work with sw-breakpoint based kprobe
events too.
Signed-off-by: Masami Hiramatsu
---
kernel/trace/Kconfig|2
TW, I think we should add an error-range description in
ALLOW_ERROR_INJECTION() macro. If user sets a success
return value and override it by mistake, caller must
break data or cause kernel panic.
Thank you,
---
Masami Hiramatsu (4):
tracing/kprobe: bpf: Check error injectable event is on fun
eature for kprobe or ftrace etc.
Signed-off-by: Masami Hiramatsu
---
arch/Kconfig |2
arch/x86/Kconfig |2
arch/x86/include/asm/error-injection.h | 12 ++
arch/x86/kernel/kprobes/ftrace.c | 14 --
arch/x86/lib/Makefile
Compare instruction pointer with original one on the
stack instead using per-cpu bpf_kprobe_override flag.
This patch also consolidates reset_current_kprobe() and
preempt_enable_no_resched() blocks. Those can be done
in one place.
Signed-off-by: Masami Hiramatsu
---
kernel/trace/bpf_trace.c
value, that operation must
be done before the target function starts making stackframe.
As a side effect, bpf error injection is no need to depend on
function-tracer. It can work with sw-breakpoint based kprobe
events too.
Signed-off-by: Masami Hiramatsu
---
kernel/trace/Kconfig|2
maybe we also need a document how to use)
BTW, it seems there are many error injection frameworks in
lib/. We may also consider these distinctions.
Thank you,
---
Masami Hiramatsu (3):
tracing/kprobe: bpf: Check error injectable event is on function entry
tracing/kprobe: bpf:
void arm_all_kprobes(void)
> {
> struct hlist_head *head;
> @@ -2548,6 +2706,11 @@ static int __init debugfs_kprobe_init(void)
> if (!file)
> goto error;
>
> + file = debugfs_create_file("error_injection_list", 0444, dir, NULL,
> +
On Tue, 19 Dec 2017 18:14:17 -0800
Alexei Starovoitov wrote:
> On 12/18/17 10:29 PM, Masami Hiramatsu wrote:
> >>
> >> +#if defined(__KERNEL__) && !defined(__ASSEMBLY__)
> >> +#ifdef CONFIG_BPF_KPROBE_OVERRIDE
> >
> > BTW, CONFIG_BPF_KPROB
On Mon, 18 Dec 2017 16:09:30 +0100
Daniel Borkmann wrote:
> On 12/18/2017 10:51 AM, Masami Hiramatsu wrote:
> > On Fri, 15 Dec 2017 14:12:54 -0500
> > Josef Bacik wrote:
> >> From: Josef Bacik
> >>
> >> Error injection is sloppy and very ad-hoc. BPF
bugfs_kprobe_ei_ops = {
> + .open = kprobe_ei_open,
> + .read = seq_read,
> + .llseek = seq_lseek,
> + .release= seq_release,
> +};
> +
> static void arm_all_kprobes(void)
> {
> struct hlist_head *head;
> @@ -2548,6 +2706,11 @@ static int __init debugfs_kpr
race/trace_probe.h
> @@ -252,6 +252,8 @@ struct symbol_cache;
> unsigned long update_symbol_cache(struct symbol_cache *sc);
> void free_symbol_cache(struct symbol_cache *sc);
> struct symbol_cache *alloc_symbol_cache(const char *sym, long offset);
> +int trace_kprobe_ftrace(struc
,
> +};
> +
> static void arm_all_kprobes(void)
> {
> struct hlist_head *head;
> @@ -2548,6 +2706,11 @@ static int __init debugfs_kprobe_init(void)
> if (!file)
> goto error;
>
> + file = debugfs_create_file("error_injection_list", 0444, dir, NULL,
> + &debugfs_kprobe_ei_ops);
> + if (!file)
> + goto error;
> +
> return 0;
>
> error:
> diff --git a/kernel/module.c b/kernel/module.c
> index dea01ac9cb74..bd695bfdc5c4 100644
> --- a/kernel/module.c
> +++ b/kernel/module.c
> @@ -3118,7 +3118,11 @@ static int find_module_sections(struct module *mod,
> struct load_info *info)
>sizeof(*mod->ftrace_callsites),
>&mod->num_ftrace_callsites);
> #endif
> -
> +#ifdef CONFIG_BPF_KPROBE_OVERRIDE
> + mod->kprobe_ei_funcs = section_objs(info, "_kprobe_error_inject_list",
> + sizeof(*mod->kprobe_ei_funcs),
> + &mod->num_kprobe_ei_funcs);
> +#endif
> mod->extable = section_objs(info, "__ex_table",
> sizeof(*mod->extable), &mod->num_exentries);
>
> --
> 2.7.5
>
--
Masami Hiramatsu
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
d1c958 EFLAGS: 0202 ORIG_RAX:
> > > > 00a5
> > > > [ 1847.813615] RAX: ffda RBX: 00007f6ebefba63a RCX:
> > > > 7f6ebecc1b5a
> > > > [ 1847.814302] RDX: 00bfd010 RSI: 00bfa230 RDI:
> > > > 0
51 matches
Mail list logo