seccomp / libseccomp

The main libseccomp repository
GNU Lesser General Public License v2.1
791 stars 170 forks source link

RFE: Add Motorola 68000 support #397

Closed glaubitz closed 1 year ago

glaubitz commented 1 year ago

This pull request adds support for the Motorola 68000 architecture to libseccomp.

Patches for seccomp support in the kernel have been posted on the LKML [1] but not merged yet. Plus, libseccomp currently fails to build from source after the syscall.csv file has been updated to include the syscalls for m68k. The problem seem to be a number of syscalls which exist exclusively on m68k.

For this reason, I'm marking this pull request as WIP.

[1] https://marc.info/?l=linux-m68k&m=167349572928947&w=2

coveralls commented 1 year ago

Coverage Status

Coverage: 89.738% (+0.01%) from 89.724% when pulling a23ea38e5d63d38afa7d7864bc1d4234f94845f9 on glaubitz:m68k into 5aceb9d68a14e055c7a702483d612b537244e276 on seccomp:main.

glaubitz commented 1 year ago

I had to add to add the three syscalls atomic_barrier, atomic_cmpxchg_32 and getpagesize to include/seccomp-syscalls.h. Testsuite passes now.

drakenclimber commented 1 year ago

Thanks so much for the pull request, @glaubitz. Let us know when m68k support has been merged into the kernel, and I'll take a deeper look. :+1:

pcmoore commented 1 year ago

Hi @glaubitz, a quick question for you: are there any modern, common Linux distros which support m68k?

glaubitz commented 1 year ago

On Feb 6, 2023, at 11:36 PM, Paul Moore @.***> wrote: Hi @glaubitz, a quick question for you: are there any modern, common Linux distros which support m68k? Yes, Debian and Gentoo.The port is very actively maintained and has a vibrant hobbyist around it with even new hardware being developed such as the Pi-Storm and Apollo accelerator cards for the Amiga.

pcmoore commented 1 year ago

Great, thanks!

glaubitz commented 1 year ago

seccomp support for m68k was just merged today into Linus' tree:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/arch/m68k?id=6baaade15594b28195da369962208b1f658e7342

drakenclimber commented 1 year ago

@glaubitz, looks like we can now review these changes and start to work on getting them into libseccomp. Correct?

If so, would you mind updating your patchset to resolve the conflicts. (m86k collided with LoongArch, but the collisions look fairly trivial.) Once you do that, I'll look over the code. Thanks so much!

glaubitz commented 1 year ago

@glaubitz, looks like we can now review these changes and start to work on getting them into libseccomp. Correct?

Yes.

If so, would you mind updating your patchset to resolve the conflicts. (m86k collided with LoongArch, but the collisions look fairly trivial.) Once you do that, I'll look over the code. Thanks so much!

Rebase should be done now.

glaubitz commented 1 year ago

On Mar 31, 2023, at 9:52 PM, Paul Moore @.***> wrote: @pcmoore requested changes on this pull request.

In include/seccomp-syscalls.h:

@@ -824,6 +839,12 @@

define __SNR_getitimer __NR_getitimer

+#ifdef NR_atomic_getpagesize +#define SNR_getpagesize NR_getpagesize +#else +#define __SNR_getpagesize PNR_getpagesize

I would have expected the above code to look like this:

ifdef __NR_atomic_getpagesize

define SNR_atomic_getpagesize NR_atomic_getpagesize

else

define SNR_atomic_getpagesize PNR_atomic_getpagesize

... is this a typo or is there some m68k cleverness going on here? It’s a typo. Will fix that in a bit. Thanks a lot for catching this.

glaubitz commented 1 year ago

Linux 6.3 which includes seccomp support for m68k was just released today ;-).

drakenclimber commented 1 year ago

Linux 6.3 which includes seccomp support for m68k was just released today ;-).

Congrats! I have carved out time this week to review the changes. Thanks for your patience, @glaubitz

drakenclimber commented 1 year ago

Pushed to main in commits dd5c9c24e8ba and aa168d49243b. Thanks, @glaubitz