summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/arch-arm.c8
-rw-r--r--src/arch-mips.c8
-rw-r--r--src/arch-mips64.c8
-rw-r--r--src/arch-mips64n32.c8
-rw-r--r--src/arch-x32.c8
5 files changed, 30 insertions, 10 deletions
diff --git a/src/arch-arm.c b/src/arch-arm.c
index 4dd4b63..9c9153a 100644
--- a/src/arch-arm.c
+++ b/src/arch-arm.c
@@ -50,8 +50,9 @@ int arm_syscall_resolve_name_munge(const char *name)
{
int sys;
+ /* NOTE: we don't want to modify the pseudo-syscall numbers */
sys = arm_syscall_resolve_name(name);
- if (sys == __NR_SCMP_ERROR)
+ if (sys == __NR_SCMP_ERROR || sys < 0)
return sys;
return (sys | __SCMP_NR_BASE);
@@ -68,7 +69,10 @@ int arm_syscall_resolve_name_munge(const char *name)
*/
const char *arm_syscall_resolve_num_munge(int num)
{
- return arm_syscall_resolve_num(num & (~__SCMP_NR_BASE));
+ /* NOTE: we don't want to modify the pseudo-syscall numbers */
+ if (num >= 0)
+ num &= ~__SCMP_NR_BASE;
+ return arm_syscall_resolve_num(num);
}
const struct arch_def arch_def_arm = {
diff --git a/src/arch-mips.c b/src/arch-mips.c
index f0e6a14..06741c7 100644
--- a/src/arch-mips.c
+++ b/src/arch-mips.c
@@ -43,8 +43,9 @@ int mips_syscall_resolve_name_munge(const char *name)
{
int sys;
+ /* NOTE: we don't want to modify the pseudo-syscall numbers */
sys = mips_syscall_resolve_name(name);
- if (sys == __NR_SCMP_ERROR)
+ if (sys == __NR_SCMP_ERROR || sys < 0)
return sys;
return sys + __SCMP_NR_BASE;
@@ -61,7 +62,10 @@ int mips_syscall_resolve_name_munge(const char *name)
*/
const char *mips_syscall_resolve_num_munge(int num)
{
- return mips_syscall_resolve_num(num - __SCMP_NR_BASE);
+ /* NOTE: we don't want to modify the pseudo-syscall numbers */
+ if (num >= __SCMP_NR_BASE)
+ num -= __SCMP_NR_BASE;
+ return mips_syscall_resolve_num(num);
}
const struct arch_def arch_def_mips = {
diff --git a/src/arch-mips64.c b/src/arch-mips64.c
index 9707d1c..342d0d8 100644
--- a/src/arch-mips64.c
+++ b/src/arch-mips64.c
@@ -41,8 +41,9 @@ int mips64_syscall_resolve_name_munge(const char *name)
{
int sys;
+ /* NOTE: we don't want to modify the pseudo-syscall numbers */
sys = mips64_syscall_resolve_name(name);
- if (sys == __NR_SCMP_ERROR)
+ if (sys == __NR_SCMP_ERROR || sys < 0)
return sys;
return sys + __SCMP_NR_BASE;
@@ -59,7 +60,10 @@ int mips64_syscall_resolve_name_munge(const char *name)
*/
const char *mips64_syscall_resolve_num_munge(int num)
{
- return mips64_syscall_resolve_num(num - __SCMP_NR_BASE);
+ /* NOTE: we don't want to modify the pseudo-syscall numbers */
+ if (num >= __SCMP_NR_BASE)
+ num -= __SCMP_NR_BASE;
+ return mips64_syscall_resolve_num(num);
}
const struct arch_def arch_def_mips64 = {
diff --git a/src/arch-mips64n32.c b/src/arch-mips64n32.c
index f8088ae..098864b 100644
--- a/src/arch-mips64n32.c
+++ b/src/arch-mips64n32.c
@@ -43,8 +43,9 @@ int mips64n32_syscall_resolve_name_munge(const char *name)
{
int sys;
+ /* NOTE: we don't want to modify the pseudo-syscall numbers */
sys = mips64n32_syscall_resolve_name(name);
- if (sys == __NR_SCMP_ERROR)
+ if (sys == __NR_SCMP_ERROR || sys < 0)
return sys;
return sys + __SCMP_NR_BASE;
@@ -61,7 +62,10 @@ int mips64n32_syscall_resolve_name_munge(const char *name)
*/
const char *mips64n32_syscall_resolve_num_munge(int num)
{
- return mips64n32_syscall_resolve_num(num - __SCMP_NR_BASE);
+ /* NOTE: we don't want to modify the pseudo-syscall numbers */
+ if (num >= __SCMP_NR_BASE)
+ num -= __SCMP_NR_BASE;
+ return mips64n32_syscall_resolve_num(num);
}
const struct arch_def arch_def_mips64n32 = {
diff --git a/src/arch-x32.c b/src/arch-x32.c
index 3890968..50c502e 100644
--- a/src/arch-x32.c
+++ b/src/arch-x32.c
@@ -39,8 +39,9 @@ int x32_syscall_resolve_name_munge(const char *name)
{
int sys;
+ /* NOTE: we don't want to modify the pseudo-syscall numbers */
sys = x32_syscall_resolve_name(name);
- if (sys == __NR_SCMP_ERROR)
+ if (sys == __NR_SCMP_ERROR || sys < 0)
return sys;
return (sys | X32_SYSCALL_BIT);
@@ -57,7 +58,10 @@ int x32_syscall_resolve_name_munge(const char *name)
*/
const char *x32_syscall_resolve_num_munge(int num)
{
- return x32_syscall_resolve_num(num & (~X32_SYSCALL_BIT));
+ /* NOTE: we don't want to modify the pseudo-syscall numbers */
+ if (num >= 0)
+ num &= ~X32_SYSCALL_BIT;
+ return x32_syscall_resolve_num(num);
}
const struct arch_def arch_def_x32 = {