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

Add support for RISC-V 32-bit & 64-bit (riscv32, riscv64) #73

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

davidlt
Copy link

@davidlt davidlt commented Oct 29, 2018

The testing was done only on riscv64 using Fedora 29 w/ kernel 4.19.0-rc8.
To my knowledge there are no Linux distributions planning to support riscv32.
Note, there is no COMPAT support, i.e., riscv32 applications cannot run
on riscv64 host.

The following was checked:

  • auditctl (checked several different example rules from internet)
  • aulast
  • aulastlog
  • ausearch
  • ausyscall
  • aureport
  • autrace (compared some syscalls to strace: order and return value/input
    arguments seem to be correct)

I looked at audit-testsuite and modified it for riscv64.
See: https://github.com/davidlt/audit-testsuite/tree/riscv64

The current results would be:

Failed 4/14 test programs. 19/88 subtests failed.

Failures:

  • syscall_socketcall: that's an old stuff and not relevant to new arches;
  • syscall_module: Fedora kernel is not compiled with kernel loadable module
    support;
  • filter_exclude: 2 tests fail because 'id -Z' doesn't print any categories,
    but 'semanage login -l' output is identical between x86_64 and riscv64;
  • netfilter_pkt: Fedora don't have CONFIG_IP_NF_MANGLE enabled.

Fedora kernel currently has minimal CONFIG_* options enabled and is built
without loadable module support.

I hope to send the kernel patches later today.

Signed-off-by: David Abdurachmanov [email protected]

@davidlt
Copy link
Author

davidlt commented Oct 29, 2018

_S(241, "perf_event_open")
_S(242, "accept4")
_S(243, "recvmmsg")
_S(259, "sys_riscv_flush_icache")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a bug, need to remove sys_ prefix.

_S(291, "statx")
_S(292, "io_pgetevents")
_S(293, "rseq")
_S(294, "syscalls")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also shouldn't be here.

@stevegrubb
Copy link
Contributor

Hello,

I just wanted to leave a note and not leave this hanging. I have not pulled this in because I am not sure about maintaining another table. I pulled in alpha a long time ago and they disappeared never to be seen again. I think I am going to deprecate that table as well as IA64 to reduce the maintenance burden. Aside from that, I don't think there is anything technically wrong with the patch.

@davidlt
Copy link
Author

davidlt commented Jun 18, 2019

This has been included in Fedora/RISCV for some months now and it works without a flaw (as far as I used it). So far everything worked as expected. There is one thing I would remove -- riscv32 support. So RISC-V 32-bit support is being dragged a bit in glibc and thus syscall table is changing compared to riscv64. There are a few changes already and more coming (related to year 2038 problem).

The plan was/is to get RISC-V 32-bit ABI finalized in the next glibc release, but I am not sure if that will happen.

@davidlt
Copy link
Author

davidlt commented Nov 13, 2019

Is there a way we could move forward and add RISC-V support? I would love to have RISC-V support in a release sooner than later as that's easier to distributions to pick up. There are a number of Linux distributions already supporting riscv64 (Fedora, Debian, OpenSUSE, OpenEmbedded, Gentoo, etc).

@davidlt
Copy link
Author

davidlt commented Jan 23, 2020

Ping. I would like to know how to move forward here.

feckert referenced this pull request in openwrt/packages Apr 21, 2021
Signed-off-by: Thomas Petazzoni <[email protected]>
[strip library after adding it to openwrt repository]
Signed-off-by: W. Michael Petullo <[email protected]>
@stevegrubb
Copy link
Contributor

stevegrubb commented Apr 24, 2021

I am reluctant to add more architectures to audit user space. The main reason is it takes a lot of time updating the syscall tables and no one really helps. I got stuck taking care of the Alpha processor and IA64 after a promise of help and then they disappeared. If there were more contributors to the audit subsystem, it might be another story.

@thesamesam
Copy link

Might be worth borrowing some of the infrastructure from systemd which has some scripts to do this.

@menmazqj
Copy link

menmazqj commented Apr 2, 2024

I am reluctant to add more architectures to audit user space. The main reason is it takes a lot of time updating the syscall tables and no one really helps. I got stuck taking care of the Alpha processor and IA64 after a promise of help and then they disappeared. If there were more contributors to the audit subsystem, it might be another story.

Hi, @stevegrubb. This is 2024! Thanks for your work. We have a couple people working on RISCV stuff, like building the RISCV ecosystem. I'm curious why this PR hasn't been merged. Do we need to move this work forward?

@davidlt
Copy link
Author

davidlt commented Apr 2, 2024

I plan to update the patch based on v6.8 or/and v6.9 in near time. I have not been pushing newer versions of this PR. This is probably the largest non-upstream patch we have in Fedora/RISCV for longest now.

@menmazqj
Copy link

menmazqj commented Apr 2, 2024

I checked the historical PRs and ultimately understood why new architectures were not introduced in this repo. I think we should move the arch support patches to the places needed. Thanks again for @stevegrubb and @davidlt .

See more information on the previous attempt to upstream:
linux-audit@549b0fd

The major difference is updated syscalls headers for riscv32 and riscv64
using system-syscalls Python package.

The kernel version used was 6.10.0-rc6.

Signed-off-by: David Abdurachmanov <[email protected]>
@andreabolognani
Copy link

@davidlt now that we have GA 6.11 in Fedora, would it make sense to rebase and pick up the changes?

I also wonder if dropping riscv32 and limiting support to riscv64, the only architecture which distros shipping audit will realistically ever target, might make the changeset slightly more palatable to the maintainers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants