Source: rust-libseccomp
Version: 0.3.0-9
Severity: wishlist
Tags: patch FTBFS
User: debian-loonga...@lists.debian.org
Usertags: loong64
Dear maintainers,
Compiling the rust-libseccomp failed for loong64 in the Debian Package
Auto-Building environment.
I have added loongarch64 support for rust-libseccomp.
When I built rust-libseccomp, I found that rust-libseccomp depends
rust-libseccomp-sys(lacks loongarch64 support).
So, I have submitted bug and
patch(https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1088333) for
rust-libseccomp-sys and built rust-libseccomp-sys in local ENV.
Based on rust-libseccomp-sys(add loongarch64 support and then build
binary package), I added loongarch64 patch to rust-libseccomp.
The successfully build result of rust-libseccomp is as follows,
```
test test_scmparch_native ... ok
test test_set_api ... ok
test test_rule_add_load ... ok
test test_set_syscall_priority ... ok
test test_syscall_eq_i32 ... ok
test test_syscall_i32 ... ok
test result: ok. 21 passed; 0 failed; 0 ignored; 0 measured; 0 filtered
out; finished in 0.00s
librust-bitflags-1-dev:loong64 1.3.2-6 0
librust-libc-dev:loong64 0.2.161-1 0
librust-libseccomp-sys-dev:loong64 0.2.1-1+loong64 0
rustc 1.82.0+dfsg1-2 1
make[1]: Leaving directory
'/home/11.25/rust-libseccomp/again/rust-libseccomp-0.3.0'
......
dh_builddeb -O--buildsystem=cargo
dpkg-deb: building package 'librust-libseccomp-dev' in
'../librust-libseccomp-dev_0.3.0-9+loong64_loong64.deb'.
dpkg-genbuildinfo -O../rust-libseccomp_0.3.0-9+loong64_loong64.buildinfo
dpkg-genchanges -O../rust-libseccomp_0.3.0-9+loong64_loong64.changes
```
In summary, I have added loongarch64 support in rust-libseccomp source
package. And built successfully on my local ENV.
Please consider the patch I attached.
If you have any questions, you can contact me at any time.
Note that before building rust-libseccomp for loong64, should add
loongarch64 support for rust-libseccomp-sys(bug: 1088333) firstly.
thanks,
Dandan Zhang
Description: Add loongarch64 support
.
rust-libseccomp (0.3.0-9+loong64) unreleased; urgency=medium
.
* Add loongarch64 support.
Author: Dandan Zhang <zhangdan...@loongson.cn>
---
The information above should follow the Patch Tagging Guidelines, please
checkout https://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:
Origin: (upstream|backport|vendor|other), (<patch-url>|commit:<commit-id>)
Bug: <upstream-bugtracker-url>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: (no|not-needed|<patch-forwarded-url>)
Applied-Upstream: <version>, (<commit-url>|commit:<commid-id>)
Reviewed-By: <name and email of someone who approved/reviewed the patch>
Last-Update: 2024-11-27
--- rust-libseccomp-0.3.0.orig/src/api.rs
+++ rust-libseccomp-0.3.0/src/api.rs
@@ -129,7 +129,7 @@ mod tests {
use super::*;
#[test]
- #[cfg(not(target_arch = "loong64"))]
+ #[cfg(not(target_arch = "loongarch64"))]
fn test_ensure_supported_api() {
assert!(ensure_supported_api("test", 3, ScmpVersion::from((2, 4, 0))).is_ok());
assert!(ensure_supported_api("test", 100, ScmpVersion::from((2, 4, 0))).is_err());
--- rust-libseccomp-0.3.0.orig/src/arch.rs
+++ rust-libseccomp-0.3.0/src/arch.rs
@@ -25,6 +25,8 @@ pub enum ScmpArch {
Arm,
/// The AARCH64 architecture token
Aarch64,
+ /// The LOONGARCH64 architecture token
+ Loongarch64,
/// The MIPS architecture token
Mips,
/// The MIPS (64-bit) architecture token
@@ -64,6 +66,7 @@ impl ScmpArch {
Self::X32 => SCMP_ARCH_X32,
Self::Arm => SCMP_ARCH_ARM,
Self::Aarch64 => SCMP_ARCH_AARCH64,
+ Self::Loongarch64 => SCMP_ARCH_LOONGARCH64,
Self::Mips => SCMP_ARCH_MIPS,
Self::Mips64 => SCMP_ARCH_MIPS64,
Self::Mips64N32 => SCMP_ARCH_MIPS64N32,
@@ -89,6 +92,7 @@ impl ScmpArch {
SCMP_ARCH_X32 => Ok(Self::X32),
SCMP_ARCH_ARM => Ok(Self::Arm),
SCMP_ARCH_AARCH64 => Ok(Self::Aarch64),
+ SCMP_ARCH_LOONGARCH64 => Ok(Self::Loongarch64),
SCMP_ARCH_MIPS => Ok(Self::Mips),
SCMP_ARCH_MIPS64 => Ok(Self::Mips64),
SCMP_ARCH_MIPS64N32 => Ok(Self::Mips64N32),
@@ -144,6 +148,7 @@ impl FromStr for ScmpArch {
"SCMP_ARCH_X32" => Ok(Self::X32),
"SCMP_ARCH_ARM" => Ok(Self::Arm),
"SCMP_ARCH_AARCH64" => Ok(Self::Aarch64),
+ "SCMP_ARCH_LOONGARCH64" => Ok(Self::Loongarch64),
"SCMP_ARCH_MIPS" => Ok(Self::Mips),
"SCMP_ARCH_MIPS64" => Ok(Self::Mips64),
"SCMP_ARCH_MIPS64N32" => Ok(Self::Mips64N32),
@@ -176,6 +181,7 @@ mod tests {
("SCMP_ARCH_X32", ScmpArch::X32),
("SCMP_ARCH_ARM", ScmpArch::Arm),
("SCMP_ARCH_AARCH64", ScmpArch::Aarch64),
+ ("SCMP_ARCH_LOONGARCH64", ScmpArch::Loongarch64),
("SCMP_ARCH_MIPS", ScmpArch::Mips),
("SCMP_ARCH_MIPS64", ScmpArch::Mips64),
("SCMP_ARCH_MIPS64N32", ScmpArch::Mips64N32),
--- rust-libseccomp-0.3.0.orig/src/syscall.rs
+++ rust-libseccomp-0.3.0/src/syscall.rs
@@ -20,6 +20,9 @@ cfg_if::cfg_if! {
} else if #[cfg(target_arch = "arm")] {
mod arm;
use arm::SYSCALLS;
+ } else if #[cfg(target_arch = "loongarch64")] {
+ mod loongarch64;
+ use loongarch64::SYSCALLS;
} else if #[cfg(target_arch = "mips")] {
mod mips;
use mips::SYSCALLS;
--- /dev/null
+++ rust-libseccomp-0.3.0/src/syscall/loongarch64.rs
@@ -0,0 +1,253 @@
+// SPDX-License-Identifier: Apache-2.0 or MIT
+//
+
+pub const SYSCALLS: &[(&str, i32)] = &[
+ ("socket", -101),
+ ("bind", -102),
+ ("connect", -103),
+ ("listen", -104),
+ ("accept", -105),
+ ("getsockname", -106),
+ ("getpeername", -107),
+ ("socketpair", -108),
+ ("send", -109),
+ ("recv", -110),
+ ("sendto", -111),
+ ("recvfrom", -112),
+ ("shutdown", -113),
+ ("setsockopt", -114),
+ ("getsockopt", -115),
+ ("sendmsg", -116),
+ ("recvmsg", -117),
+ ("accept4", -118),
+ ("recvmmsg", -119),
+ ("sendmmsg", -120),
+ ("semop", -201),
+ ("semget", -202),
+ ("semctl", -203),
+ ("semtimedop", -204),
+ ("msgsnd", -211),
+ ("msgrcv", -212),
+ ("msgget", -213),
+ ("msgctl", -214),
+ ("shmat", -221),
+ ("shmdt", -222),
+ ("shmget", -223),
+ ("shmctl", -224),
+ ("arch_prctl", -10001),
+ ("bdflush", -10002),
+ ("break", -10003),
+ ("chown32", -10004),
+ ("epoll_ctl_old", -10005),
+ ("epoll_wait_old", -10006),
+ ("fadvise64_64", -10007),
+ ("fchown32", -10008),
+ ("fcntl64", -10009),
+ ("fstat64", -10010),
+ ("fstatat64", -10011),
+ ("fstatfs64", -10012),
+ ("ftime", -10013),
+ ("ftruncate64", -10014),
+ ("getegid32", -10015),
+ ("geteuid32", -10016),
+ ("getgid32", -10017),
+ ("getgroups32", -10018),
+ ("getresgid32", -10019),
+ ("getresuid32", -10020),
+ ("getuid32", -10021),
+ ("gtty", -10022),
+ ("idle", -10023),
+ ("ipc", -10024),
+ ("lchown32", -10025),
+ ("_llseek", -10026),
+ ("lock", -10027),
+ ("lstat64", -10028),
+ ("mmap2", -10029),
+ ("mpx", -10030),
+ ("newfstatat", -10031),
+ ("_newselect", -10032),
+ ("nice", -10033),
+ ("oldfstat", -10034),
+ ("oldlstat", -10035),
+ ("oldolduname", -10036),
+ ("oldstat", -10037),
+ ("olduname", -10038),
+ ("prof", -10039),
+ ("profil", -10040),
+ ("readdir", -10041),
+ ("security", -10042),
+ ("sendfile64", -10043),
+ ("setfsgid32", -10044),
+ ("setfsuid32", -10045),
+ ("setgid32", -10046),
+ ("setgroups32", -10047),
+ ("setregid32", -10048),
+ ("setresgid32", -10049),
+ ("setresuid32", -10050),
+ ("setreuid32", -10051),
+ ("setuid32", -10052),
+ ("sgetmask", -10053),
+ ("sigaction", -10054),
+ ("signal", -10055),
+ ("sigpending", -10056),
+ ("sigprocmask", -10057),
+ ("sigreturn", -10058),
+ ("sigsuspend", -10059),
+ ("socketcall", -10060),
+ ("ssetmask", -10061),
+ ("stat64", -10062),
+ ("statfs64", -10063),
+ ("stime", -10064),
+ ("stty", -10065),
+ ("truncate64", -10066),
+ ("tuxcall", -10067),
+ ("ugetrlimit", -10068),
+ ("ulimit", -10069),
+ ("umount", -10070),
+ ("vm86", -10071),
+ ("vm86old", -10072),
+ ("waitpid", -10073),
+ ("create_module", -10074),
+ ("get_kernel_syms", -10075),
+ ("get_thread_area", -10076),
+ ("nfsservctl", -10077),
+ ("query_module", -10078),
+ ("set_thread_area", -10079),
+ ("_sysctl", -10080),
+ ("uselib", -10081),
+ ("vserver", -10082),
+ ("arm_fadvise64_64", -10083),
+ ("arm_sync_file_range", -10084),
+ ("pciconfig_iobase", -10086),
+ ("pciconfig_read", -10087),
+ ("pciconfig_write", -10088),
+ ("sync_file_range2", -10089),
+ ("syscall", -10090),
+ ("afs_syscall", -10091),
+ ("fadvise64", -10092),
+ ("getpmsg", -10093),
+ ("ioperm", -10094),
+ ("iopl", -10095),
+ ("migrate_pages", -10097),
+ ("modify_ldt", -10098),
+ ("putpmsg", -10099),
+ ("sync_file_range", -10100),
+ ("select", -10101),
+ ("vfork", -10102),
+ ("cachectl", -10103),
+ ("cacheflush", -10104),
+ ("sysmips", -10106),
+ ("timerfd", -10107),
+ ("time", -10108),
+ ("getrandom", -10109),
+ ("memfd_create", -10110),
+ ("kexec_file_load", -10111),
+ ("sysfs", -10145),
+ ("oldwait4", -10146),
+ ("access", -10147),
+ ("alarm", -10148),
+ ("chmod", -10149),
+ ("chown", -10150),
+ ("creat", -10151),
+ ("dup2", -10152),
+ ("epoll_create", -10153),
+ ("epoll_wait", -10154),
+ ("eventfd", -10155),
+ ("fork", -10156),
+ ("futimesat", -10157),
+ ("getdents", -10158),
+ ("getpgrp", -10159),
+ ("inotify_init", -10160),
+ ("lchown", -10161),
+ ("link", -10162),
+ ("lstat", -10163),
+ ("mkdir", -10164),
+ ("mknod", -10165),
+ ("open", -10166),
+ ("pause", -10167),
+ ("pipe", -10168),
+ ("poll", -10169),
+ ("readlink", -10170),
+ ("rename", -10171),
+ ("rmdir", -10172),
+ ("signalfd", -10173),
+ ("stat", -10174),
+ ("symlink", -10175),
+ ("unlink", -10176),
+ ("ustat", -10177),
+ ("utime", -10178),
+ ("utimes", -10179),
+ ("getrlimit", -10180),
+ ("mmap", -10181),
+ ("breakpoint", -10182),
+ ("set_tls", -10183),
+ ("usr26", -10184),
+ ("usr32", -10185),
+ ("multiplexer", -10186),
+ ("rtas", -10187),
+ ("spu_create", -10188),
+ ("spu_run", -10189),
+ ("swapcontext", -10190),
+ ("sys_debug_setcontext", -10191),
+ ("switch_endian", -10191),
+ ("get_mempolicy", -10192),
+ ("move_pages", -10193),
+ ("mbind", -10194),
+ ("set_mempolicy", -10195),
+ ("s390_runtime_instr", -10196),
+ ("s390_pci_mmio_read", -10197),
+ ("s390_pci_mmio_write", -10198),
+ ("membarrier", -10199),
+ ("userfaultfd", -10200),
+ ("pkey_mprotect", -10201),
+ ("pkey_alloc", -10202),
+ ("pkey_free", -10203),
+ ("get_tls", -10204),
+ ("s390_guarded_storage", -10205),
+ ("s390_sthyi", -10206),
+ ("subpage_prot", -10207),
+ ("statx", -10208),
+ ("io_pgetevents", -10209),
+ ("rseq", -10210),
+ ("setrlimit", -10211),
+ ("clock_adjtime64", -10212),
+ ("clock_getres_time64", -10213),
+ ("clock_gettime64", -10214),
+ ("clock_nanosleep_time64", -10215),
+ ("clock_settime64", -10216),
+ ("clone3", -10217),
+ ("fsconfig", -10218),
+ ("fsmount", -10219),
+ ("fsopen", -10220),
+ ("fspick", -10221),
+ ("futex_time64", -10222),
+ ("io_pgetevents_time64", -10223),
+ ("move_mount", -10224),
+ ("mq_timedreceive_time64", -10225),
+ ("mq_timedsend_time64", -10226),
+ ("open_tree", -10227),
+ ("pidfd_open", -10228),
+ ("pidfd_send_signal", -10229),
+ ("ppoll_time64", -10230),
+ ("pselect6_time64", -10231),
+ ("recvmmsg_time64", -10232),
+ ("rt_sigtimedwait_time64", -10233),
+ ("sched_rr_get_interval_time64", -10234),
+ ("semtimedop_time64", -10235),
+ ("timer_gettime64", -10236),
+ ("timer_settime64", -10237),
+ ("timerfd_gettime64", -10238),
+ ("timerfd_settime64", -10239),
+ ("utimensat_time64", -10240),
+ ("ppoll", -10241),
+ ("renameat", -10242),
+ ("riscv_flush_icache", -10243),
+ ("memfd_secret", -10244),
+ ("map_shadow_stack", -10245),
+ ("fstat", -10246),
+ ("atomic_barrier", -10247),
+ ("atomic_cmpxchg_32", -10248),
+ ("getpagesize", -10249),
+ ("riscv_hwprobe", -10250),
+ ("uretprobe", -10251),
+];