semaphore syscalls - refresh
PATCH 1/1 semaphore syscalls - refresh
This is a refresh of a prior patch to fix the semaphore system calls sem*() in user-linux mode. Some additional cases have been dealt with, and a small amount of code re-arrainging to prepare for the EFAULT patch. Tested using Linux Test Project in the target.
Stuart
Stuart R. Anderson [email protected] Network & Software Engineering http://www.netsweng.com/ 1024D/37A79149: 0791 D3B8 9A4C 2CDC A31F BD03 0A62 E534 37A7 9149
linux-user/i386/syscall.h +0 -76
@@ -142,80 +142,4 @@struct target_vm86plus_info_struct vm86plus; }; -/* ipcs */ - -#define TARGET_SEMOP 1 -#define TARGET_SEMGET 2 -#define TARGET_SEMCTL 3 -#define TARGET_MSGSND 11 -#define TARGET_MSGRCV 12 -#define TARGET_MSGGET 13 -#define TARGET_MSGCTL 14 -#define TARGET_SHMAT 21 -#define TARGET_SHMDT 22 -#define TARGET_SHMGET 23 -#define TARGET_SHMCTL 24 - -struct target_msgbuf { -int mtype; -char mtext[1 ]; -}; - -struct target_ipc_kludge { -unsigned int msgp;/* Really (struct msgbuf *) */ -int msgtyp; -}; - -struct target_ipc_perm { -int key; -unsigned short uid; -unsigned short gid; -unsigned short cuid; -unsigned short cgid; -unsigned short mode; -unsigned short seq; -}; - -struct target_msqid_ds { -struct target_ipc_perm msg_perm; -unsigned int msg_first;/* really struct target_msg* */ -unsigned int msg_last;/* really struct target_msg* */ -unsigned int msg_stime;/* really target_time_t */ -unsigned int msg_rtime;/* really target_time_t */ -unsigned int msg_ctime;/* really target_time_t */ -unsigned int wwait;/* really struct wait_queue* */ -unsigned int rwait;/* really struct wait_queue* */ -unsigned short msg_cbytes; -unsigned short msg_qnum; -unsigned short msg_qbytes; -unsigned short msg_lspid; -unsigned short msg_lrpid; -}; - -struct target_shmid_ds { -struct target_ipc_perm shm_perm; -int shm_segsz; -unsigned int shm_atime;/* really target_time_t */ -unsigned int shm_dtime;/* really target_time_t */ -unsigned int shm_ctime;/* really target_time_t */ -unsigned short shm_cpid; -unsigned short shm_lpid; -short shm_nattch; -unsigned short shm_npages; -unsigned long *shm_pages; -void *attaches;/* really struct shm_desc * */ -}; - -#define TARGET_IPC_RMID 0 -#define TARGET_IPC_SET 1 -#define TARGET_IPC_STAT 2 - -union target_semun { -int val; -unsigned int buf;/* really struct semid_ds * */ -unsigned int array;/* really unsigned short * */ -unsigned int __buf;/* really struct seminfo * */ -unsigned int __pad;/* really void* */ -}; -#define UNAME_MACHINE "i686"
linux-user/ppc/syscall.h +0 -76
80 lines not on this page · raw message
linux-user/syscall.c +195 -3
215 lines not on this page · raw message
Quoted 5 lines · Stuart Anderson
This is a refresh of a prior patch to fix the semaphore system calls sem*() in user-linux mode. Some additional cases have been dealt with, and a small amount of code re-arrainging to prepare for the EFAULT patch. Tested using Linux Test Project in the target.
[snip]
Quoted 7 lines
linux-user/syscall.c +7
-0+static inline void target_to_host_semun (unsigned long cmd, +union semun *host_su, +target_ulong target_addr, +struct semid_ds *ds) +{ +union target_semun *target_su; +
linux-user/syscall.c line 1241
Quoted 10 lines
linux-user/syscall.c +10
-0+switch ( cmd ) { +case GETALL : +case SETALL : +case IPC_STAT : +case IPC_SET : +lock_user_struct (target_su, target_addr,1 ); +target_to_host_semid_ds (ds,target_su->buf); + host_su->buf = ds; +unlock_user_struct (target_su, target_addr,0 ); +break ;
I don't see how this can work with target_su being an uninitialized pointer.
Thiemo
Quoted 4 lines · Thiemo Seufer
Quoted 4 lines
linux-user/syscall.c +4
-0+switch ( cmd ) { +case GETALL : +case SETALL : +case IPC_STAT :
Quoted 8 lines
linux-user/syscall.c line 1241
Quoted 6 lines
linux-user/syscall.c +6
-0+case IPC_SET : +lock_user_struct (target_su, target_addr,1 ); +target_to_host_semid_ds (ds,target_su->buf); + host_su->buf = ds; +unlock_user_struct (target_su, target_addr,0 ); +break ;I don't see how this can work with
target_subeing an uninitialized pointer.
#define lock_user_struct(host_ptr, guest_addr, copy) \
host_ptr = lock_user(guest_addr, sizeof(*host_ptr), copy)
target_su is the left hand side of the assignment. The macro just hides it.
Stuart
Stuart R. Anderson [email protected] Network & Software Engineering http://www.netsweng.com/ 1024D/37A79149: 0791 D3B8 9A4C 2CDC A31F BD03 0A62 E534 37A7 9149
Thiemo,
Just wondering if you had a chance to take another look at
this.
Quoted 27 lines · Stuart Anderson
Quoted 4 lines · Thiemo Seufer
Quoted 4 lines
linux-user/syscall.c +4
-0+switch ( cmd ) { +case GETALL : +case SETALL : +case IPC_STAT :Quoted 8 lines
linux-user/syscall.c line 1241
Quoted 6 lines
linux-user/syscall.c +6
-0+case IPC_SET : +lock_user_struct (target_su, target_addr,1 ); +target_to_host_semid_ds (ds,target_su->buf); + host_su->buf = ds; +unlock_user_struct (target_su, target_addr,0 ); +break ;I don't see how this can work with
target_subeing an uninitialized pointer.#define
lock_user_struct(host_ptr, guest_addr, copy)\
host_ptr=lock_user(guest_addr, sizeof(*host_ptr), copy)
target_suis the left hand side of the assignment. The macro just hides it.Stuart
Stuart R. Anderson [email protected] Network & Software Engineering http://www.netsweng.com/ 1024D/37A79149: 0791 D3B8 9A4C 2CDC A31F BD03 0A62 E534 37A7 9149