Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Jul 2002 17:49:58 -0500
From:      "Richard Seaman, Jr." <dick@seaman.org>
To:        Shannon -jj Behrens <jj@nttmcl.com>
Cc:        Don Bowman <don@sandvine.com>, freebsd-stable@FreeBSD.ORG, freebsd-java@FreeBSD.ORG
Subject:   Re: linux JRE 1.4 under linux compatibility only runs as root
Message-ID:  <20020711174958.E32743@seaman.org>
In-Reply-To: <20020711150748.B14694@alicia.nttmcl.com>; from jj@nttmcl.com on Thu, Jul 11, 2002 at 03:07:48PM -0700
References:  <20020711214742.C259A37B406@hub.freebsd.org> <20020711150748.B14694@alicia.nttmcl.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jul 11, 2002 at 03:07:48PM -0700, Shannon -jj Behrens wrote:
> > > I know several other people have run into the problem where
> > > the (Linux) JDK or JRE 1.4 will only run as root.
> > > Tracing this with 'ktrace', the issue is a statfs call,
> > > which returns 'RESTART'. I don't see that errno listed on
> > > the man page for statfs, I guess it must come from the
> > > linux_statfs in compat/linux.
> > > 
> > >  48927 java     CALL  statfs(0xbf1f)
> > >  48927 java     RET   statfs RESTART
> > 
> > OK, after having found out that 'ktrace' isn't appropriate
> > for linux executables (use truss or linux_kdump), I found that
> > the culprit is actually:
> > 
> > linux_sched_getscheduler(0xcb18)                 ERR#1 'Operation not
> > permitted'
> > 
> > when root, this is permitted. When non-root, this is not-permitted.
> > 
> > Suggestions? Is this a problem with the linux emulation? Or is
> > there a permissions difference between linux & freebsd here?
> 
> I'm having the same problem.  It looks like this has been discussed on -STABLE,
> -JAVA, -HACKERS, and -QUESTIONS, but to no avail:
> 
> <http://www.freebsd.org/cgi/getmsg.cgi?fetch=437107+0+/usr/local/www/db/text/2002/freebsd-bugs/20020519.freebsd-bugs>;
> 
> I'm sorry for the redundant cross-post, but this looks like a hard one to
> solve.

Not hard at all.  The perms in sched_getscheduler in -stable are silly.
(also sched_getparam).  Just try changing it to something like the patch
below (note that I don't have a stable system at the moment, so I don't
guarantee it works, nor that it even compiles -- take it as a guide only).

--- p1003_1b.c.orig	Thu Jul 11 17:29:55 2002
+++ p1003_1b.c	Thu Jul 11 17:40:51 2002
@@ -211,14 +211,24 @@
 int sched_getscheduler(struct proc *p,
 	struct sched_getscheduler_args *uap)
 {
-	int e;
-	(void) (0
-	|| (e = p31b_proc(p, uap->pid, &p))
-	|| (e = ksched_getscheduler(&p->p_retval[0], ksched, p))
-	);
+	int e = 0;
+	struct proc *targetp;
 
-	return e;
+	if (uap->pid == 0) {
+		targetp = p;
+	} else {
+		targetp = pfind(uap->pid);
+		if (targetp == NULL) {
+			e = ESRCH;
+		}
+	}
+
+	if (e == 0)
+		e = ksched_getscheduler(&p->p_retval[0], ksched, targetp);
+
+	return (e);
 }
+
 int sched_yield(struct proc *p,
 	struct sched_yield_args *uap)
 {

-- 
Richard Seaman, Jr.        email:    dick@seaman.org
5182 N. Maple Lane         phone:    262-367-5450
Nashotah WI 53058            fax:    262-367-5852

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-java" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020711174958.E32743>