Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFE: add RISC-V support #110

Closed
pcmoore opened this issue Feb 20, 2018 · 28 comments
Closed

RFE: add RISC-V support #110

pcmoore opened this issue Feb 20, 2018 · 28 comments

Comments

@pcmoore
Copy link
Member

pcmoore commented Feb 20, 2018

From @rwmjones:

RISC-V is an open source, free ISA developed at UCB since 2010 (https://riscv.org/).

We have one older PR from @rwmjones in #50 which added libseccomp support before the kernel support was in place (Fall 2016).

We have a more recent PR from @Icenowy in #108 which adds libseccomp support, although the kernel support is still unknown (February 2018).

This issue is designed to track notes and progress across PRs.

@pcmoore pcmoore added this to the v2.5 milestone Feb 20, 2018
@pcmoore pcmoore added this to Backlog in Architecture Support via automation Feb 20, 2018
This was referenced Feb 20, 2018
@sorear
Copy link

sorear commented Feb 20, 2018

@pcmoore Kernel support is upstream in 4.15.0. (More drivers are needed to boot, they are expected in 4.17, but 4.15 has the complete uapi)

@pcmoore
Copy link
Member Author

pcmoore commented Feb 21, 2018

@sorear I think it's okay to just comment once in the other PR for things like the above.

... and for my future self, it doesn't appear that v4.16-rc2+ has the necessary HAVE_ARCH_SECCOMP_FILTER support for RISC-V.

@pcmoore
Copy link
Member Author

pcmoore commented Apr 5, 2018

Quick update, kernel support is still missing in Linus' tree:

# grep "HAVE_ARCH_SECCOMP_FILTER" $(find arch/*/  -type f)
arch/arm/Kconfig:       select HAVE_ARCH_SECCOMP_FILTER if (AEABI && !OABI_COMPAT)
arch/arm/kernel/ptrace.c:#ifdef CONFIG_HAVE_ARCH_SECCOMP_FILTER
arch/arm64/Kconfig:     select HAVE_ARCH_SECCOMP_FILTER
arch/mips/Kconfig:      select HAVE_ARCH_SECCOMP_FILTER
arch/parisc/Kconfig:    select HAVE_ARCH_SECCOMP_FILTER
arch/powerpc/Kconfig:   select HAVE_ARCH_SECCOMP_FILTER
arch/s390/Kconfig:      select HAVE_ARCH_SECCOMP_FILTER
arch/um/Kconfig.common: select HAVE_ARCH_SECCOMP_FILTER
arch/x86/Kconfig:       select HAVE_ARCH_SECCOMP_FILTER

@terpstra
Copy link

terpstra commented Apr 16, 2018

I pushed a prototype commit to our development risc-v kernel branch here: riscvarchive/riscv-linux@0712587

I'm not really sure how to test it, though.

@pcmoore
Copy link
Member Author

pcmoore commented Apr 17, 2018

Hi @terpstra

If you haven't already been in touch with @kees you might want to talk with him as he maintains the seccomp code in the kernel. As far as testing is concerned, libseccomp has a few "live" tests (cd tests; ./regression -T live) which exercise the seccomp code in the kernel; there is also samples/seccomp in the kernel sources, but I don't have any direct experience with those.

@davidlt
Copy link

davidlt commented May 25, 2018

I think, there is a 3rd patch in openSUSE: https://build.opensuse.org/package/view_file/openSUSE:Factory:RISCV/libseccomp/riscv.patch?expand=1

but it's missing __NR_riscv_flush_icache.

@pcmoore
Copy link
Member Author

pcmoore commented Dec 6, 2018

The latest libseccomp PR: #134

@carlosedp
Copy link

Hi @terpstra, have the patch riscvarchive/riscv-linux@0712587 merged into the Mainline Kernel? Any idea on a timeline for it? Maybe @palmer-dabbelt can help-out on this.

@terpstra
Copy link

terpstra commented Jun 5, 2019 via email

@davidlt
Copy link

davidlt commented Jun 7, 2019

I have sent out seccomp v1 patches in few months ago (I think), which was passing libseccomp testsuite and kernel selftests. I need to find time to retest on the latest kernel to send out v2. libseccomp patch is here: #134

@carlosedp how fast do you need it?

@pcmoore
Copy link
Member Author

pcmoore commented Jun 7, 2019

I wouldn't worry about it until the kernel patch has landed in Linus' tree, but PR #134 looks like it needs a forward port to the current libseccomp master branch.

I haven't looked at RISC-V in some time, is there any reasonably priced and reasonably performing RISC-V hardware for development/testing that will run a standard-ish distro?

@carlosedp
Copy link

@davidlt I've pulled and applied the PR134 patch and it tests perfectly even without Kernel patches. It would be great to gave libseccomp to open up building other dependencies. I'm already running Docker locally built with this.

@pcmoore On the hardware side, only the SiFive Unleashed board that is pricy. There is a Qemu VM I packed with Debian (but also there is a Fedora rootfs that I could pack). It can be used for development.

I'm tracking the dependencies on https://github.com/carlosedp/riscv-bringup

@carlosedp
Copy link

Actually I just retested with with the Tip with PR134. I got 6 failed tests.

Results can be seen on https://gist.github.com/carlosedp/7e1e222e5ccb4b45faa357dd6b30ac9a

@pcmoore
Copy link
Member Author

pcmoore commented Jun 7, 2019

Hmm, that's odd. According to the test output it appears that test 46 is failing with ENOMEM, which is a bit unusual (see tools/scmp_bpf_sim.c). I'm rather busy at the moment, and don't have a RISC-V VM handy to test this, but if you need some pointers on how to debug this don't hesitate to ask.

@carlosedp
Copy link

I have both a Qemu VM and a Risc-V board. My current Kernel does not have seccomp patches applied. If you have tips on how I can help, I'm glad to!
Otherwise if you want a RiscV Qemu VM, I put together a pack on https://github.com/carlosedp/riscv-bringup#virtual-machine-and-pre-built-docker.

@pcmoore pcmoore removed this from the v2.5 milestone Aug 26, 2019
@pcmoore
Copy link
Member Author

pcmoore commented Nov 11, 2019

@davidlt any update on the RISC-V kernel support?

@rwmjones
Copy link

https://lkml.org/lkml/2019/10/14/811

It seems to have been fully reviewed, but the final patch lost between two developers.

@davidlt
Copy link

davidlt commented Nov 12, 2019

The patch was sent to Linus for 5.4 kernel, but he didn't want to pull it so far into RCs. The patch will land in 5.5 merge window.

@aurel32
Copy link

aurel32 commented Nov 12, 2019

Note that the patch is already in linux-next, if that matters.

@pcmoore pcmoore added this to the v2.5 milestone Nov 12, 2019
@pcmoore
Copy link
Member Author

pcmoore commented Nov 12, 2019

That's good news, thanks everyone! Since it looks like we are a few weeks away from seeing this in Linus' tree I'm going to go ahead and mark this for the libseccomp v2.5 milestone.

Does someone want to volunteer to refresh/test/resubmit the PR once the merge window closes?

@davidlt
Copy link

davidlt commented Nov 13, 2019

I will send a new version of PR once libseccomp lands in Linus's tree.

@pcmoore
Copy link
Member Author

pcmoore commented Nov 13, 2019

Great, thanks @davidlt.

@aurel32
Copy link

aurel32 commented Nov 27, 2019

seccomp support just landed in Linus's tree:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5340627e3fe08030988bdda46dd86cd5d5fb7517

@davidlt
Copy link

davidlt commented Nov 28, 2019

I will wait until "[GIT PULL] seccomp updates for v5.5-rc1" is also merged. There is one small RISC-V patch there.

@pcmoore
Copy link
Member Author

pcmoore commented Nov 28, 2019

Thanks all. We've still got a number of things on the TODO list for the v2.5 release so I think we have some time.

@davidlt
Copy link

davidlt commented Dec 17, 2019

Quick update. I started updating Fedora/RISCV to 5.5-rc2 and there is a number of issues. I might have found one issue created by SECCOMP in kernel and working on fixing that first. This issues wasn't showed by libseccomp test suite or kernel seccomp self tests.

@pcmoore
Copy link
Member Author

pcmoore commented Dec 17, 2019

Thanks for the update. FWIW, the libseccomp tests don't aggressively test the kernel, they are focused more on the library side (running code through a BPF simulator).

@pcmoore
Copy link
Member Author

pcmoore commented Feb 24, 2020

This should be resolved via #197, closing.

@pcmoore pcmoore closed this as completed Feb 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

No branches or pull requests

7 participants