From 9aff14b369550436d0ae9e872d5d4b69810d8877 Mon Sep 17 00:00:00 2001 From: Nikita Kalyazin Date: Sat, 13 Jul 2013 15:19:35 +0400 Subject: [PATCH] [FIX] incorrect syscalls feature order FIXME: actually there are 2 different entities: - internal feature number (when switching on/off a feature); - the value to be packed to the buffer. It is better to split them. --- ks_features/features_data.c | 5 ++++- ks_features/ks_features.c | 3 +-- ks_features/ks_features.h | 12 ++++++------ 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/ks_features/features_data.c b/ks_features/features_data.c index 3b072fe..7f8f4c7 100644 --- a/ks_features/features_data.c +++ b/ks_features/features_data.c @@ -11,6 +11,8 @@ enum syscall_id { }; #undef X +static enum syscall_id id_none[] = {}; + static enum syscall_id id_file[] = { id_sys_acct, id_sys_mount, @@ -232,11 +234,12 @@ static enum syscall_id id_desc[] = { } static struct feature features[] = { + CREATE_FEATURE(id_none), CREATE_FEATURE(id_file), CREATE_FEATURE(id_ipc), - CREATE_FEATURE(id_net), CREATE_FEATURE(id_process), CREATE_FEATURE(id_signal), + CREATE_FEATURE(id_net), CREATE_FEATURE(id_desc) }; diff --git a/ks_features/ks_features.c b/ks_features/ks_features.c index 734377c..50ab3e9 100644 --- a/ks_features/ks_features.c +++ b/ks_features/ks_features.c @@ -127,8 +127,7 @@ static int unregister_syscall(size_t id) static void set_spt(struct feature *f, size_t id) { - int num = f - features; - ksp[id].pst = num + 1; + ksp[id].pst = f - features; } static int install_features(struct feature *f) diff --git a/ks_features/ks_features.h b/ks_features/ks_features.h index 0de2acd..dd536e8 100644 --- a/ks_features/ks_features.h +++ b/ks_features/ks_features.h @@ -2,12 +2,12 @@ #define _KS_FEATURES_H enum feature_id { - FID_FILE, - FID_IPC, - FID_NET, - FID_PROCESS, - FID_SIGNAL, - FID_DESC + FID_FILE = 1, + FID_IPC = 2, + FID_PROCESS = 3, + FID_SIGNAL = 4, + FID_NET = 5, + FID_DESC = 6 }; int set_feature(enum feature_id id); -- 2.7.4