diff options
author | Robert Nagy <robert@cvs.openbsd.org> | 2011-11-25 10:10:06 +0000 |
---|---|---|
committer | Robert Nagy <robert@cvs.openbsd.org> | 2011-11-25 10:10:06 +0000 |
commit | 640c0238a97ef9fda5670016f75ea096dbf1b849 (patch) | |
tree | e066331b9ed59788526bd5d56c18ca4755398928 /sys/compat | |
parent | 9bebd2307da31c6e9bb5a94af6180035be7dd61f (diff) |
implement chown(2) in compat_linux which is needed by some antivirus software
ok pirofti@
Diffstat (limited to 'sys/compat')
-rw-r--r-- | sys/compat/linux/linux_dummy.c | 9 | ||||
-rw-r--r-- | sys/compat/linux/linux_file.c | 17 | ||||
-rw-r--r-- | sys/compat/linux/linux_syscall.h | 6 | ||||
-rw-r--r-- | sys/compat/linux/linux_syscallargs.h | 10 | ||||
-rw-r--r-- | sys/compat/linux/linux_syscalls.c | 4 | ||||
-rw-r--r-- | sys/compat/linux/linux_sysent.c | 6 | ||||
-rw-r--r-- | sys/compat/linux/syscalls.master | 5 |
7 files changed, 39 insertions, 18 deletions
diff --git a/sys/compat/linux/linux_dummy.c b/sys/compat/linux/linux_dummy.c index 65bdf45571b..d77613043cd 100644 --- a/sys/compat/linux/linux_dummy.c +++ b/sys/compat/linux/linux_dummy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: linux_dummy.c,v 1.17 2011/04/05 15:36:09 pirofti Exp $ */ +/* $OpenBSD: linux_dummy.c,v 1.18 2011/11/25 10:10:05 robert Exp $ */ /*- * Copyright (c) 1994-1995 Søren Schmidt @@ -8,7 +8,7 @@ * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer + * notice, this list of conditions and the following disclaimer * in this position and unchanged. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the @@ -46,7 +46,7 @@ linux_sys_ ## s(p, v, retval) \ register_t *retval; \ { \ return (unsupported_msg(p, #s)); \ -} +} static int unsupported_msg(struct proc *p, const char *fname) @@ -109,7 +109,6 @@ DUMMY(getpmsg); /* #188 */ DUMMY(putpmsg); /* #189 */ DUMMY(lchown); /* #198 */ DUMMY(fchown); /* #207 */ -DUMMY(chown); /* #212 */ DUMMY(setfsgid); /* #216 */ DUMMY(pivot_root); /* #217 */ DUMMY(mincore); /* #218 */ @@ -123,7 +122,7 @@ linux_sys_ ## s ## xattr(p, v, retval) \ register_t *retval; \ { \ return (ENOATTR); \ -} +} DUMMY_XATTR(set); DUMMY_XATTR(lset); DUMMY_XATTR(fset); diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c index 584aaf10bff..5c1a1bd2cec 100644 --- a/sys/compat/linux/linux_file.c +++ b/sys/compat/linux/linux_file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: linux_file.c,v 1.25 2011/07/07 01:19:39 tedu Exp $ */ +/* $OpenBSD: linux_file.c,v 1.26 2011/11/25 10:10:05 robert Exp $ */ /* $NetBSD: linux_file.c,v 1.15 1996/05/20 01:59:09 fvdl Exp $ */ /* @@ -692,6 +692,21 @@ linux_sys_chmod(p, v, retval) } int +linux_sys_chown(struct proc *p, void *v, register_t *retval) +{ + struct linux_sys_chown_args /* { + syscallarg(char *) path; + syscallarg(uid_t) uid; + syscallarg(gid_t) gid; + } */ *uap = v; + caddr_t sg = stackgap_init(p->p_emul); + + LINUX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path)); + + return sys_chown(p, uap, retval); +} + +int linux_sys_chown16(p, v, retval) struct proc *p; void *v; diff --git a/sys/compat/linux/linux_syscall.h b/sys/compat/linux/linux_syscall.h index fc8c1fb91f9..d36ea46fdc9 100644 --- a/sys/compat/linux/linux_syscall.h +++ b/sys/compat/linux/linux_syscall.h @@ -1,10 +1,10 @@ -/* $OpenBSD: linux_syscall.h,v 1.67 2011/09/19 22:49:57 pirofti Exp $ */ +/* $OpenBSD: linux_syscall.h,v 1.68 2011/11/25 10:10:05 robert Exp $ */ /* * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * created from OpenBSD: syscalls.master,v 1.63 2011/09/19 14:33:14 pirofti Exp + * created from OpenBSD: syscalls.master,v 1.64 2011/09/19 22:49:37 pirofti Exp */ /* syscall: "syscall" ret: "int" args: */ @@ -652,7 +652,7 @@ /* syscall: "getresgid" ret: "int" args: "gid_t *" "gid_t *" "gid_t *" */ #define LINUX_SYS_getresgid 211 -/* syscall: "chown" ret: "int" args: */ +/* syscall: "chown" ret: "int" args: "char *" "uid_t" "gid_t" */ #define LINUX_SYS_chown 212 /* syscall: "setuid" ret: "int" args: "uid_t" */ diff --git a/sys/compat/linux/linux_syscallargs.h b/sys/compat/linux/linux_syscallargs.h index a351941d0d4..0553ea11820 100644 --- a/sys/compat/linux/linux_syscallargs.h +++ b/sys/compat/linux/linux_syscallargs.h @@ -1,10 +1,10 @@ -/* $OpenBSD: linux_syscallargs.h,v 1.69 2011/09/19 22:49:57 pirofti Exp $ */ +/* $OpenBSD: linux_syscallargs.h,v 1.70 2011/11/25 10:10:05 robert Exp $ */ /* * System call argument lists. * * DO NOT EDIT-- this file is automatically generated. - * created from OpenBSD: syscalls.master,v 1.63 2011/09/19 14:33:14 pirofti Exp + * created from OpenBSD: syscalls.master,v 1.64 2011/09/19 22:49:37 pirofti Exp */ #ifdef syscallarg @@ -552,6 +552,12 @@ struct linux_sys_fstat64_args { syscallarg(struct linux_stat64 *) sp; }; +struct linux_sys_chown_args { + syscallarg(char *) path; + syscallarg(uid_t) uid; + syscallarg(gid_t) gid; +}; + struct linux_sys_setfsuid_args { syscallarg(uid_t) uid; }; diff --git a/sys/compat/linux/linux_syscalls.c b/sys/compat/linux/linux_syscalls.c index f2316073959..f99cd8d42d8 100644 --- a/sys/compat/linux/linux_syscalls.c +++ b/sys/compat/linux/linux_syscalls.c @@ -1,10 +1,10 @@ -/* $OpenBSD: linux_syscalls.c,v 1.67 2011/09/19 22:49:57 pirofti Exp $ */ +/* $OpenBSD: linux_syscalls.c,v 1.68 2011/11/25 10:10:05 robert Exp $ */ /* * System call names. * * DO NOT EDIT-- this file is automatically generated. - * created from OpenBSD: syscalls.master,v 1.63 2011/09/19 14:33:14 pirofti Exp + * created from OpenBSD: syscalls.master,v 1.64 2011/09/19 22:49:37 pirofti Exp */ char *linux_syscallnames[] = { diff --git a/sys/compat/linux/linux_sysent.c b/sys/compat/linux/linux_sysent.c index 74069eaf12e..60ca545ab9c 100644 --- a/sys/compat/linux/linux_sysent.c +++ b/sys/compat/linux/linux_sysent.c @@ -1,10 +1,10 @@ -/* $OpenBSD: linux_sysent.c,v 1.68 2011/09/19 22:49:57 pirofti Exp $ */ +/* $OpenBSD: linux_sysent.c,v 1.69 2011/11/25 10:10:05 robert Exp $ */ /* * System call switch table. * * DO NOT EDIT-- this file is automatically generated. - * created from OpenBSD: syscalls.master,v 1.63 2011/09/19 14:33:14 pirofti Exp + * created from OpenBSD: syscalls.master,v 1.64 2011/09/19 22:49:37 pirofti Exp */ #include <sys/param.h> @@ -470,7 +470,7 @@ struct sysent linux_sysent[] = { sys_setresgid }, /* 210 = setresgid */ { 3, s(struct sys_getresgid_args), 0, sys_getresgid }, /* 211 = getresgid */ - { 0, 0, 0, + { 3, s(struct linux_sys_chown_args), 0, linux_sys_chown }, /* 212 = chown */ { 1, s(struct sys_setuid_args), 0, sys_setuid }, /* 213 = setuid */ diff --git a/sys/compat/linux/syscalls.master b/sys/compat/linux/syscalls.master index b36acf0085e..ed1132c5358 100644 --- a/sys/compat/linux/syscalls.master +++ b/sys/compat/linux/syscalls.master @@ -1,4 +1,4 @@ - $OpenBSD: syscalls.master,v 1.64 2011/09/19 22:49:37 pirofti Exp $ + $OpenBSD: syscalls.master,v 1.65 2011/11/25 10:10:05 robert Exp $ ; $NetBSD: syscalls.master,v 1.15 1995/12/18 14:35:10 fvdl Exp $ ; @(#)syscalls.master 8.1 (Berkeley) 7/19/93 @@ -349,7 +349,8 @@ gid_t sgid); } 211 NOARGS { int sys_getresgid(gid_t *rgid, gid_t *egid, \ gid_t *sgid); } -212 NOARGS { int linux_sys_chown(void); } +212 STD { int linux_sys_chown(char *path, uid_t uid, \ + gid_t gid); } 213 NOARGS { int sys_setuid(uid_t uid); } 214 NOARGS { int sys_setgid(gid_t gid); } 215 STD { int linux_sys_setfsuid(uid_t uid); } |