Fritz & Doug,
Doug White <[EMAIL PROTECTED]> writes:
> On Thu, 27 Jan 2000, F. Heinrichmeyer wrote:
>
> > I would like to use an ASDM (backup software) with linux-emulation. I
> > get
> > the following in /var/log/messages:
> >
> > es-i2 /kernel: linux: syscall setresuid is obsoleted\
> > or not implemented (pid=41052)
> > Jan 27 13:12:42 es-i2 /kernel: pid 41052 (dsm), \
> > uid 0: exited on signal 11 (core dumped)
>
> What FreeBSD is this? I've run the v3 client under linux mode without bad
> syscalls (just that silly pathmunging stuff that I need to renew the fight
> over).
Perhaps you are running the backup as root while Fritz has a setuid
root program? In any case, please find attacked a patch that
implements setresuid. The patch is relative to 3.3 but should port
pretty easily to current.
Fritz, if this cures your problems, please drop me a note.
Cheers,
Björn
--
_ _ ,_______________.
Bjorn Gronvall (Björn Grönvall) /_______________/|
Swedish Institute of Computer Science | ||
PO Box 1263, S-164 29 Kista, Sweden | Schroedingers ||
Email: [EMAIL PROTECTED], Phone +46 -8 633 15 25 | Cat |/
Cellular +46 -70 768 06 35, Fax +46 -8 751 72 30 `---------------'
--- linux_misc.c 2000/01/29 10:23:54 1.1
+++ linux_misc.c 2000/01/29 11:40:28
@@ -797,6 +797,44 @@
}
int
+linux_setresuid(p, uap)
+ struct proc *p;
+ struct linux_setresuid_args *uap;
+{
+ struct setreuid_args bsd_args;
+
+ /* Allow setresuid iff the saved effective uid is left unchanged. */
+ if (uap->suid != -1 && uap->suid != p->p_cred->p_svuid) {
+ printf("Linux-emul(%d): setresuid(%d, %d, %d) not supported\n",
+ p->p_pid, uap->ruid, uap->euid, uap->suid);
+ return ENOSYS;
+ }
+ bsd_args.ruid = uap->ruid;
+ bsd_args.euid = uap->euid;
+ /* uap->suid is unchanged */
+ return setreuid(p, &bsd_args);
+}
+
+int
+linux_setresgid(p, uap)
+ struct proc *p;
+ struct linux_setresgid_args *uap;
+{
+ struct setregid_args bsd_args;
+
+ /* Allow setresgid iff the saved effective gid is left unchanged. */
+ if (uap->sgid != -1 && uap->sgid != p->p_cred->p_svgid) {
+ printf("Linux-emul(%d): setresgid(%d, %d, %d) not supported\n",
+ p->p_pid, uap->rgid, uap->egid, uap->sgid);
+ return ENOSYS;
+ }
+ bsd_args.rgid = uap->rgid;
+ bsd_args.egid = uap->egid;
+ /* uap->sgid is unchanged */
+ return setregid(p, &bsd_args);
+}
+
+int
linux_msync(struct proc *p, struct linux_msync_args *args)
{
struct msync_args bsd_args;
--- linux_proto.h 2000/01/29 10:28:59 1.1
+++ linux_proto.h 2000/01/29 11:08:53
@@ -402,6 +402,16 @@
int new_len; char new_len_[PAD_(int)];
int flags; char flags_[PAD_(int)];
};
+struct linux_setresuid_args {
+ int ruid; char ruid_[PAD_(int)];
+ int euid; char euid_[PAD_(int)];
+ int suid; char suid_[PAD_(int)];
+};
+struct linux_setresgid_args {
+ int rgid; char rgid_[PAD_(int)];
+ int egid; char egid_[PAD_(int)];
+ int sgid; char sgid_[PAD_(int)];
+};
struct linux_rt_sigaction_args {
int sig; char sig_[PAD_(int)];
struct linux_new_sigaction * act; char act_[PAD_(struct
linux_new_sigaction *)];
@@ -528,6 +538,8 @@
int linux_sched_setscheduler __P((struct proc *, struct
linux_sched_setscheduler_args *));
int linux_sched_getscheduler __P((struct proc *, struct
linux_sched_getscheduler_args *));
int linux_mremap __P((struct proc *, struct linux_mremap_args *));
+int linux_setresuid __P((struct proc *, struct linux_setresuid_args *));
+int linux_setresgid __P((struct proc *, struct linux_setresgid_args *));
int linux_rt_sigaction __P((struct proc *, struct linux_rt_sigaction_args *));
int linux_rt_sigprocmask __P((struct proc *, struct linux_rt_sigprocmask_args *));
int linux_chown __P((struct proc *, struct linux_chown_args *));
--- linux_syscall.h 2000/01/29 10:43:49 1.1
+++ linux_syscall.h 2000/01/29 11:09:30
@@ -162,7 +162,9 @@
#define LINUX_SYS_sched_rr_get_interval 161
#define LINUX_SYS_nanosleep 162
#define LINUX_SYS_linux_mremap 163
+#define LINUX_SYS_linux_setresuid 164
#define LINUX_SYS_poll 168
+#define LINUX_SYS_linux_setresgid 170
#define LINUX_SYS_linux_rt_sigaction 174
#define LINUX_SYS_linux_rt_sigprocmask 175
#define LINUX_SYS_linux_chown 182
--- linux_sysent.c 2000/01/29 10:06:22 1.1
+++ linux_sysent.c 2000/01/29 11:06:51
@@ -178,13 +178,13 @@
{ 2, (sy_call_t *)sched_rr_get_interval }, /* 161 =
sched_rr_get_interval */
{ 2, (sy_call_t *)nanosleep }, /* 162 = nanosleep */
{ 4, (sy_call_t *)linux_mremap }, /* 163 = linux_mremap */
- { 0, (sy_call_t *)nosys }, /* 164 = setresuid */
+ { 0, (sy_call_t *)linux_setresuid }, /* 164 = linux_setresuid */
{ 0, (sy_call_t *)nosys }, /* 165 = getresuid */
{ 0, (sy_call_t *)nosys }, /* 166 = new_vm86 */
{ 0, (sy_call_t *)nosys }, /* 167 = query_module */
{ 3, (sy_call_t *)poll }, /* 168 = poll */
{ 0, (sy_call_t *)nosys }, /* 169 = nfsservctl */
- { 0, (sy_call_t *)nosys }, /* 170 = setresgid */
+ { 0, (sy_call_t *)linux_setresgid }, /* 170 = linux_setresgid */
{ 0, (sy_call_t *)nosys }, /* 171 = getresgid */
{ 0, (sy_call_t *)nosys }, /* 172 = prctl */
{ 0, (sy_call_t *)nosys }, /* 173 = rt_sigreturn */
--- syscalls.master 2000/01/29 10:06:58 1.1
+++ syscalls.master 2000/01/29 11:07:31
@@ -238,14 +238,14 @@
163 STD LINUX { int linux_mremap(caddr_t addr, int old_len, \
int new_len, int flags); }
-164 UNIMPL LINUX setresuid
+164 STD LINUX { int linux_setresuid(int ruid, int euid, int suid); }
165 UNIMPL LINUX getresuid
166 UNIMPL LINUX new_vm86
167 UNIMPL LINUX query_module
168 NOPROTO LINUX { int poll(struct pollfd*, unsigned int nfds, \
long timeout); }
169 UNIMPL LINUX nfsservctl
-170 UNIMPL LINUX setresgid
+170 STD LINUX { int linux_setresgid(int rgid, int egid, int sgid); }
171 UNIMPL LINUX getresgid
172 UNIMPL LINUX prctl
173 UNIMPL LINUX rt_sigreturn
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message