Skip to content

Commit

Permalink
[LibOS] Remove *sysv* stuff
Browse files Browse the repository at this point in the history
It was mostly broken and needed a rewrite, but it also blocked changes
in other parts of IPC code. It was used only by apache (semaphores)
testing of which was temporarily disabled (on CI) until we rewrite SYSV
things.

Signed-off-by: Borys Popławski <borysp@invisiblethingslab.com>
  • Loading branch information
boryspoplawski committed Jun 8, 2021
1 parent db5a444 commit 356ae6e
Show file tree
Hide file tree
Showing 15 changed files with 23 additions and 2,547 deletions.
2 changes: 2 additions & 0 deletions .ci/lib/stage-test-direct.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ stage('test-direct') {
LOOP=1 CONCURRENCY_LIST="1 32" ../common_tools/benchmark-http.sh 127.0.0.1:8002
'''
}
/*
timeout(time: 20, unit: 'MINUTES') {
sh '''
cd Examples/apache
Expand All @@ -94,6 +95,7 @@ stage('test-direct') {
LOOP=1 CONCURRENCY_LIST="1 32" ../common_tools/benchmark-http.sh https://127.0.0.1:8443
'''
}
*/
timeout(time: 5, unit: 'MINUTES') {
sh '''
cd Examples/blender
Expand Down
2 changes: 2 additions & 0 deletions .ci/lib/stage-test-sgx.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ stage('test-sgx') {
LOOP=1 CONCURRENCY_LIST="1 32" ../common_tools/benchmark-http.sh 127.0.0.1:8002
'''
}
/*
timeout(time: 25, unit: 'MINUTES') {
sh '''
cd Examples/apache
Expand All @@ -85,6 +86,7 @@ stage('test-sgx') {
LOOP=1 CONCURRENCY_LIST="1 32" ../common_tools/benchmark-http.sh https://127.0.0.1:8443
'''
}
*/
timeout(time: 5, unit: 'MINUTES') {
sh '''
cd Examples/blender
Expand Down
51 changes: 0 additions & 51 deletions LibOS/shim/include/shim_handle.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "list.h"
#include "pal.h"
#include "shim_defs.h"
#include "shim_sysv.h"
#include "shim_types.h"

/* Handle types. Many of these are used by a single filesystem. */
Expand All @@ -40,8 +39,6 @@ enum shim_handle_type {
TYPE_SOCK, /* sockets, used by `socket` filesystem */

/* Special handles: */
TYPE_SEM, /* System V semaphores, see `shim_semget.c` */
TYPE_MSG, /* System V messages, see `shim_msgget.c` */
TYPE_EPOLL, /* epoll handles, see `shim_epoll.c` */
TYPE_EVENTFD, /* eventfd handles, used by `eventfd` filesystem */
};
Expand Down Expand Up @@ -203,52 +200,6 @@ struct shim_dir_handle {
size_t pos;
};

struct msg_type;
struct msg_item;
struct msg_client;

#define MAX_SYSV_CLIENTS 32

DEFINE_LIST(shim_msg_handle);
struct shim_msg_handle {
unsigned long msqkey; /* msg queue key from user */
IDTYPE msqid; /* msg queue identifier */
bool owned; /* owned by current process */
int perm; /* access permissions */
bool deleted; /* marking the queue deleted */
int nmsgs; /* number of msgs */
int currentsize; /* current size in bytes */
struct msg_qobj* queue;
int queuesize;
int queueused;
struct msg_qobj* freed;
PAL_HANDLE event; /* event for waiting */
int ntypes;
int maxtypes;
struct msg_type* types;
LIST_TYPE(shim_msg_handle) key_hlist;
LIST_TYPE(shim_msg_handle) qid_hlist;
};

struct sem_objs;

DEFINE_LIST(shim_sem_handle);
struct shim_sem_handle {
unsigned long semkey;
IDTYPE semid;
bool owned;
int perm;
bool deleted;
PAL_HANDLE event;
int nsems;
struct sem_obj* sems;
int nreqs;
LISTP_TYPE(sem_ops) migrated;
LIST_TYPE(shim_sem_handle) list;
LIST_TYPE(shim_sem_handle) key_hlist;
LIST_TYPE(shim_sem_handle) sid_hlist;
};

struct shim_str_data {
REFTYPE ref_count;
char* str;
Expand Down Expand Up @@ -332,8 +283,6 @@ struct shim_handle {
struct shim_pipe_handle pipe; /* TYPE_PIPE */
struct shim_sock_handle sock; /* TYPE_SOCK */

struct shim_sem_handle sem; /* TYPE_SEM */
struct shim_msg_handle msg; /* TYPE_MSG */
struct shim_epoll_handle epoll; /* TYPE_EPOLL */
/* (no data) */ /* TYPE_EVENTFD */
} info;
Expand Down
107 changes: 0 additions & 107 deletions LibOS/shim/include/shim_ipc.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "shim_defs.h"
#include "shim_handle.h"
#include "shim_internal.h"
#include "shim_sysv.h"
#include "shim_thread.h"
#include "shim_types.h"

Expand All @@ -21,8 +20,6 @@

#define RANGE_SIZE 32

#define IPC_SEM_NOTIMEOUT ((unsigned long)-1)

enum {
IPC_MSG_RESP = 0,
IPC_MSG_CONNBACK, /*!< Request for establishing a connection to the sender. */
Expand All @@ -39,23 +36,13 @@ enum {
IPC_MSG_PID_RETSTATUS,
IPC_MSG_PID_GETMETA,
IPC_MSG_PID_RETMETA,
IPC_MSG_SYSV_FINDKEY,
IPC_MSG_SYSV_TELLKEY,
IPC_MSG_SYSV_DELRES,
IPC_MSG_SYSV_MSGSND,
IPC_MSG_SYSV_MSGRCV,
IPC_MSG_SYSV_SEMOP,
IPC_MSG_SYSV_SEMCTL,
IPC_MSG_SYSV_SEMRET,
IPC_MSG_CODE_BOUND,
};

enum kill_type { KILL_THREAD, KILL_PROCESS, KILL_PGROUP, KILL_ALL };

enum pid_meta_code { PID_META_CRED, PID_META_EXEC, PID_META_CWD, PID_META_ROOT };

enum sysv_type { SYSV_NONE, SYSV_MSGQ, SYSV_SEM, SYSV_SHM };

struct shim_ipc_ids {
IDTYPE parent_vmid;
IDTYPE leader_vmid;
Expand All @@ -67,7 +54,6 @@ extern struct shim_ipc_ids g_process_ipc_ids;
int init_ipc(void);
int init_ns_ranges(void);
int init_ns_pid(void);
int init_ns_sysv(void);

/*!
* \brief Initialize the IPC worker thread
Expand Down Expand Up @@ -116,8 +102,6 @@ struct shim_ipc_msg {
/*
* XXX: Currently required by:
* - `msg_add_range` in `LibOS/shim/src/ipc/shim_ipc_ranges.c`,
* - `msgsnd_callback` in `LibOS/shim/src/ipc/shim_ipc_sysv.c`,
* - `semret_callback` in `LibOS/shim/src/ipc/shim_ipc_sysv.c`.
*/
static_assert(offsetof(struct shim_ipc_msg, data) % 8 == 0, "Currently proper alignment is required");

Expand Down Expand Up @@ -334,95 +318,4 @@ int ipc_pid_retmeta_send(IDTYPE dest, IDTYPE pid, enum pid_meta_code code, const
int datasize, unsigned long seq);
int ipc_pid_retmeta_callback(IDTYPE src, void* data, unsigned long seq);

/* sysv namespace */
struct sysv_key {
unsigned long key;
enum sysv_type type;
};

int sysv_add_key(struct sysv_key* key, IDTYPE id);
int sysv_get_key(struct sysv_key* key, bool delete);

/* SYSV_FINDKEY */
struct shim_ipc_sysv_findkey {
struct sysv_key key;
} __attribute__((packed));

int ipc_sysv_findkey_send(struct sysv_key* key);
int ipc_sysv_findkey_callback(IDTYPE src, void* data, unsigned long seq);

/* SYSV_TELLKEY */
struct shim_ipc_sysv_tellkey {
struct sysv_key key;
IDTYPE id;
} __attribute__((packed));

int ipc_sysv_tellkey_send(IDTYPE dest, struct sysv_key* key, IDTYPE id, unsigned long seq);
int ipc_sysv_tellkey_callback(IDTYPE src, void* data, unsigned long seq);

/* SYSV_DELRES */
struct shim_ipc_sysv_delres {
IDTYPE resid;
enum sysv_type type;
} __attribute__((packed));

int ipc_sysv_delres_send(IDTYPE dest, IDTYPE resid, enum sysv_type type);
int ipc_sysv_delres_callback(IDTYPE src, void* data, unsigned long seq);

/* SYSV_MSGSND */
struct shim_ipc_sysv_msgsnd {
IDTYPE msgid;
long msgtype;
size_t size;
char msg[];
} __attribute__((packed));

int ipc_sysv_msgsnd_send(IDTYPE dest, IDTYPE msgid, long msgtype, const void* buf, size_t size,
unsigned long seq);
int ipc_sysv_msgsnd_callback(IDTYPE src, void* data, unsigned long seq);

/* SYSV_MSGRCV */
struct shim_ipc_sysv_msgrcv {
IDTYPE msgid;
long msgtype;
size_t size;
int flags;
} __attribute__((packed));

int ipc_sysv_msgrcv_send(IDTYPE msgid, long msgtype, int flags, void* buf, size_t size);
int ipc_sysv_msgrcv_callback(IDTYPE src, void* data, unsigned long seq);

/* SYSV_SEMOP */
struct shim_ipc_sysv_semop {
IDTYPE semid;
unsigned long timeout;
int nsops;
struct sembuf sops[];
};

int ipc_sysv_semop_send(IDTYPE semid, struct sembuf* sops, int nsops, unsigned long timeout,
unsigned long* seq);
int ipc_sysv_semop_callback(IDTYPE src, void* data, unsigned long seq);

/* SYSV_SEMCTL */
struct shim_ipc_sysv_semctl {
IDTYPE semid;
int semnum;
int cmd;
size_t valsize;
unsigned char vals[];
} __attribute__((packed));

int ipc_sysv_semctl_send(IDTYPE semid, int semnum, int cmd, void* vals, size_t valsize);
int ipc_sysv_semctl_callback(IDTYPE src, void* data, unsigned long seq);

/* SYSV_SEMRET */
struct shim_ipc_sysv_semret {
size_t valsize;
unsigned char vals[];
} __attribute__((packed));

int ipc_sysv_semret_send(IDTYPE dest, void* vals, size_t valsize, unsigned long seq);
int ipc_sysv_semret_callback(IDTYPE src, void* data, unsigned long seq);

#endif /* SHIM_IPC_H_ */
130 changes: 0 additions & 130 deletions LibOS/shim/include/shim_sysv.h

This file was deleted.

Loading

0 comments on commit 356ae6e

Please sign in to comment.