summaryrefslogtreecommitdiffstats
path: root/sys/compat
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2005-09-28 07:03:03 +0000
committerrwatson <rwatson@FreeBSD.org>2005-09-28 07:03:03 +0000
commit2b01dbdaa07af097e72d1ab008447ee1f3b6bd9b (patch)
tree1db6d3398cfd694fad4465d775adf0700c4ab355 /sys/compat
parentf47ed80aec8394ebed798d91b1c91773c2139312 (diff)
downloadFreeBSD-src-2b01dbdaa07af097e72d1ab008447ee1f3b6bd9b.zip
FreeBSD-src-2b01dbdaa07af097e72d1ab008447ee1f3b6bd9b.tar.gz
Back out alpha/alpha/trap.c:1.124, osf1_ioctl.c:1.14, osf1_misc.c:1.57,
osf1_signal.c:1.41, amd64/amd64/trap.c:1.291, linux_socket.c:1.60, svr4_fcntl.c:1.36, svr4_ioctl.c:1.23, svr4_ipc.c:1.18, svr4_misc.c:1.81, svr4_signal.c:1.34, svr4_stat.c:1.21, svr4_stream.c:1.55, svr4_termios.c:1.13, svr4_ttold.c:1.15, svr4_util.h:1.10, ext2_alloc.c:1.43, i386/i386/trap.c:1.279, vm86.c:1.58, unaligned.c:1.12, imgact_elf.c:1.164, ffs_alloc.c:1.133: Now that Giant is acquired in uprintf() and tprintf(), the caller no longer leads to acquire Giant unless it also holds another mutex that would generate a lock order reversal when calling into these functions. Specifically not backed out is the acquisition of Giant in nfs_socket.c and rpcclnt.c, where local mutexes are held and would otherwise violate the lock order with Giant. This aligns this code more with the eventual locking of ttys. Suggested by: bde
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/linux/linux_socket.c2
-rw-r--r--sys/compat/svr4/svr4_fcntl.c6
-rw-r--r--sys/compat/svr4/svr4_ioctl.c2
-rw-r--r--sys/compat/svr4/svr4_ipc.c2
-rw-r--r--sys/compat/svr4/svr4_misc.c2
-rw-r--r--sys/compat/svr4/svr4_signal.c5
-rw-r--r--sys/compat/svr4/svr4_stat.c2
-rw-r--r--sys/compat/svr4/svr4_stream.c28
-rw-r--r--sys/compat/svr4/svr4_termios.c9
-rw-r--r--sys/compat/svr4/svr4_ttold.c24
-rw-r--r--sys/compat/svr4/svr4_util.h5
11 files changed, 6 insertions, 81 deletions
diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c
index b5d7f2b..f1f26bc 100644
--- a/sys/compat/linux/linux_socket.c
+++ b/sys/compat/linux/linux_socket.c
@@ -1187,9 +1187,7 @@ linux_socketcall(struct thread *td, struct linux_socketcall_args *args)
return (linux_recvmsg(td, arg));
}
- mtx_lock(&Giant);
uprintf("LINUX: 'socket' typ=%d not implemented\n", args->what);
- mtx_unlock(&Giant);
return (ENOSYS);
}
#endif /*!__alpha__*/
diff --git a/sys/compat/svr4/svr4_fcntl.c b/sys/compat/svr4/svr4_fcntl.c
index 2107813..ad74838 100644
--- a/sys/compat/svr4/svr4_fcntl.c
+++ b/sys/compat/svr4/svr4_fcntl.c
@@ -377,10 +377,8 @@ svr4_sys_open(td, uap)
free(newpath, M_TEMP);
if (error) {
- /* mtx_lock(&Giant);
- uprintf("svr4_open(%s, 0x%0x, 0%o): %d\n", uap->path,
- uap->flags, uap->mode, error);
- mtx_unlock(&Giant);*/
+ /* uprintf("svr4_open(%s, 0x%0x, 0%o): %d\n", uap->path,
+ uap->flags, uap->mode, error);*/
return error;
}
diff --git a/sys/compat/svr4/svr4_ioctl.c b/sys/compat/svr4/svr4_ioctl.c
index ba8218f..b192a2c 100644
--- a/sys/compat/svr4/svr4_ioctl.c
+++ b/sys/compat/svr4/svr4_ioctl.c
@@ -30,8 +30,6 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
-#include <sys/lock.h>
-#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/file.h>
#include <sys/filedesc.h>
diff --git a/sys/compat/svr4/svr4_ipc.c b/sys/compat/svr4/svr4_ipc.c
index 976668c..0b6acbf 100644
--- a/sys/compat/svr4/svr4_ipc.c
+++ b/sys/compat/svr4/svr4_ipc.c
@@ -77,9 +77,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/ipc.h>
-#include <sys/lock.h>
#include <sys/msg.h>
-#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/sem.h>
#include <sys/shm.h>
diff --git a/sys/compat/svr4/svr4_misc.c b/sys/compat/svr4/svr4_misc.c
index 2b31765..d7a9069 100644
--- a/sys/compat/svr4/svr4_misc.c
+++ b/sys/compat/svr4/svr4_misc.c
@@ -485,9 +485,7 @@ again:
panic("svr4_sys_getdents64: bad reclen");
off = *cookie++; /* each entry points to the next */
if ((off >> 32) != 0) {
- mtx_lock(&Giant);
uprintf("svr4_sys_getdents64: dir offset too large for emulated program");
- mtx_unlock(&Giant);
error = EINVAL;
goto out;
}
diff --git a/sys/compat/svr4/svr4_signal.c b/sys/compat/svr4/svr4_signal.c
index 57023e9..c0a3a21 100644
--- a/sys/compat/svr4/svr4_signal.c
+++ b/sys/compat/svr4/svr4_signal.c
@@ -238,11 +238,8 @@ svr4_to_bsd_sigaltstack(sss, bss)
bss->ss_flags |= SS_DISABLE;
if ((sss->ss_flags & SVR4_SS_ONSTACK) != 0)
bss->ss_flags |= SS_ONSTACK;
- if ((sss->ss_flags & ~SVR4_SS_ALLBITS) != 0) {
- mtx_lock(&Giant);
+ if ((sss->ss_flags & ~SVR4_SS_ALLBITS) != 0)
/*XXX*/ uprintf("svr4_to_bsd_sigaltstack: extra bits ignored\n");
- mtx_unlock(&Giant);
- }
}
void
diff --git a/sys/compat/svr4/svr4_stat.c b/sys/compat/svr4/svr4_stat.c
index 62bc223..d0f4d93 100644
--- a/sys/compat/svr4/svr4_stat.c
+++ b/sys/compat/svr4/svr4_stat.c
@@ -30,8 +30,6 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
-#include <sys/lock.h>
-#include <sys/mutex.h>
#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/stat.h>
diff --git a/sys/compat/svr4/svr4_stream.c b/sys/compat/svr4/svr4_stream.c
index a8153e9..bd6fa5a 100644
--- a/sys/compat/svr4/svr4_stream.c
+++ b/sys/compat/svr4/svr4_stream.c
@@ -378,8 +378,6 @@ bufprint(buf, len)
{
size_t i;
- GIANT_REQUIRED;
-
uprintf("\n\t");
for (i = 0; i < len; i++) {
uprintf("%x ", buf[i]);
@@ -397,8 +395,6 @@ show_ioc(str, ioc)
int len;
int error;
- GIANT_REQUIRED;
-
len = ioc->len;
if (len > 1024)
len = 1024;
@@ -434,8 +430,6 @@ show_strbuf(str)
int maxlen = str->maxlen;
int len = str->len;
- GIANT_REQUIRED;
-
if (maxlen > 8192)
maxlen = 8192;
@@ -479,8 +473,6 @@ show_msg(str, fd, ctl, dat, flags)
struct svr4_strbuf buf;
int error;
- GIANT_REQUIRED;
-
uprintf("%s(%d", str, fd);
if (ctl != NULL) {
if ((error = copyin(ctl, &buf, sizeof(buf))) != 0)
@@ -1415,12 +1407,8 @@ i_str(fp, td, retval, fd, cmd, dat)
return error;
#ifdef DEBUG_SVR4
- mtx_lock(&Giant);
- if ((error = show_ioc(">", &ioc)) != 0) {
- mtx_unlock(&Giant);
+ if ((error = show_ioc(">", &ioc)) != 0)
return error;
- }
- mtx_unlock(&Giant);
#endif /* DEBUG_SVR4 */
switch (ioc.cmd & 0xff00) {
@@ -1441,12 +1429,8 @@ i_str(fp, td, retval, fd, cmd, dat)
}
#ifdef DEBUG_SVR4
- mtx_lock(&Giant);
- if ((error = show_ioc("<", &ioc)) != 0) {
- mtx_lock(&Giant);
+ if ((error = show_ioc("<", &ioc)) != 0)
return error;
- }
- mtx_unlock(&Giant);
#endif /* DEBUG_SVR4 */
return copyout(&ioc, dat, sizeof(ioc));
}
@@ -1566,9 +1550,7 @@ svr4_stream_ioctl(fp, td, retval, fd, cmd, dat)
case SVR4_I_PUSH:
DPRINTF(("I_PUSH %p\n", dat));
#if defined(DEBUG_SVR4)
- mtx_lock(&Giant);
show_strbuf((struct svr4_strbuf *)dat);
- mtx_unlock(&Giant);
#endif
return 0;
@@ -1761,10 +1743,8 @@ svr4_do_putmsg(td, uap, fp)
retval = td->td_retval;
#ifdef DEBUG_SVR4
- mtx_lock(&Giant);
show_msg(">putmsg", uap->fd, uap->ctl,
uap->dat, uap->flags);
- mtx_unlock(&Giant);
#endif /* DEBUG_SVR4 */
FILE_LOCK_ASSERT(fp, MA_NOTOWNED);
@@ -1960,10 +1940,8 @@ svr4_do_getmsg(td, uap, fp)
memset(&sc, 0, sizeof(sc));
#ifdef DEBUG_SVR4
- mtx_lock(&Giant);
show_msg(">getmsg", uap->fd, uap->ctl,
uap->dat, 0);
- mtx_unlock(&Giant);
#endif /* DEBUG_SVR4 */
if (uap->ctl != NULL) {
@@ -2271,10 +2249,8 @@ svr4_do_getmsg(td, uap, fp)
*retval = 0;
#ifdef DEBUG_SVR4
- mtx_lock(&Giant);
show_msg("<getmsg", uap->fd, uap->ctl,
uap->dat, fl);
- mtx_unlock(&Giant);
#endif /* DEBUG_SVR4 */
return error;
}
diff --git a/sys/compat/svr4/svr4_termios.c b/sys/compat/svr4/svr4_termios.c
index b204929..37a6783 100644
--- a/sys/compat/svr4/svr4_termios.c
+++ b/sys/compat/svr4/svr4_termios.c
@@ -30,8 +30,6 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
-#include <sys/lock.h>
-#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/systm.h>
#include <sys/file.h>
@@ -158,9 +156,6 @@ print_bsd_termios(bt)
const struct termios *bt;
{
int i;
-
- GIANT_REQUIRED;
-
uprintf("BSD\niflag=%o oflag=%o cflag=%o lflag=%o\n",
bt->c_iflag, bt->c_oflag, bt->c_cflag, bt->c_lflag);
uprintf("cc: ");
@@ -513,9 +508,7 @@ svr4_term_ioctl(fp, td, retval, fd, cmd, data)
bsd_to_svr4_termios(&bt, &st);
#ifdef DEBUG_SVR4
- mtx_lock(&Giant);
print_bsd_termios(&bt);
- mtx_unlock(&Giant);
print_svr4_termios(&st);
#endif /* DEBUG_SVR4 */
@@ -583,9 +576,7 @@ svr4_term_ioctl(fp, td, retval, fd, cmd, data)
}
#ifdef DEBUG_SVR4
- mtx_lock(&Giant);
print_bsd_termios(&bt);
- mtx_unlock(&Giant);
print_svr4_termios(&st);
#endif /* DEBUG_SVR4 */
diff --git a/sys/compat/svr4/svr4_ttold.c b/sys/compat/svr4/svr4_ttold.c
index 537f88a..3575607 100644
--- a/sys/compat/svr4/svr4_ttold.c
+++ b/sys/compat/svr4/svr4_ttold.c
@@ -32,8 +32,6 @@ __FBSDID("$FreeBSD$");
#ifndef BURN_BRIDGES
#include <sys/param.h>
-#include <sys/lock.h>
-#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/systm.h>
#include <sys/file.h>
@@ -71,8 +69,6 @@ print_svr4_sgttyb(str, ss)
struct svr4_sgttyb *ss;
{
- GIANT_REQUIRED;
-
uprintf("%s\nispeed=%o ospeed=%o ", str, ss->sg_ispeed, ss->sg_ospeed);
uprintf("erase=%o kill=%o flags=%o\n", ss->sg_erase, ss->sg_kill,
ss->sg_flags);
@@ -83,9 +79,6 @@ print_svr4_tchars(str, st)
const char *str;
struct svr4_tchars *st;
{
-
- GIANT_REQUIRED;
-
uprintf("%s\nintrc=%o quitc=%o ", str, st->t_intrc, st->t_quitc);
uprintf("startc=%o stopc=%o eofc=%o brkc=%o\n", st->t_startc,
st->t_stopc, st->t_eofc, st->t_brkc);
@@ -96,9 +89,6 @@ print_svr4_ltchars(str, sl)
const char *str;
struct svr4_ltchars *sl;
{
-
- GIANT_REQUIRED;
-
uprintf("%s\nsuspc=%o dsuspc=%o ", str, sl->t_suspc, sl->t_dsuspc);
uprintf("rprntc=%o flushc=%o werasc=%o lnextc=%o\n", sl->t_rprntc,
sl->t_flushc, sl->t_werasc, sl->t_lnextc);
@@ -241,9 +231,7 @@ svr4_ttold_ioctl(fp, td, retval, fd, cmd, data)
return copyout(&pid, data, sizeof(pid));
#else
- mtx_lock(&Giant);
uprintf("ioctl(TIOCGSID) for pid %d unsupported\n", td->td_proc->p_pid);
- mtx_unlock(&Giant);
return EINVAL;
#endif
}
@@ -260,9 +248,7 @@ svr4_ttold_ioctl(fp, td, retval, fd, cmd, data)
bsd_sgttyb_to_svr4_sgttyb(&bs, &ss);
#ifdef DEBUG_SVR4
- mtx_lock(&Giant);
print_svr4_sgttyb("SVR4_TIOCGETP", &ss);
- mtx_unlock(&Giant);
#endif /* DEBUG_SVR4 */
return copyout(&ss, data, sizeof(ss));
}
@@ -278,9 +264,7 @@ svr4_ttold_ioctl(fp, td, retval, fd, cmd, data)
svr4_sgttyb_to_bsd_sgttyb(&ss, &bs);
#ifdef DEBUG_SVR4
- mtx_lock(&Giant);
print_svr4_sgttyb("SVR4_TIOCSET{P,N}", &ss);
- mtx_unlock(&Giant);
#endif /* DEBUG_SVR4 */
cmd = (cmd == SVR4_TIOCSETP) ? TIOCSETP : TIOCSETN;
return fo_ioctl(fp, cmd, (caddr_t) &bs,
@@ -299,9 +283,7 @@ svr4_ttold_ioctl(fp, td, retval, fd, cmd, data)
bsd_tchars_to_svr4_tchars(&bt, &st);
#ifdef DEBUG_SVR4
- mtx_lock(&Giant);
print_svr4_tchars("SVR4_TIOCGETC", &st);
- mtx_unlock(&Giant);
#endif /* DEBUG_SVR4 */
return copyout(&st, data, sizeof(st));
}
@@ -316,9 +298,7 @@ svr4_ttold_ioctl(fp, td, retval, fd, cmd, data)
svr4_tchars_to_bsd_tchars(&st, &bt);
#ifdef DEBUG_SVR4
- mtx_lock(&Giant);
print_svr4_tchars("SVR4_TIOCSETC", &st);
- mtx_unlock(&Giant);
#endif /* DEBUG_SVR4 */
return fo_ioctl(fp, TIOCSETC, (caddr_t) &bt,
td->td_ucred, td);
@@ -336,9 +316,7 @@ svr4_ttold_ioctl(fp, td, retval, fd, cmd, data)
bsd_ltchars_to_svr4_ltchars(&bl, &sl);
#ifdef DEBUG_SVR4
- mtx_lock(&Giant);
print_svr4_ltchars("SVR4_TIOCGLTC", &sl);
- mtx_unlock(&Giant);
#endif /* DEBUG_SVR4 */
return copyout(&sl, data, sizeof(sl));
}
@@ -353,9 +331,7 @@ svr4_ttold_ioctl(fp, td, retval, fd, cmd, data)
svr4_ltchars_to_bsd_ltchars(&sl, &bl);
#ifdef DEBUG_SVR4
- mtx_lock(&Giant);
print_svr4_ltchars("SVR4_TIOCSLTC", &sl);
- mtx_unlock(&Giant);
#endif /* DEBUG_SVR4 */
return fo_ioctl(fp, TIOCSLTC, (caddr_t) &bl,
td->td_ucred, td);
diff --git a/sys/compat/svr4/svr4_util.h b/sys/compat/svr4/svr4_util.h
index 54ed430..66902dd 100644
--- a/sys/compat/svr4/svr4_util.h
+++ b/sys/compat/svr4/svr4_util.h
@@ -42,10 +42,7 @@
#include <sys/uio.h>
#ifdef DEBUG_SVR4
-#define DPRINTF(a) do { \
- mtx_lock(&Giant); \
- uprintf a; \
-} while (0)
+#define DPRINTF(a) uprintf a;
#else
#define DPRINTF(a)
#endif
OpenPOWER on IntegriCloud