linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] MIPS/bpf: Enable bpf_probe_read{, str}() on MIPS again
@ 2021-03-17  7:15 Tiezhu Yang
  2021-03-17  9:59 ` Sergei Shtylyov
  2021-03-17 22:18 ` Daniel Borkmann
  0 siblings, 2 replies; 4+ messages in thread
From: Tiezhu Yang @ 2021-03-17  7:15 UTC (permalink / raw)
  To: Thomas Bogendoerfer; +Cc: linux-mips, bpf, linux-kernel, Xuefeng Li

After commit 0ebeea8ca8a4 ("bpf: Restrict bpf_probe_read{, str}() only to
archs where they work"), bpf_probe_read{, str}() functions were not longer
available on MIPS, so there exists some errors when running bpf program:

root@linux:/home/loongson/bcc# python examples/tracing/task_switch.py
bpf: Failed to load program: Invalid argument
[...]
11: (85) call bpf_probe_read#4
unknown func bpf_probe_read#4
[...]
Exception: Failed to load BPF program count_sched: Invalid argument

So select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE in arch/mips/Kconfig,
otherwise the bpf old helper bpf_probe_read() will not be available.

This is similar with the commit d195b1d1d1196 ("powerpc/bpf: Enable
bpf_probe_read{, str}() on powerpc again").

Fixes: 0ebeea8ca8a4 ("bpf: Restrict bpf_probe_read{, str}() only to archs where they work")
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 arch/mips/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 160b3a8..4b94ec7 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -6,6 +6,7 @@ config MIPS
 	select ARCH_BINFMT_ELF_STATE if MIPS_FP_SUPPORT
 	select ARCH_HAS_FORTIFY_SOURCE
 	select ARCH_HAS_KCOV
+	select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
 	select ARCH_HAS_PTE_SPECIAL if !(32BIT && CPU_HAS_RIXI)
 	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
 	select ARCH_HAS_UBSAN_SANITIZE_ALL
-- 
2.1.0


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

* Re: [PATCH] MIPS/bpf: Enable bpf_probe_read{, str}() on MIPS again
  2021-03-17  7:15 [PATCH] MIPS/bpf: Enable bpf_probe_read{, str}() on MIPS again Tiezhu Yang
@ 2021-03-17  9:59 ` Sergei Shtylyov
  2021-03-17 22:18 ` Daniel Borkmann
  1 sibling, 0 replies; 4+ messages in thread
From: Sergei Shtylyov @ 2021-03-17  9:59 UTC (permalink / raw)
  To: Tiezhu Yang, Thomas Bogendoerfer
  Cc: linux-mips, bpf, linux-kernel, Xuefeng Li

On 17.03.2021 10:15, Tiezhu Yang wrote:

> After commit 0ebeea8ca8a4 ("bpf: Restrict bpf_probe_read{, str}() only to
> archs where they work"), bpf_probe_read{, str}() functions were not longer

    No longer.

> available on MIPS, so there exists some errors when running bpf program:

     Exist.

> root@linux:/home/loongson/bcc# python examples/tracing/task_switch.py
> bpf: Failed to load program: Invalid argument
> [...]
> 11: (85) call bpf_probe_read#4
> unknown func bpf_probe_read#4
> [...]
> Exception: Failed to load BPF program count_sched: Invalid argument
> 
> So select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE in arch/mips/Kconfig,
> otherwise the bpf old helper bpf_probe_read() will not be available.
> 
> This is similar with the commit d195b1d1d1196 ("powerpc/bpf: Enable
> bpf_probe_read{, str}() on powerpc again").
> 
> Fixes: 0ebeea8ca8a4 ("bpf: Restrict bpf_probe_read{, str}() only to archs where they work")
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
[...]

MBR, Sergei

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

* Re: [PATCH] MIPS/bpf: Enable bpf_probe_read{, str}() on MIPS again
  2021-03-17  7:15 [PATCH] MIPS/bpf: Enable bpf_probe_read{, str}() on MIPS again Tiezhu Yang
  2021-03-17  9:59 ` Sergei Shtylyov
@ 2021-03-17 22:18 ` Daniel Borkmann
  2021-03-17 23:08   ` Thomas Bogendoerfer
  1 sibling, 1 reply; 4+ messages in thread
From: Daniel Borkmann @ 2021-03-17 22:18 UTC (permalink / raw)
  To: Tiezhu Yang, Thomas Bogendoerfer
  Cc: linux-mips, bpf, linux-kernel, Xuefeng Li

On 3/17/21 8:15 AM, Tiezhu Yang wrote:
> After commit 0ebeea8ca8a4 ("bpf: Restrict bpf_probe_read{, str}() only to
> archs where they work"), bpf_probe_read{, str}() functions were not longer
> available on MIPS, so there exists some errors when running bpf program:
> 
> root@linux:/home/loongson/bcc# python examples/tracing/task_switch.py
> bpf: Failed to load program: Invalid argument
> [...]
> 11: (85) call bpf_probe_read#4
> unknown func bpf_probe_read#4
> [...]
> Exception: Failed to load BPF program count_sched: Invalid argument
> 
> So select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE in arch/mips/Kconfig,
> otherwise the bpf old helper bpf_probe_read() will not be available.
> 
> This is similar with the commit d195b1d1d1196 ("powerpc/bpf: Enable
> bpf_probe_read{, str}() on powerpc again").
> 
> Fixes: 0ebeea8ca8a4 ("bpf: Restrict bpf_probe_read{, str}() only to archs where they work")
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>

Thomas, I presume you pick this up via mips tree (with typos fixed)? Or do you
want us to route the fix via bpf with your ACK? (I'm fine either way.)

Thanks,
Daniel

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

* Re: [PATCH] MIPS/bpf: Enable bpf_probe_read{, str}() on MIPS again
  2021-03-17 22:18 ` Daniel Borkmann
@ 2021-03-17 23:08   ` Thomas Bogendoerfer
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Bogendoerfer @ 2021-03-17 23:08 UTC (permalink / raw)
  To: Daniel Borkmann; +Cc: Tiezhu Yang, linux-mips, bpf, linux-kernel, Xuefeng Li

On Wed, Mar 17, 2021 at 11:18:48PM +0100, Daniel Borkmann wrote:
> On 3/17/21 8:15 AM, Tiezhu Yang wrote:
> > After commit 0ebeea8ca8a4 ("bpf: Restrict bpf_probe_read{, str}() only to
> > archs where they work"), bpf_probe_read{, str}() functions were not longer
> > available on MIPS, so there exists some errors when running bpf program:
> > 
> > root@linux:/home/loongson/bcc# python examples/tracing/task_switch.py
> > bpf: Failed to load program: Invalid argument
> > [...]
> > 11: (85) call bpf_probe_read#4
> > unknown func bpf_probe_read#4
> > [...]
> > Exception: Failed to load BPF program count_sched: Invalid argument
> > 
> > So select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE in arch/mips/Kconfig,
> > otherwise the bpf old helper bpf_probe_read() will not be available.
> > 
> > This is similar with the commit d195b1d1d1196 ("powerpc/bpf: Enable
> > bpf_probe_read{, str}() on powerpc again").
> > 
> > Fixes: 0ebeea8ca8a4 ("bpf: Restrict bpf_probe_read{, str}() only to archs where they work")
> > Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> 
> Thomas, I presume you pick this up via mips tree (with typos fixed)? Or do you
> want us to route the fix via bpf with your ACK? (I'm fine either way.)

I'll take it via mips tree.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

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

end of thread, other threads:[~2021-03-17 23:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-17  7:15 [PATCH] MIPS/bpf: Enable bpf_probe_read{, str}() on MIPS again Tiezhu Yang
2021-03-17  9:59 ` Sergei Shtylyov
2021-03-17 22:18 ` Daniel Borkmann
2021-03-17 23:08   ` Thomas Bogendoerfer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).