svn commit: r194526 - head/usr.sbin/nfscbd

2009-06-20 Thread Stanislav Sedov
Author: stas
Date: Sat Jun 20 08:46:40 2009
New Revision: 194526
URL: http://svn.freebsd.org/changeset/base/194526

Log:
  - Include rpcv2.h before other NFS includes. That allows nfscbd to
compile.

Modified:
  head/usr.sbin/nfscbd/nfscbd.c

Modified: head/usr.sbin/nfscbd/nfscbd.c
==
--- head/usr.sbin/nfscbd/nfscbd.c   Sat Jun 20 06:02:21 2009
(r194525)
+++ head/usr.sbin/nfscbd/nfscbd.c   Sat Jun 20 08:46:40 2009
(r194526)
@@ -45,10 +45,10 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r194527 - stable/7/etc

2009-06-20 Thread Edwin Groothuis
Author: edwin
Date: Sat Jun 20 08:54:03 2009
New Revision: 194527
URL: http://svn.freebsd.org/changeset/base/194527

Log:
  MFC of 194107
  
  Sync termcap.small with main termcap; add xterm entry for libteken
  
  PR:   conf/135530
  Submitted by: Alex Kozlov 

Modified:
  stable/7/etc/termcap.small   (contents, props changed)

Modified: stable/7/etc/termcap.small
==
--- stable/7/etc/termcap.small  Sat Jun 20 08:46:40 2009(r194526)
+++ stable/7/etc/termcap.small  Sat Jun 20 08:54:03 2009(r194527)
@@ -71,6 +71,17 @@ cons60|ansi80x60:\
:li#60:tc=cons25:
 cons60-m|ansi80x60-mono:\
:li#60:tc=cons25-m:
+# Syscons console with 132 characters (VESA modes)
+cons25-w|ansi132x25:\
+   :co#132:tc=cons25:
+cons30-w|ansi132x30:\
+   :co#132:tc=cons30:
+cons43-w|ansi132x43:\
+   :co#132:tc=cons43:
+cons50-w|ansil-w|ansi132x50:\
+   :co#132:tc=cons50:
+cons60-w|ansi132x60:\
+   :co#132:tc=cons60:
 # KOI8-R/KOI8-U FreeBSD console with ACS support
 cons25r|cons25u|pc3r|ibmpc3r|cons25-koi8:\

:ac=q\200x\201m\204v\211j\205t\206n\212u\207l\202w\210k\203y\230z\231f\234~\225a\220h\2210\215:\
@@ -93,6 +104,28 @@ cons60r|cons60u|cons60-koi8:\
:li#60:tc=cons25r:
 cons60r-m|cons60u-m|cons60-koi8-mono:\
:li#60:tc=cons25r-m:
+# Syscons console with 90 characters (VGA modes)
+# KOI8-R/KOI8-U FreeBSD console with ACS support.
+cons25r-v|cons25u-v|pc3r-v|ibmpc3r-vga|cons25-koi8-vga:\
+   :co#90:tc=cons25r:
+cons25r-mv|cons25u-mv|pc3r-mv|ibmpc3r-monovga|cons25-koi8-monovga:\
+   :co#90:tc=cons25r-m:
+cons30r-v|cons30u-v|cons30-koi8-vga:\
+   :co#90:tc=cons30r:
+cons30r-mv|cons30u-mv|cons30-koi8-monovga:\
+   :co#90:tc=cons30r-m:
+cons43r-v|cons43u-v|cons43-koi8-vga:\
+   :co#90:tc=cons43r:
+cons43r-mv|cons43u-mv|cons43-koi8-monovga:\
+   :co#90:tc=cons43r-m:
+cons50r-v|cons50u-v|cons50-koi8-vga:\
+   :co#90:tc=cons50r:
+cons50r-mv|cons50u-mv|cons50-koi8-monovga:\
+   :co#90:tc=cons50r-m:
+cons60r-v|cons60u-v|cons60-koi8-vga:\
+   :co#90:tc=cons60r:
+cons60r-mv|cons60u-mv|cons60-koi8-monovga:\
+   :co#90:tc=cons60r-m:
 # ISO 8859-2 FreeBSD console with ACS support
 cons25l2|cons25-iso8859-2:\
:ac=f\260i\247:\
@@ -137,6 +170,17 @@ cons60l1|cons60-iso8859-1:\
:li#60:tc=cons25l1:
 cons60l1-m|cons60-iso8859-1-mono:\
:li#60:tc=cons25l1-m:
+# 132x25 ISO 8859-1 FreeBSD console
+cons25l1-w|:cons25w-iso8859-1:\
+   :co#132:tc=cons25l1:
+cons30l1-w|cons30w-iso8859-1:\
+   :co#132:tc=cons30l1:
+cons43l1-w|cons43w-iso8859-1:\
+   :co#132:tc=cons43l1:
+cons50l1-w|cons50w-iso8859-1:\
+   :co#132:tc=cons50l1:
+cons60l1-w|cons60w-iso8859-1:\
+   :co#132:tc=cons60l1:
 # ISO 8859-7 FreeBSD console with ACS support
 cons25l7|cons25-iso8859-7:\
:ac=f\260g\261{\360}\243+\253,\273i\247:\
@@ -180,8 +224,6 @@ pc|ibmpc|ibm pc PC/IX:\
:li#24:co#80:am:bs:bw:eo:\
:cd=\E[J:ce=\E[K:cl=\Ec:cm=\E[%i%2;%2H:do=\E[B:ho=\E[;H:\
:nd=\E[C:up=\E[A:so=\E[7m:se=\E[0m:us=\E[4m:ue=\E[0m:
-pc3mono|IBM PC 386BSD Console with monochrome monitor:\
-   :so=\E[0;1r\E[m:tc=pc3:
 pc3|ibmpc3|IBM PC 386BSD Console:\
:Co#8:\
:DO=\E[%dB:\
@@ -194,10 +236,10 @@ pc3|ibmpc3|IBM PC 386BSD Console:\
:K5=\E[G:\
:LE=\E[%dD:\
:RI=\E[%dC:\
-   :Sb=\E[1;%dx:\
-   :Sf=\E[2;%dx:\
+   :AB=\E[1;%dx:\
+   :AF=\E[2;%dx:\
:UP=\E[%dA:\
-   
:ac=l\332m\300k\277j\331u\264t\303v\301w\302q\304x\263n\305`^Da\260f\370g\361~\371.^Y-^Xh\261I^U0\333y\363z\362:\
+   
:ac=l\332m\300k\277j\331u\264t\303v\301w\302q\304x\263n\305`^Da\260f\370g\361~\371.^Y-^Xh\261i^U0\333y\363z\362:\
:am:\
:bl=^G:\
:bs:\
@@ -248,3 +290,33 @@ pc3|ibmpc3|IBM PC 386BSD Console:\
:ti=\E[m:\
:up=\E[A:\
:ut:
+
+# $XFree86: xc/programs/xterm/termcap,v 3.28 2001/01/17 23:46:39 dawes Exp $
+#
+xterm-xfree86|XFree86 xterm:\
+   :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:\
+   :k5=\E[15~:k6=\E[17~:k7=\E[18~:k8=\E[19~:\
+   :k9=\E[20~:k;=\E[21~:F1=\E[23~:F2=\E[24~:\
+   :@7=\EOF:@8=\EOM:kI=\E[2~:\
+   :kh=\EOH:kP=\E[5~:kN=\E[6~:\
+   :ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:Km=\E[M:tc=xterm-basic:
+#
+# This chunk is used for building the VT220/Sun/PC keyboard variants.
+xterm-basic|xterm common (XFree86):\
+   :li#24:co#80:am:kn#12:km:mi:ms:xn:AX:bl=^G:\
+   :is=\E[!p\E[?3;4l\E[4l\E>:rs=\E[!p\E[?3;4l\E[4l\E>:le=^H:\
+   :AL=\E[%dL:DL=\E[%dM:DC=\E[%dP:al=\E[L:dc=\E[P:dl=\E[M:\
+   :UP=\E[%dA:DO=\E[%dB:LE=\E[%dD:RI=\E[%dC:\
+   :ho=\E[H:cd=\E[J:ce=\E[K:cl=\E[H\E[2J:cm=\E[%i%d;%dH:cs=\E[%i%d;%dr:\
+   :im=\E[4h:ei=\E[4l:ks=\E[?1h\E=:ke=\E[?1l\E>:kD=\E[3~:kb=^H:\
+   :sf=\n:sr=\EM:st=\EH:ct=\E[3g:sc=\E7:rc=\E8:\
+   :eA=\E(B\E)0:as=\E(0:ae=\E(B:ml=\El:mu=\Em:up=\E[A:nd=\E[C:\
+   :md=\E[1m:me=\E[m:mr=\E[7m:so=\E[7m:se=\E[

svn commit: r194528 - head/lib/libpam/modules/pam_unix

2009-06-20 Thread Dag-Erling Smorgrav
Author: des
Date: Sat Jun 20 10:06:10 2009
New Revision: 194528
URL: http://svn.freebsd.org/changeset/base/194528

Log:
  Reword.
  
  MFC after:1 week

Modified:
  head/lib/libpam/modules/pam_unix/pam_unix.8

Modified: head/lib/libpam/modules/pam_unix/pam_unix.8
==
--- head/lib/libpam/modules/pam_unix/pam_unix.8 Sat Jun 20 08:54:03 2009
(r194527)
+++ head/lib/libpam/modules/pam_unix/pam_unix.8 Sat Jun 20 10:06:10 2009
(r194528)
@@ -34,7 +34,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 27, 2007
+.Dd June 20, 2009
 .Dt PAM_UNIX 8
 .Os
 .Sh NAME
@@ -106,9 +106,7 @@ except that if the previously obtained p
 the user is prompted for another password.
 .It Cm auth_as_self
 This option will require the user
-to authenticate himself as the user
-given by
-.Xr getlogin 2 ,
+to authenticate themselves as themselves,
 not as the account they are attempting to access.
 This is primarily for services like
 .Xr su 1 ,
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r194529 - head/lib/libpam/modules/pam_unix

2009-06-20 Thread Dag-Erling Smorgrav
Author: des
Date: Sat Jun 20 10:09:59 2009
New Revision: 194529
URL: http://svn.freebsd.org/changeset/base/194529

Log:
  Rewrap; this was getting painful.  Translators can ignore this.
  
  MFC after:1 week

Modified:
  head/lib/libpam/modules/pam_unix/pam_unix.8

Modified: head/lib/libpam/modules/pam_unix/pam_unix.8
==
--- head/lib/libpam/modules/pam_unix/pam_unix.8 Sat Jun 20 10:06:10 2009
(r194528)
+++ head/lib/libpam/modules/pam_unix/pam_unix.8 Sat Jun 20 10:09:59 2009
(r194529)
@@ -52,8 +52,7 @@ The
 authentication service module for PAM,
 .Nm
 provides functionality for three PAM categories:
-authentication,
-account management, and password management.
+authentication, account management, and password management.
 In terms of the
 .Ar module-type
 parameter, they are the
@@ -66,14 +65,13 @@ It also provides a null function for ses
 .Ss Ux Ss Authentication Module
 The
 .Ux
-authentication component
-provides functions to verify the identity of a user
+authentication component provides functions to verify the identity of
+a user
 .Pq Fn pam_sm_authenticate ,
 which obtains the relevant
 .Xr passwd 5
 entry.
-It prompts the user for a password
-and verifies that this is correct with
+It prompts the user for a password and verifies that this is correct with
 .Xr crypt 3 .
 .Pp
 The following options may be passed to the authentication module:
@@ -84,64 +82,46 @@ debugging information at
 .Dv LOG_DEBUG
 level.
 .It Cm use_first_pass
-If the authentication module
-is not the first in the stack,
-and a previous module
-obtained the user's password,
-that password is used
-to authenticate the user.
-If this fails,
-the authentication module returns failure
-without prompting the user for a password.
-This option has no effect
-if the authentication module
-is the first in the stack,
-or if no previous modules
-obtained the user's password.
+If the authentication module is not the first in the stack, and a
+previous module obtained the user's password, that password is used to
+authenticate the user.
+If this fails, the authentication module returns failure without
+prompting the user for a password.
+This option has no effect if the authentication module is the first in
+the stack, or if no previous modules obtained the user's password.
 .It Cm try_first_pass
 This option is similar to the
 .Cm use_first_pass
-option,
-except that if the previously obtained password fails,
-the user is prompted for another password.
+option, except that if the previously obtained password fails, the
+user is prompted for another password.
 .It Cm auth_as_self
-This option will require the user
-to authenticate themselves as themselves,
-not as the account they are attempting to access.
+This option will require the user to authenticate themselves as
+themselves, not as the account they are attempting to access.
 This is primarily for services like
 .Xr su 1 ,
-where the user's ability to retype
-their own password
-might be deemed sufficient.
+where the user's ability to retype their own password might be deemed
+sufficient.
 .It Cm nullok
-If the password database
-has no password
-for the entity being authenticated,
-then this option
-will forgo password prompting,
-and silently allow authentication to succeed.
+If the password database has no password for the entity being
+authenticated, then this option will forgo password prompting, and
+silently allow authentication to succeed.
 .It Cm local_pass
-Use only the local password database,
-even if NIS is in use.
-This will cause an authentication failure
-if the system is configured
+Use only the local password database, even if NIS is in use.
+This will cause an authentication failure if the system is configured
 to only use NIS.
 .It Cm nis_pass
 Use only the NIS password database.
-This will cause an authentication failure
-if the system is not configured
-to use NIS.
+This will cause an authentication failure if the system is not
+configured to use NIS.
 .El
 .Ss Ux Ss Account Management Module
 The
 .Ux
-account management component
-provides a function to perform account management,
+account management component provides a function to perform account
+management,
 .Fn pam_sm_acct_mgmt .
-The function verifies
-that the authenticated user
-is allowed to log into the local user account
-by checking the following criteria:
+The function verifies that the authenticated user is allowed to log
+into the local user account by checking the following criteria:
 .Bl -dash -offset indent
 .It
 locked status of the account compatible with
@@ -166,8 +146,8 @@ level.
 .Ss Ux Ss Password Management Module
 The
 .Ux
-password management component
-provides a function to perform password management,
+password management component provides a function to perform password
+management,
 .Fn pam_sm_chauthtok .
 The function changes
 the user's password.
@@ -181,17 +161,14 @@ debugging inform

svn commit: r194531 - head/libexec/rtld-elf

2009-06-20 Thread Alexander Kabaev
Author: kan
Date: Sat Jun 20 14:16:41 2009
New Revision: 194531
URL: http://svn.freebsd.org/changeset/base/194531

Log:
  Allow order of initialization of loaded shared objects to be
  altered through their .init code. This might happen if init
  vector calls dlopen on its own and that dlopen causes some not
  yet initialized object to be initialized earlier as part of that
  dlopened DAG.
  
  Do not reset module reference counts to zero on final fini vector
  run when process is exiting. Just add an additional parameter to
  force fini vector invocation regardless of current reference count
  value if object was not destructed yet. This allows dlclose called
  from fini vector to proceed normally instead of failing with handle
  validation error.
  
  Reviewed by:  kib
  Reported by:  venki kaps

Modified:
  head/libexec/rtld-elf/rtld.c
  head/libexec/rtld-elf/rtld.h

Modified: head/libexec/rtld-elf/rtld.c
==
--- head/libexec/rtld-elf/rtld.cSat Jun 20 12:02:56 2009
(r194530)
+++ head/libexec/rtld-elf/rtld.cSat Jun 20 14:16:41 2009
(r194531)
@@ -107,15 +107,14 @@ static int load_needed_objects(Obj_Entry
 static int load_preload_objects(void);
 static Obj_Entry *load_object(const char *, const Obj_Entry *);
 static Obj_Entry *obj_from_addr(const void *);
-static void objlist_call_fini(Objlist *, int *lockstate);
-static void objlist_call_init(Objlist *, int *lockstate);
+static void objlist_call_fini(Objlist *, bool, int *);
+static void objlist_call_init(Objlist *, int *);
 static void objlist_clear(Objlist *);
 static Objlist_Entry *objlist_find(Objlist *, const Obj_Entry *);
 static void objlist_init(Objlist *);
 static void objlist_push_head(Objlist *, Obj_Entry *);
 static void objlist_push_tail(Objlist *, Obj_Entry *);
 static void objlist_remove(Objlist *, Obj_Entry *);
-static void objlist_remove_unref(Objlist *);
 static void *path_enumerate(const char *, path_enum_proc, void *);
 static int relocate_objects(Obj_Entry *, bool, Obj_Entry *);
 static int rtld_dirname(const char *, char *);
@@ -136,9 +135,9 @@ static void unlink_object(Obj_Entry *);
 static void unload_object(Obj_Entry *);
 static void unref_dag(Obj_Entry *);
 static void ref_dag(Obj_Entry *);
-static int origin_subst_one(char **res, const char *real, const char *kw,
-  const char *subst, char *may_free);
-static char *origin_subst(const char *real, const char *origin_path);
+static int origin_subst_one(char **, const char *, const char *,
+  const char *, char *);
+static char *origin_subst(const char *, const char *);
 static int  rtld_verify_versions(const Objlist *);
 static int  rtld_verify_object_versions(Obj_Entry *);
 static void object_add_name(Obj_Entry *, const char *);
@@ -1379,9 +1378,9 @@ initlist_add_neededs(Needed_Entry *neede
 static void
 initlist_add_objects(Obj_Entry *obj, Obj_Entry **tail, Objlist *list)
 {
-if (obj->init_done)
+if (obj->init_scanned || obj->init_done)
return;
-obj->init_done = true;
+obj->init_scanned = true;
 
 /* Recursively process the successor objects. */
 if (&obj->next != tail)
@@ -1396,8 +1395,10 @@ initlist_add_objects(Obj_Entry *obj, Obj
objlist_push_tail(list, obj);
 
 /* Add the object to the global fini list in the reverse order. */
-if (obj->fini != (Elf_Addr)NULL)
+if (obj->fini != (Elf_Addr)NULL && !obj->on_fini_list) {
objlist_push_head(&list_fini, obj);
+   obj->on_fini_list = true;
+}
 }
 
 #ifndef FPTR_TARGET
@@ -1600,9 +1601,9 @@ obj_from_addr(const void *addr)
  * non-NULL fini functions.
  */
 static void
-objlist_call_fini(Objlist *list, int *lockstate)
+objlist_call_fini(Objlist *list, bool force, int *lockstate)
 {
-Objlist_Entry *elm;
+Objlist_Entry *elm, *elm_tmp;
 char *saved_msg;
 
 /*
@@ -1610,17 +1611,22 @@ objlist_call_fini(Objlist *list, int *lo
  * call into the dynamic linker and overwrite it.
  */
 saved_msg = errmsg_save();
-wlock_release(rtld_bind_lock, *lockstate);
-STAILQ_FOREACH(elm, list, link) {
-   if (elm->obj->refcount == 0) {
+STAILQ_FOREACH_SAFE(elm, list, link, elm_tmp) {
+   if (elm->obj->refcount == 0 || force) {
dbg("calling fini function for %s at %p", elm->obj->path,
(void *)elm->obj->fini);
LD_UTRACE(UTRACE_FINI_CALL, elm->obj, (void *)elm->obj->fini, 0, 0,
elm->obj->path);
+   /* Remove object from fini list to prevent recursive invocation. */
+   STAILQ_REMOVE(list, elm, Struct_Objlist_Entry, link);
+   wlock_release(rtld_bind_lock, *lockstate);
call_initfini_pointer(elm->obj, elm->obj->fini);
+   *lockstate = wlock_acquire(rtld_bind_lock);
+   /* No need to free anything if process is going down. */
+   if (!force)
+   free(elm);
}
 }
-*lockstate = wlock_acquire(rtld_bind_lock

svn commit: r194532 - in head/sys: fs/devfs kern sys

2009-06-20 Thread Ed Schouten
Author: ed
Date: Sat Jun 20 14:50:32 2009
New Revision: 194532
URL: http://svn.freebsd.org/changeset/base/194532

Log:
  Improve nested jail awareness of devfs by handling credentials.
  
  Now that we start to use credentials on character devices more often
  (because of MPSAFE TTY), move the prison-checks that are in place in the
  TTY code into devfs.
  
  Instead of strictly comparing the prisons, use the more common
  prison_check() function to compare credentials. This means that
  pseudo-terminals are only visible in devfs by processes within the same
  jail and parent jails.
  
  Even though regular users in parent jails can now interact with
  pseudo-terminals from child jails, this seems to be the right approach.
  These processes are also capable of interacting with the jailed
  processes anyway, through signals for example.
  
  Reviewed by:  kib, rwatson (older version)

Modified:
  head/sys/fs/devfs/devfs_vnops.c
  head/sys/kern/tty.c
  head/sys/sys/priv.h

Modified: head/sys/fs/devfs/devfs_vnops.c
==
--- head/sys/fs/devfs/devfs_vnops.c Sat Jun 20 14:16:41 2009
(r194531)
+++ head/sys/fs/devfs/devfs_vnops.c Sat Jun 20 14:50:32 2009
(r194532)
@@ -48,6 +48,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -706,6 +707,22 @@ devfs_kqfilter_f(struct file *fp, struct
return (error);
 }
 
+static inline int
+devfs_prison_check(struct devfs_dirent *de, struct ucred *tcr)
+{
+   struct cdev_priv *cdp;
+   struct ucred *dcr;
+
+   cdp = de->de_cdp;
+   if (cdp == NULL)
+   return (0);
+   dcr = cdp->cdp_c.si_cred;
+   if (dcr == NULL)
+   return (0);
+
+   return (prison_check(tcr, dcr));
+}
+
 static int
 devfs_lookupx(struct vop_lookup_args *ap, int *dm_unlock)
 {
@@ -831,6 +848,9 @@ devfs_lookupx(struct vop_lookup_args *ap
return (ENOENT);
}
 
+   if (devfs_prison_check(de, td->td_ucred))
+   return (ENOENT);
+
if ((cnp->cn_nameiop == DELETE) && (flags & ISLASTCN)) {
error = VOP_ACCESS(dvp, VWRITE, cnp->cn_cred, td);
if (error)
@@ -1106,6 +1126,8 @@ devfs_readdir(struct vop_readdir_args *a
KASSERT(dd->de_cdp != (void *)0xdeadc0de, ("%s %d\n", __func__, 
__LINE__));
if (dd->de_flags & DE_WHITEOUT)
continue;
+   if (devfs_prison_check(dd, ap->a_cred))
+   continue;
if (dd->de_dirent->d_type == DT_DIR)
de = dd->de_dir;
else

Modified: head/sys/kern/tty.c
==
--- head/sys/kern/tty.c Sat Jun 20 14:16:41 2009(r194531)
+++ head/sys/kern/tty.c Sat Jun 20 14:50:32 2009(r194532)
@@ -219,13 +219,6 @@ ttydev_open(struct cdev *dev, int oflags
struct tty *tp = dev->si_drv1;
int error = 0;
 
-   /* Disallow access when the TTY belongs to a different prison. */
-   if (dev->si_cred != NULL &&
-   dev->si_cred->cr_prison != td->td_ucred->cr_prison &&
-   priv_check(td, PRIV_TTY_PRISON)) {
-   return (EPERM);
-   }
-
tty_lock(tp);
if (tty_gone(tp)) {
/* Device is already gone. */

Modified: head/sys/sys/priv.h
==
--- head/sys/sys/priv.h Sat Jun 20 14:16:41 2009(r194531)
+++ head/sys/sys/priv.h Sat Jun 20 14:50:32 2009(r194532)
@@ -211,7 +211,6 @@
 #definePRIV_TTY_DRAINWAIT  251 /* Set tty drain wait time. */
 #definePRIV_TTY_DTRWAIT252 /* Set DTR wait on tty. */
 #definePRIV_TTY_EXCLUSIVE  253 /* Override tty exclusive flag. 
*/
-#definePRIV_TTY_PRISON 254 /* Can open pts across jails. */
 #definePRIV_TTY_STI255 /* Simulate input on another 
tty. */
 #definePRIV_TTY_SETA   256 /* Set tty termios structure. */
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r194534 - in head/sys/security: mac_biba mac_lomac

2009-06-20 Thread Ed Schouten
Author: ed
Date: Sat Jun 20 15:54:35 2009
New Revision: 194534
URL: http://svn.freebsd.org/changeset/base/194534

Log:
  Chase the removal of PRIV_TTY_PRISON in the mac(9) modules.
  
  Reported by:  kib
  Pointy hat to:me

Modified:
  head/sys/security/mac_biba/mac_biba.c
  head/sys/security/mac_lomac/mac_lomac.c

Modified: head/sys/security/mac_biba/mac_biba.c
==
--- head/sys/security/mac_biba/mac_biba.c   Sat Jun 20 15:51:26 2009
(r194533)
+++ head/sys/security/mac_biba/mac_biba.c   Sat Jun 20 15:54:35 2009
(r194534)
@@ -1789,7 +1789,6 @@ biba_priv_check(struct ucred *cred, int 
case PRIV_TTY_DRAINWAIT:
case PRIV_TTY_DTRWAIT:
case PRIV_TTY_EXCLUSIVE:
-   case PRIV_TTY_PRISON:
case PRIV_TTY_STI:
case PRIV_TTY_SETA:
 

Modified: head/sys/security/mac_lomac/mac_lomac.c
==
--- head/sys/security/mac_lomac/mac_lomac.c Sat Jun 20 15:51:26 2009
(r194533)
+++ head/sys/security/mac_lomac/mac_lomac.c Sat Jun 20 15:54:35 2009
(r194534)
@@ -1781,7 +1781,6 @@ lomac_priv_check(struct ucred *cred, int
case PRIV_TTY_DRAINWAIT:
case PRIV_TTY_DTRWAIT:
case PRIV_TTY_EXCLUSIVE:
-   case PRIV_TTY_PRISON:
case PRIV_TTY_STI:
case PRIV_TTY_SETA:
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r194536 - head/share/man/man4

2009-06-20 Thread Ed Schouten
Author: ed
Date: Sat Jun 20 16:30:32 2009
New Revision: 194536
URL: http://svn.freebsd.org/changeset/base/194536

Log:
  Improve sentence and add reference to openpty(3). Add missing newlines.

Modified:
  head/share/man/man4/pts.4

Modified: head/share/man/man4/pts.4
==
--- head/share/man/man4/pts.4   Sat Jun 20 15:58:23 2009(r194535)
+++ head/share/man/man4/pts.4   Sat Jun 20 16:30:32 2009(r194536)
@@ -148,11 +148,14 @@ pseudo-terminals implementation are:
 .Pp
 .Bl -tag -width ".Pa /dev/pts/[num]"
 .It Pa /dev/ptmx
-Control device, returns a file descriptor to a new master pseudo-terminal
-when opened. This device should not be opened directly. It's only
-available for binary compatibility. New devices should only be created
-though
-.Xr posix_openpt 2 .
+Control device, returns a file descriptor to a new master
+pseudo-terminal when opened.
+This device should not be opened directly.
+It's only available for binary compatibility.
+New devices should only be allocated with
+.Xr posix_openpt 2
+and
+.Xr openpty 3 .
 .It Pa /dev/pts/[num]
 Pseudo-terminal slave devices.
 .El
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r194537 - head/sys/dev/drm

2009-06-20 Thread Robert Noland
Author: rnoland
Date: Sat Jun 20 16:37:24 2009
New Revision: 194537
URL: http://svn.freebsd.org/changeset/base/194537

Log:
  Don't panic if drm_rmmap is called with a NULL map pointer.
  
  MFC after:3 days

Modified:
  head/sys/dev/drm/drm_bufs.c

Modified: head/sys/dev/drm/drm_bufs.c
==
--- head/sys/dev/drm/drm_bufs.c Sat Jun 20 16:30:32 2009(r194536)
+++ head/sys/dev/drm/drm_bufs.c Sat Jun 20 16:37:24 2009(r194537)
@@ -296,6 +296,9 @@ void drm_rmmap(struct drm_device *dev, d
 {
DRM_SPINLOCK_ASSERT(&dev->dev_lock);
 
+   if (map == NULL)
+   return;
+
TAILQ_REMOVE(&dev->maplist, map, link);
 
switch (map->type) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r194538 - head/sys/sys

2009-06-20 Thread Ed Schouten
Author: ed
Date: Sat Jun 20 16:39:25 2009
New Revision: 194538
URL: http://svn.freebsd.org/changeset/base/194538

Log:
  Add placeholder to prevent reuse of privilege 254.
  
  Requested by: rwatson

Modified:
  head/sys/sys/priv.h

Modified: head/sys/sys/priv.h
==
--- head/sys/sys/priv.h Sat Jun 20 16:37:24 2009(r194537)
+++ head/sys/sys/priv.h Sat Jun 20 16:39:25 2009(r194538)
@@ -211,6 +211,7 @@
 #definePRIV_TTY_DRAINWAIT  251 /* Set tty drain wait time. */
 #definePRIV_TTY_DTRWAIT252 /* Set DTR wait on tty. */
 #definePRIV_TTY_EXCLUSIVE  253 /* Override tty exclusive flag. 
*/
+#define_PRIV_TTY_PRISON254 /* Removed. */
 #definePRIV_TTY_STI255 /* Simulate input on another 
tty. */
 #definePRIV_TTY_SETA   256 /* Set tty termios structure. */
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r194539 - head/sys/dev/drm

2009-06-20 Thread Robert Noland
Author: rnoland
Date: Sat Jun 20 16:40:48 2009
New Revision: 194539
URL: http://svn.freebsd.org/changeset/base/194539

Log:
  realloc() behaves identically to malloc when passed a NULL object pointer
  
  If an error does occur we would have left max_context with an incorrect
  value.
  
  MFC after:3 days

Modified:
  head/sys/dev/drm/drm_context.c

Modified: head/sys/dev/drm/drm_context.c
==
--- head/sys/dev/drm/drm_context.c  Sat Jun 20 16:39:25 2009
(r194538)
+++ head/sys/dev/drm/drm_context.c  Sat Jun 20 16:40:48 2009
(r194539)
@@ -72,34 +72,23 @@ int drm_ctxbitmap_next(struct drm_device
}
 
set_bit(bit, dev->ctx_bitmap);
-   DRM_DEBUG("drm_ctxbitmap_next bit : %d\n", bit);
+   DRM_DEBUG("bit : %d\n", bit);
if ((bit+1) > dev->max_context) {
-   dev->max_context = (bit+1);
-   if (dev->context_sareas != NULL) {
-   drm_local_map_t **ctx_sareas;
-
-   ctx_sareas = realloc(dev->context_sareas,
-   dev->max_context * sizeof(*dev->context_sareas),
-   DRM_MEM_SAREA, M_NOWAIT);
-   if (ctx_sareas == NULL) {
-   clear_bit(bit, dev->ctx_bitmap);
-   DRM_UNLOCK();
-   return -1;
-   }
-   dev->context_sareas = ctx_sareas;
-   dev->context_sareas[bit] = NULL;
-   } else {
-   /* max_context == 1 at this point */
-   dev->context_sareas = malloc(dev->max_context * 
-   sizeof(*dev->context_sareas), DRM_MEM_SAREA,
-   M_NOWAIT);
-   if (dev->context_sareas == NULL) {
-   clear_bit(bit, dev->ctx_bitmap);
-   DRM_UNLOCK();
-   return -1;
-   }
-   dev->context_sareas[bit] = NULL;
+   drm_local_map_t **ctx_sareas;
+   int max_ctx = (bit+1);
+
+   ctx_sareas = realloc(dev->context_sareas,
+   max_ctx * sizeof(*dev->context_sareas),
+   DRM_MEM_SAREA, M_NOWAIT);
+   if (ctx_sareas == NULL) {
+   clear_bit(bit, dev->ctx_bitmap);
+   DRM_DEBUG("failed to allocate bit : %d\n", bit);
+   DRM_UNLOCK();
+   return -1;
}
+   dev->max_context = max_ctx;
+   dev->context_sareas = ctx_sareas;
+   dev->context_sareas[bit] = NULL;
}
DRM_UNLOCK();
return bit;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r194540 - head/sys/dev/drm

2009-06-20 Thread Robert Noland
Author: rnoland
Date: Sat Jun 20 16:45:14 2009
New Revision: 194540
URL: http://svn.freebsd.org/changeset/base/194540

Log:
  The G45 docs indicate that all G4X chips use the new framecount register.
  
  Intel agrees with my reading of the docs, make it so for all G4X chips.
  
  The new register also has a 32 bit width as opposed to 24 bits.  Fix
  things up so that the counters roll over properly.
  
  MFC after:3 days

Modified:
  head/sys/dev/drm/i915_dma.c
  head/sys/dev/drm/i915_drv.h
  head/sys/dev/drm/i915_irq.c

Modified: head/sys/dev/drm/i915_dma.c
==
--- head/sys/dev/drm/i915_dma.c Sat Jun 20 16:40:48 2009(r194539)
+++ head/sys/dev/drm/i915_dma.c Sat Jun 20 16:45:14 2009(r194540)
@@ -871,10 +871,13 @@ int i915_driver_load(struct drm_device *
ret = drm_addmap(dev, base, size, _DRM_REGISTERS,
_DRM_KERNEL | _DRM_DRIVER, &dev_priv->mmio_map);
 
-   if (IS_GM45(dev))
-   dev->driver->get_vblank_counter = gm45_get_vblank_counter;
-   else
+   if (IS_G4X(dev)) {
+   dev->driver->get_vblank_counter = g45_get_vblank_counter;
+   dev->max_vblank_count = 0x; /* 32 bits of frame count */
+   } else {
dev->driver->get_vblank_counter = i915_get_vblank_counter;
+   dev->max_vblank_count = 0x00ff; /* 24 bits of frame count */
+   }
 
 #ifdef I915_HAVE_GEM
i915_gem_load(dev);

Modified: head/sys/dev/drm/i915_drv.h
==
--- head/sys/dev/drm/i915_drv.h Sat Jun 20 16:40:48 2009(r194539)
+++ head/sys/dev/drm/i915_drv.h Sat Jun 20 16:45:14 2009(r194540)
@@ -453,7 +453,7 @@ extern int i915_vblank_pipe_get(struct d
 extern int i915_enable_vblank(struct drm_device *dev, int crtc);
 extern void i915_disable_vblank(struct drm_device *dev, int crtc);
 extern u32 i915_get_vblank_counter(struct drm_device *dev, int crtc);
-extern u32 gm45_get_vblank_counter(struct drm_device *dev, int crtc);
+extern u32 g45_get_vblank_counter(struct drm_device *dev, int crtc);
 extern int i915_vblank_swap(struct drm_device *dev, void *data,
struct drm_file *file_priv);
 

Modified: head/sys/dev/drm/i915_irq.c
==
--- head/sys/dev/drm/i915_irq.c Sat Jun 20 16:40:48 2009(r194539)
+++ head/sys/dev/drm/i915_irq.c Sat Jun 20 16:45:14 2009(r194540)
@@ -177,7 +177,7 @@ u32 i915_get_vblank_counter(struct drm_d
return count;
 }
 
-u32 gm45_get_vblank_counter(struct drm_device *dev, int pipe)
+u32 g45_get_vblank_counter(struct drm_device *dev, int pipe)
 {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
int reg = pipe ? PIPEB_FRMCOUNT_GM45 : PIPEA_FRMCOUNT_GM45;
@@ -516,8 +516,6 @@ int i915_driver_irq_postinstall(struct d
 
dev_priv->vblank_pipe = DRM_I915_VBLANK_PIPE_A | DRM_I915_VBLANK_PIPE_B;
 
-   dev->max_vblank_count = 0xff; /* only 24 bits of frame count */
-
/* Unmask the interrupts that we always want on. */
dev_priv->irq_mask_reg = ~I915_INTERRUPT_ENABLE_FIX;
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r194541 - in head/sys/fs: nfs nfsclient

2009-06-20 Thread Rick Macklem
Author: rmacklem
Date: Sat Jun 20 17:11:07 2009
New Revision: 194541
URL: http://svn.freebsd.org/changeset/base/194541

Log:
  Replace RPCAUTH_UNIXGIDS with NFS_MAXGRPS so that nfscbd.c will build.
  
  Approved by:  kib (mentor)

Modified:
  head/sys/fs/nfs/nfs.h
  head/sys/fs/nfsclient/nfs_clport.c

Modified: head/sys/fs/nfs/nfs.h
==
--- head/sys/fs/nfs/nfs.h   Sat Jun 20 16:45:14 2009(r194540)
+++ head/sys/fs/nfs/nfs.h   Sat Jun 20 17:11:07 2009(r194541)
@@ -405,12 +405,12 @@ typedef struct {
 
 /*
  * Store uid, gid creds that were used when the stateid was acquired.
- * The RPC layer allows RPCAUTH_UNIXGIDS + 1 groups to go out on the wire,
+ * The RPC layer allows NFS_MAXGRPS + 1 groups to go out on the wire,
  * so that's how many gets stored here.
  */
 struct nfscred {
uid_t   nfsc_uid;
-   gid_t   nfsc_groups[RPCAUTH_UNIXGIDS + 1];
+   gid_t   nfsc_groups[NFS_MAXGRPS + 1];
int nfsc_ngroups;
 };
 

Modified: head/sys/fs/nfsclient/nfs_clport.c
==
--- head/sys/fs/nfsclient/nfs_clport.c  Sat Jun 20 16:45:14 2009
(r194540)
+++ head/sys/fs/nfsclient/nfs_clport.c  Sat Jun 20 17:11:07 2009
(r194541)
@@ -979,7 +979,7 @@ newnfs_copyincred(struct ucred *cr, stru
int i;
 
nfscr->nfsc_uid = cr->cr_uid;
-   nfscr->nfsc_ngroups = MIN(cr->cr_ngroups, RPCAUTH_UNIXGIDS + 1);
+   nfscr->nfsc_ngroups = MIN(cr->cr_ngroups, NFS_MAXGRPS + 1);
for (i = 0; i < nfscr->nfsc_ngroups; i++)
nfscr->nfsc_groups[i] = cr->cr_groups[i];
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r194540 - head/sys/dev/drm

2009-06-20 Thread Daniel Eischen

On Sat, 20 Jun 2009, Robert Noland wrote:


Author: rnoland
Date: Sat Jun 20 16:45:14 2009
New Revision: 194540
URL: http://svn.freebsd.org/changeset/base/194540

Log:
 The G45 docs indicate that all G4X chips use the new framecount register.

 Intel agrees with my reading of the docs, make it so for all G4X chips.

 The new register also has a 32 bit width as opposed to 24 bits.  Fix
 things up so that the counters roll over properly.


Could this possibly fix the problem I'm seeing with the screen being
garbage after a logout from KDE 3.x (using kdm)?  Everything works
fine after logging in, but when you log out, the screen is left with
garbage/lots of vertical striping.  This only happened after upgrading
my system (and all ports) to Xorg 7.4, worked just fine before that.

agp0:  on vgapci0
agp0: detected 7932k stolen memory
agp0: aperture size is 256M
vgapci1:  mem 0xdff8-0xdfff at device  2.1 on 
pci0

--
DE
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r194542 - head/sys/rpc/rpcsec_gss

2009-06-20 Thread Rick Macklem
Author: rmacklem
Date: Sat Jun 20 17:16:29 2009
New Revision: 194542
URL: http://svn.freebsd.org/changeset/base/194542

Log:
  Delete the declaration of an unused variable so that it will build.
  
  Approved by:  rwatson (mentor)

Modified:
  head/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c

Modified: head/sys/rpc/rpcsec_gss/svc_rpcsec_gss.c
==
--- head/sys/rpc/rpcsec_gss/svc_rpcsec_gss.cSat Jun 20 17:11:07 2009
(r194541)
+++ head/sys/rpc/rpcsec_gss/svc_rpcsec_gss.cSat Jun 20 17:16:29 2009
(r194542)
@@ -429,7 +429,6 @@ rpc_gss_svc_getcred(struct svc_req *req,
struct svc_rpc_gss_cookedcred *cc;
struct svc_rpc_gss_client *client;
rpc_gss_ucred_t *uc;
-   int i;
 
if (req->rq_cred.oa_flavor != RPCSEC_GSS)
return (FALSE);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r194543 - head/sys/netatalk

2009-06-20 Thread Robert Watson
Author: rwatson
Date: Sat Jun 20 17:28:38 2009
New Revision: 194543
URL: http://svn.freebsd.org/changeset/base/194543

Log:
  Don't lock sockets around calls to mac_socket_create_mbuf() -- policies
  are now expected to acquire the socket lock if they require them.
  
  Obtained from:TrustedBSD Project

Modified:
  head/sys/netatalk/ddp_output.c

Modified: head/sys/netatalk/ddp_output.c
==
--- head/sys/netatalk/ddp_output.c  Sat Jun 20 17:16:29 2009
(r194542)
+++ head/sys/netatalk/ddp_output.c  Sat Jun 20 17:28:38 2009
(r194543)
@@ -51,9 +51,7 @@ ddp_output(struct mbuf *m, struct socket
struct ddpcb *ddp = sotoddpcb(so);
 
 #ifdef MAC
-   SOCK_LOCK(so);
mac_socket_create_mbuf(so, m);
-   SOCK_UNLOCK(so);
 #endif
 
M_PREPEND(m, sizeof(struct ddpehdr), M_DONTWAIT);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r194540 - head/sys/dev/drm

2009-06-20 Thread Andriy Gapon
on 20/06/2009 19:56 Daniel Eischen said the following:
> On Sat, 20 Jun 2009, Robert Noland wrote:
> 
>> Author: rnoland
>> Date: Sat Jun 20 16:45:14 2009
>> New Revision: 194540
>> URL: http://svn.freebsd.org/changeset/base/194540
>>
>> Log:
>>  The G45 docs indicate that all G4X chips use the new framecount
>> register.
>>
>>  Intel agrees with my reading of the docs, make it so for all G4X chips.
>>
>>  The new register also has a 32 bit width as opposed to 24 bits.  Fix
>>  things up so that the counters roll over properly.
> 
> Could this possibly fix the problem I'm seeing with the screen being
> garbage after a logout from KDE 3.x (using kdm)?  Everything works
> fine after logging in, but when you log out, the screen is left with
> garbage/lots of vertical striping.  This only happened after upgrading
> my system (and all ports) to Xorg 7.4, worked just fine before that.
> 
> agp0:  on vgapci0
> agp0: detected 7932k stolen memory
> agp0: aperture size is 256M
> vgapci1:  mem 0xdff8-0xdfff at device 
> 2.1 on pci0

I had similar symptoms. In my case this was cause X server crashing?
Do you see the same. If yes, there might be a recipe for cure.


-- 
Andriy Gapon
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r194544 - head/sys/netipx

2009-06-20 Thread Robert Watson
Author: rwatson
Date: Sat Jun 20 17:42:53 2009
New Revision: 194544
URL: http://svn.freebsd.org/changeset/base/194544

Log:
  Invoke the MAC Framework's mac_socket_create_mbuf() entry point when
  generating IPX output for raw and datagram IPX sockets.
  
  Obtained from:TrustedBSD Project

Modified:
  head/sys/netipx/ipx_usrreq.c

Modified: head/sys/netipx/ipx_usrreq.c
==
--- head/sys/netipx/ipx_usrreq.cSat Jun 20 17:28:38 2009
(r194543)
+++ head/sys/netipx/ipx_usrreq.cSat Jun 20 17:42:53 2009
(r194544)
@@ -90,6 +90,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+
 /*
  * IPX protocol implementation.
  */
@@ -577,6 +579,9 @@ ipx_send(struct socket *so, int flags, s
 * used by ipx_pcbconnect() and ipx_pcbdisconnect(), just the IPX
 * pcb lock.
 */
+#ifdef MAC
+   mac_socket_create_mbuf(so, m);
+#endif
if (nam != NULL) {
IPX_LIST_LOCK();
IPX_LOCK(ipxp);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r194545 - head/sys/netipx

2009-06-20 Thread Robert Watson
Author: rwatson
Date: Sat Jun 20 17:44:04 2009
New Revision: 194545
URL: http://svn.freebsd.org/changeset/base/194545

Log:
  Invoke the MAC Framework's mac_socket_create_mbuf() entry point when
  generating IPX output for SPX sockets.
  
  Obtained from:TrustedBSD Project

Modified:
  head/sys/netipx/spx_usrreq.c

Modified: head/sys/netipx/spx_usrreq.c
==
--- head/sys/netipx/spx_usrreq.cSat Jun 20 17:42:53 2009
(r194544)
+++ head/sys/netipx/spx_usrreq.cSat Jun 20 17:44:04 2009
(r194545)
@@ -89,6 +89,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+
 /*
  * SPX protocol implementation.
  */
@@ -813,6 +815,10 @@ send:
if (so->so_options & SO_DEBUG || traceallspxs)
spx_trace(SA_OUTPUT, cb->s_state, cb, si, 0);
 
+#ifdef MAC
+   mac_socket_create_mbuf(so, m);
+#endif
+
if (so->so_options & SO_DONTROUTE)
error = ipx_outputfl(m, NULL, IPX_ROUTETOIF);
else
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r194540 - head/sys/dev/drm

2009-06-20 Thread Andriy Gapon
on 20/06/2009 20:39 Andriy Gapon said the following:
> on 20/06/2009 19:56 Daniel Eischen said the following:
>> On Sat, 20 Jun 2009, Robert Noland wrote:
>>
>>> Author: rnoland
>>> Date: Sat Jun 20 16:45:14 2009
>>> New Revision: 194540
>>> URL: http://svn.freebsd.org/changeset/base/194540
>>>
>>> Log:
>>>  The G45 docs indicate that all G4X chips use the new framecount
>>> register.
>>>
>>>  Intel agrees with my reading of the docs, make it so for all G4X chips.
>>>
>>>  The new register also has a 32 bit width as opposed to 24 bits.  Fix
>>>  things up so that the counters roll over properly.
>> Could this possibly fix the problem I'm seeing with the screen being
>> garbage after a logout from KDE 3.x (using kdm)?  Everything works
>> fine after logging in, but when you log out, the screen is left with
>> garbage/lots of vertical striping.  This only happened after upgrading
>> my system (and all ports) to Xorg 7.4, worked just fine before that.
>>
>> agp0:  on vgapci0
>> agp0: detected 7932k stolen memory
>> agp0: aperture size is 256M
>> vgapci1:  mem 0xdff8-0xdfff at device 
>> 2.1 on pci0
> 
> I had similar symptoms. In my case this was cause X server crashing?
  ^^^ - "caused by"
> Do you see the same. If yes, there might be a recipe for cure.
^^^ - "?"
Very fat fingers today.

-- 
Andriy Gapon
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r194538 - head/sys/sys

2009-06-20 Thread Kostik Belousov
On Sat, Jun 20, 2009 at 04:39:25PM +, Ed Schouten wrote:
> Author: ed
> Date: Sat Jun 20 16:39:25 2009
> New Revision: 194538
> URL: http://svn.freebsd.org/changeset/base/194538
> 
> Log:
>   Add placeholder to prevent reuse of privilege 254.
>   
>   Requested by:   rwatson
> 
> Modified:
>   head/sys/sys/priv.h
> 
> Modified: head/sys/sys/priv.h
> ==
> --- head/sys/sys/priv.h   Sat Jun 20 16:37:24 2009(r194537)
> +++ head/sys/sys/priv.h   Sat Jun 20 16:39:25 2009(r194538)
> @@ -211,6 +211,7 @@
>  #define  PRIV_TTY_DRAINWAIT  251 /* Set tty drain wait time. */
>  #define  PRIV_TTY_DTRWAIT252 /* Set DTR wait on tty. */
>  #define  PRIV_TTY_EXCLUSIVE  253 /* Override tty exclusive flag. 
> */
> +#define  _PRIV_TTY_PRISON254 /* Removed. */
>  #define  PRIV_TTY_STI255 /* Simulate input on another 
> tty. */
>  #define  PRIV_TTY_SETA   256 /* Set tty termios structure. */
>  
Names starting with two underscores or underscore and upper-case letter
are reserved to the C language implementation. We should not use it
in the code.


pgpWEHMreOU2F.pgp
Description: PGP signature


svn commit: r194546 - head/tools/regression/netipx/spxloopback

2009-06-20 Thread Robert Watson
Author: rwatson
Date: Sat Jun 20 18:13:20 2009
New Revision: 194546
URL: http://svn.freebsd.org/changeset/base/194546

Log:
  Up the scale of the SPX loopback check a bit: use much larger data sizes
  so that we need to do segmentation.

Modified:
  head/tools/regression/netipx/spxloopback/spxloopback.c

Modified: head/tools/regression/netipx/spxloopback/spxloopback.c
==
--- head/tools/regression/netipx/spxloopback/spxloopback.c  Sat Jun 20 
17:44:04 2009(r194545)
+++ head/tools/regression/netipx/spxloopback/spxloopback.c  Sat Jun 20 
18:13:20 2009(r194546)
@@ -46,11 +46,7 @@
 #include 
 
 #defineIPX_ENDPOINT"0xbebe.1.0x8a13"
-#definePACKETLEN   128
-
-#if 0
-#defineSPX_SUPPORTS_SENDTO_WITH_CONNECT
-#endif
+#definePACKETLEN   16 * (1024 * 1024)
 
 static void
 packet_fill(u_char *packet)
@@ -62,61 +58,40 @@ packet_fill(u_char *packet)
 }
 
 static int
-packet_check(u_char *packet)
+packet_check(u_char *packet, size_t totlen, ssize_t len)
 {
-   int i;
+   size_t i;
 
-   for (i = 0; i < PACKETLEN; i++) {
+   for (i = totlen; i < totlen + len; i++) {
if (packet[i] != (i & 0xff))
return (-1);
}
return (0);
 }
 
-#ifdef SPX_SUPPORTS_SENDTO_WITH_CONNECT
-static void
-my_sendto(int sock, const char *who, pid_t pid, struct sockaddr *sa,
-socklen_t sa_len)
-{
-   u_char packet[PACKETLEN];
-   ssize_t len;
-   int error;
-
-   packet_fill(packet);
-   len = sendto(sock, packet, sizeof(packet), 0, sa, sa_len);
-   if (len < 0) {
-   error = errno;
-   (void)kill(pid, SIGTERM);
-   errno = error;
-   err(-1, "%s: sendto()", who);
-   }
-   if (len != sizeof(packet)) {
-   (void)kill(pid, SIGTERM);
-   errx(-1, "%s: sendto(): short send (%d length, %d sent)",
-   who, sizeof(packet), len);
-   }
-}
-#endif
-
 static void
 my_send(int sock, const char *who, pid_t pid)
 {
u_char packet[PACKETLEN];
ssize_t len;
+   size_t totlen;
int error;
 
+   totlen = 0;
packet_fill(packet);
-   len = send(sock, packet, sizeof(packet), 0);
-   if (len < 0) {
-   error = errno;
-   (void)kill(pid, SIGTERM);
-   errno = error;
-   err(-1, "%s: send()", who);
-   }
-   if (len != sizeof(packet)) {
-   (void)kill(pid, SIGTERM);
-   errx(-1, "%s: send(): short send (%d length, %d sent)", who,
-   sizeof(packet), len);
+   while (totlen < PACKETLEN) {
+   len = send(sock, packet + totlen, PACKETLEN - totlen, 0);
+   if (len < 0) {
+   error = errno;
+   (void)kill(pid, SIGTERM);
+   errno = error;
+   err(-1, "%s: send()", who);
+   }
+   if (len == 0) {
+   (void)kill(pid, SIGTERM);
+   errx(-1, "%s: send(): EOF", who);
+   }
+   totlen += len;
}
 }
 
@@ -125,24 +100,28 @@ my_recv(int sock, const char *who, pid_t
 {
u_char packet[PACKETLEN];
ssize_t len;
+   size_t totlen;
int error;
 
+   totlen = 0;
bzero(packet, sizeof(packet));
-   len = recv(sock, packet, sizeof(packet), 0);
-   if (len < 0) {
-   errno = error;
-   (void)kill(pid, SIGTERM);
-   errno = error;
-   err(-1, "%s: recv()", who);
-   }
-   if (len != sizeof(packet)) {
-   (void)kill(pid, SIGTERM);
-   errx(-1, "%s: recv(): got %d expected %d", who, len,
-   sizeof(packet));
-   }
-   if (packet_check(packet) < 0) {
-   (void)kill(pid, SIGTERM);
-   errx(-1, "%s: recv(): got bad data", who);
+   while (totlen < PACKETLEN) {
+   len = recv(sock, packet + totlen, sizeof(packet) - totlen, 0);
+   if (len < 0) {
+   errno = error;
+   (void)kill(pid, SIGTERM);
+   errno = error;
+   err(-1, "%s: recv()", who);
+   }
+   if (len == 0) {
+   (void)kill(pid, SIGTERM);
+   errx(-1, "%s: recv(): EOF", who);
+   }
+   if (packet_check(packet, totlen, len) < 0) {
+   (void)kill(pid, SIGTERM);
+   errx(-1, "%s: recv(): got bad data", who);
+   }
+   totlen += len;
}
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freeb

svn commit: r194547 - head/sys/netipx

2009-06-20 Thread Robert Watson
Author: rwatson
Date: Sat Jun 20 18:24:25 2009
New Revision: 194547
URL: http://svn.freebsd.org/changeset/base/194547

Log:
  Rework SPX segment reassembly, which was originally based on our TCP
  reassembly but failed to be modernized over time:
  
  - Use queue(9).
  - Specifically allocate queue entries of type M_SPXREASSQ to point at
member mbufs, rather than casting mbuf data to 'spx_q'.
  - Maintain the mbuf pointer as part of the queue entry so that we can
later free the mbuf without using dtom().

Modified:
  head/sys/netipx/spx.h
  head/sys/netipx/spx_reass.c
  head/sys/netipx/spx_usrreq.c
  head/sys/netipx/spx_var.h

Modified: head/sys/netipx/spx.h
==
--- head/sys/netipx/spx.h   Sat Jun 20 18:13:20 2009(r194546)
+++ head/sys/netipx/spx.h   Sat Jun 20 18:24:25 2009(r194547)
@@ -91,8 +91,9 @@ struct spx {
struct spxhdr   si_s;
 } __packed;
 struct spx_q {
-   struct spx_q*si_next;
-   struct spx_q*si_prev;
+   struct mbuf *sq_msi;
+   struct spx  *sq_si;
+   LIST_ENTRY(spx_q)sq_entry;
 };
 #define SI(x)  ((struct spx *)x)
 #define si_sum si_i.ipx_sum
@@ -114,7 +115,7 @@ struct spx_q {
  * SPX control block, one per connection
  */
 struct spxpcb {
-   struct  spx_q   s_q;/* queue for out-of-order receipt */
+   LIST_HEAD(, spx_q)  s_q;/* queue for out-of-order receipt */
struct  ipxpcb  *s_ipxpcb;  /* backpointer to internet pcb */
u_char  s_state;
u_char  s_flags;

Modified: head/sys/netipx/spx_reass.c
==
--- head/sys/netipx/spx_reass.c Sat Jun 20 18:13:20 2009(r194546)
+++ head/sys/netipx/spx_reass.c Sat Jun 20 18:24:25 2009(r194547)
@@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -92,24 +93,7 @@ __FBSDID("$FreeBSD$");
 static int spx_use_delack = 0;
 static int spxrexmtthresh = 3;
 
-static __inline void
-spx_insque(struct spx_q *element, struct spx_q *head)
-{
-
-   element->si_next = head->si_next;
-   element->si_prev = head;
-   head->si_next = element;
-   element->si_next->si_prev = element;
-}
- 
-static void
-spx_remque(struct spx_q *element)
-{
-
-   element->si_next->si_prev = element->si_prev;
-   element->si_prev->si_next = element->si_next;
-   element->si_prev = NULL;
-}
+MALLOC_DEFINE(M_SPXREASSQ, "spxreassq", "SPX reassembly queue entry");
 
 /*
  * Flesh pending queued segments on SPX close.
@@ -117,15 +101,12 @@ spx_remque(struct spx_q *element)
 void
 spx_reass_flush(struct spxpcb *cb)
 {
-   struct spx_q *s;
-   struct mbuf *m;
+   struct spx_q *q;
 
-   s = cb->s_q.si_next;
-   while (s != &(cb->s_q)) {
-   s = s->si_next;
-   spx_remque(s);
-   m = dtom(s);
-   m_freem(m);
+   while ((q = LIST_FIRST(&cb->s_q)) != NULL) {
+   LIST_REMOVE(q, sq_entry);
+   m_freem(q->sq_msi);
+   free(q, M_SPXREASSQ);
}
 }
 
@@ -136,7 +117,7 @@ void
 spx_reass_init(struct spxpcb *cb)
 {
 
-   cb->s_q.si_next = cb->s_q.si_prev = &cb->s_q;
+   LIST_INIT(&cb->s_q);
 }
 
 /*
@@ -145,9 +126,9 @@ spx_reass_init(struct spxpcb *cb)
  * suppresses duplicates.
  */
 int
-spx_reass(struct spxpcb *cb, struct spx *si)
+spx_reass(struct spxpcb *cb, struct mbuf *msi, struct spx *si)
 {
-   struct spx_q *q;
+   struct spx_q *q, *q_new, *q_temp;
struct mbuf *m;
struct socket *so = cb->s_ipxpcb->ipxp_socket;
char packetp = cb->s_flags & SF_HI;
@@ -352,17 +333,26 @@ update_window:
 * Loop through all packets queued up to insert in appropriate
 * sequence.
 */
-   for (q = cb->s_q.si_next; q != &cb->s_q; q = q->si_next) {
-   if (si->si_seq == SI(q)->si_seq) {
+   q_new = malloc(sizeof(*q_new), M_SPXREASSQ, M_NOWAIT | M_ZERO);
+   if (q_new == NULL)
+   return (1);
+   q_new->sq_si = si;
+   q_new->sq_msi = msi;
+   LIST_FOREACH(q, &cb->s_q, sq_entry) {
+   if (si->si_seq == q->sq_si->si_seq) {
+   free(q_new, M_SPXREASSQ);
spxstat.spxs_rcvduppack++;
return (1);
}
-   if (SSEQ_LT(si->si_seq, SI(q)->si_seq)) {
+   if (SSEQ_LT(si->si_seq, q->sq_si->si_seq)) {
spxstat.spxs_rcvoopack++;
break;
}
}
-   spx_insque((struct spx_q *)si, q->si_prev);
+   if (q != NULL)
+   LIST_INSERT_BEFORE(q, q_new, sq_entry);
+   else
+   LIST_INSERT_HEAD(&cb->s_q, q_new, sq_entry);
 
/*
 * If this packet is urgent, inform process
@@ -381,25 +371,31 @@ pres

svn commit: r194548 - head/usr.bin/catman

2009-06-20 Thread Brooks Davis
Author: brooks
Date: Sat Jun 20 18:24:29 2009
New Revision: 194548
URL: http://svn.freebsd.org/changeset/base/194548

Log:
  Restore the check against running as root that I accidentally removed in
  r194493.

Modified:
  head/usr.bin/catman/catman.c

Modified: head/usr.bin/catman/catman.c
==
--- head/usr.bin/catman/catman.cSat Jun 20 18:24:25 2009
(r194547)
+++ head/usr.bin/catman/catman.cSat Jun 20 18:24:29 2009
(r194548)
@@ -91,6 +91,7 @@ static const char *locale_device[] = {
 #defineGZCAT_CMD   "z"
 enum Ziptype {NONE, BZIP, GZIP};
 
+static uid_t uid;
 static int starting_dir;
 static char tmp_file[MAXPATHLEN];
 struct stat test_st;
@@ -742,6 +743,14 @@ main(int argc, char **argv)
 {
int opt;
 
+   if ((uid = getuid()) == 0) {
+   fprintf(stderr, "don't run %s as root, use:\n   echo", argv[0]);
+   for (optind = 0; optind < argc; optind++) {
+   fprintf(stderr, " %s", argv[optind]);
+   }
+   fprintf(stderr, " | nice -5 su -m man\n");
+   exit(1);
+   }
while ((opt = getopt(argc, argv, "vnfLrh")) != -1) {
switch (opt) {
case 'f':
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r194549 - head/sys/sys

2009-06-20 Thread Robert Watson
Author: rwatson
Date: Sat Jun 20 18:27:19 2009
New Revision: 194549
URL: http://svn.freebsd.org/changeset/base/194549

Log:
  Remove definition of dtom(), which converted a data pointer into a
  pointer to the containing mbuf.  This eliminates a strong assumption
  about the layout of network buffer memory, giving us greater
  flexibility to revise mbuf semantics in the future.

Modified:
  head/sys/sys/mbuf.h

Modified: head/sys/sys/mbuf.h
==
--- head/sys/sys/mbuf.h Sat Jun 20 18:24:29 2009(r194548)
+++ head/sys/sys/mbuf.h Sat Jun 20 18:27:19 2009(r194549)
@@ -60,12 +60,12 @@
 
 #ifdef _KERNEL
 /*-
- * Macros for type conversion:
+ * Macro for type conversion: convert mbuf pointer to data pointer of correct
+ * type:
+ *
  * mtod(m, t)  -- Convert mbuf pointer to data pointer of correct type.
- * dtom(x) -- Convert data pointer within mbuf to mbuf pointer (XXX).
  */
 #definemtod(m, t)  ((t)((m)->m_data))
-#definedtom(x) ((struct mbuf *)((intptr_t)(x) & ~(MSIZE-1)))
 
 /*
  * Argument structure passed to UMA routines during mbuf and packet
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r194493 - head/usr.bin/catman

2009-06-20 Thread Brooks Davis
On Sat, Jun 20, 2009 at 01:57:07PM +1000, Bruce Evans wrote:
> On Fri, 19 Jun 2009, Brooks Davis wrote:
> 
>> Log:
>>  When checking if we can write to a file, use access() instead of a
>>  manual permission check based on stat output.  Also, get rid of the
>>  executability check since it is not used.
> 
> This seems to add some security holes.  From "man assert | col -bx":
>
> %%%
> SECURITY CONSIDERATIONS
>  The access() system call is a potential security hole due to race condi-
>  tions and should never be used.  Set-user-ID and set-group-ID applica-
>  tions should restore the effective user or group ID, and perform actions
>  directly rather than use access() to simulate access checks for the real
>  user or group ID.The eaccess() system call likewise may be 
> subject to
>  races if used inappropriately.
> %%%

The code I replaced was effectivly a hand rolled version of access() based
on examining stat(1) results.  I think both are equivalently wrong from
a security perspective.

> catman isn't setuid in FreeBSD, so this doesn't exactly apply.  I think it
> does manual permission checking so as to support it being setuid on other
> systems.  It seems wrong to remove this support, provided it is actually
> correct.
> 
>> Modified: head/usr.bin/catman/catman.c
>> ==
>> --- head/usr.bin/catman/catman.c Fri Jun 19 15:31:40 2009
>> (r194492)
>> +++ head/usr.bin/catman/catman.c Fri Jun 19 15:52:35 2009
>> (r194493)
>> @@ -759,14 +742,6 @@ main(int argc, char **argv)
>> {
>>  int opt;
>> 
>> -if ((uid = getuid()) == 0) {
>> -fprintf(stderr, "don't run %s as root, use:\n   echo", argv[0]);
>> -for (optind = 0; optind < argc; optind++) {
>> -fprintf(stderr, " %s", argv[optind]);
>> -}
>> -fprintf(stderr, " | nice -5 su -m man\n");
>> -exit(1);
>> -}
>>  while ((opt = getopt(argc, argv, "vnfLrh")) != -1) {
>>  switch (opt) {
>>  case 'f':
> 
> Surely it is wrong to remove the enforcement of not running as root?

Yes that was an error, I've restored that check.  Thanks for the catch.

-- Brooks

> FreeBSD seems to have removed all setuidness for saving of cat pages,
> resulting in saving of cat pages not actually working unless they
> are created by user man, either by user man viewing man pages or
> by su'ing to man to run catman as used to be commanded above, and
> then not subsequently clobbered by user root, either by user root
> viewing modified man pages or by running catman as root as used to
> be disallowed above.  I see the following brokenness starting with
> an empty /usr/share/man/cat1:
> - "man cp" as user bde doesn't save the cat page
> - "man cp" as user man saves the cat page, with correct ownwership "man"
>   After removing the cat page:
> - "man cp" as user root saves the cat page, with incorrect ownwership "root"
>   After changing the man page:
> - "man cp" as user bde displays the new man page but cannot save it
> - "man cp" as either user man or (of course) user root displays the new
>   man page and saves it.  Not too bad -- man(1) can replace the cat page
>   owned by root because user man owns the directory.  The mechanism is
>   that man(1) does a blind rename(2) of a temporary cat file.
> 
> man(1) was last setuid in 2002.  The log message for making it non-setuid
> explains why catman needs to be run to partially recover lost functionality:
> 
> %%%
> RCS file: /home/ncvs/src/gnu/usr.bin/man/man/Makefile,v
> Working file: Makefile
> head: 1.33
> ...
> 
> revision 1.33
> date: 2002/01/15 14:11:05;  author: ru;  state: Exp;  lines: +1 -4
> branches:  1.33.30;  1.33.32;  1.33.34;
> Do not install man(1) setuid ``man''.
> 
> The catpaging and setuidness features of man(1) combined make
> it vulnerable to a number of security attacks.  Specifically,
> it was possible to overwrite system catpages with arbitrarily
> contents by either setting up a symlink to a directory holding
> system catpages, or by writing custom -mdoc or -man groff(1)
> macro packages and setting up GROFF_TMAC_PATH in environment
> to point to them.  (See PR below for details).
> 
> This means man(1) can no longer create system catpages on a
> regular user's behalf.  (It is still able to if the user has
> write permissions to the directory holding catpages, e.g.,
> user's own manpages, or if the running user is ``root''.)
> 
> To create and install catpages during ``make world'', please
> set MANBUILDCAT=YES in /etc/make.conf.  To rebuild catpages
> on a weekly basis, please set weekly_catman_enable="YES" in
> /etc/periodic.conf.
> 
> PR:   bin/32791
> 
> %%%
> 
> I've never seen a machine that actually runs catman.  I remove the
> cat directories on all my machines to prevent any saving of cat
> pages.  Al

svn commit: r194552 - head/sys/i386/ibcs2

2009-06-20 Thread Brooks Davis
Author: brooks
Date: Sat Jun 20 18:52:02 2009
New Revision: 194552
URL: http://svn.freebsd.org/changeset/base/194552

Log:
  Use NGROUPS instead of NGROUPS_MAX as the limits on setgroups and
  getgroups for ibcs emulation.  It seems vanishingly likely any
  programs will actually be affected since they probably assume a much
  lower value and use a static array size.

Modified:
  head/sys/i386/ibcs2/ibcs2_misc.c

Modified: head/sys/i386/ibcs2/ibcs2_misc.c
==
--- head/sys/i386/ibcs2/ibcs2_misc.cSat Jun 20 18:39:18 2009
(r194551)
+++ head/sys/i386/ibcs2/ibcs2_misc.cSat Jun 20 18:52:02 2009
(r194552)
@@ -664,7 +664,7 @@ ibcs2_getgroups(td, uap)
 
if (uap->gidsetsize < 0)
return (EINVAL);
-   ngrp = MIN(uap->gidsetsize, NGROUPS_MAX);
+   ngrp = MIN(uap->gidsetsize, NGROUPS);
gp = malloc(ngrp * sizeof(*gp), M_TEMP, M_WAITOK);
error = kern_getgroups(td, &ngrp, gp);
if (error)
@@ -692,7 +692,7 @@ ibcs2_setgroups(td, uap)
gid_t *gp;
int error, i;
 
-   if (uap->gidsetsize < 0 || uap->gidsetsize > NGROUPS_MAX)
+   if (uap->gidsetsize < 0 || uap->gidsetsize > NGROUPS)
return (EINVAL);
if (uap->gidsetsize && uap->gidset == NULL)
return (EINVAL);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r194553 - in head/sys/dev/cxgb: . sys

2009-06-20 Thread Kip Macy
Author: kmacy
Date: Sat Jun 20 18:57:14 2009
New Revision: 194553
URL: http://svn.freebsd.org/changeset/base/194553

Log:
  - fix dma map handling for !x86 case
  - fix allocation failure handing in refill_fl

Modified:
  head/sys/dev/cxgb/cxgb_sge.c
  head/sys/dev/cxgb/sys/mvec.h
  head/sys/dev/cxgb/sys/uipc_mvec.c

Modified: head/sys/dev/cxgb/cxgb_sge.c
==
--- head/sys/dev/cxgb/cxgb_sge.cSat Jun 20 18:52:02 2009
(r194552)
+++ head/sys/dev/cxgb/cxgb_sge.cSat Jun 20 18:57:14 2009
(r194553)
@@ -714,6 +714,7 @@ refill_fl(adapter_t *sc, struct sge_fl *
if (q->zone = zone_pack)
uma_zfree(q->zone, cl);
m_free(m);
+   goto done;
}
 #else
cb_arg.seg.ds_addr = pmap_kextract((vm_offset_t)cl);
@@ -1157,7 +1158,7 @@ retry:
m0 = *m;
pktlen = m0->m_pkthdr.len;
 #if defined(__i386__) || defined(__amd64__)
-   if (busdma_map_sg_collapse(txq, txsd, m, segs, nsegs) == 0) {
+   if (busdma_map_sg_collapse(txq, txsd->map, m, segs, nsegs) == 0) {
goto done;
} else
 #endif
@@ -1411,11 +1412,11 @@ t3_encap(struct sge_qset *qs, struct mbu
tso_info = V_LSO_MSS(m0->m_pkthdr.tso_segsz);
 #endif
if (m0->m_nextpkt != NULL) {
-   busdma_map_sg_vec(txq, txsd, m0, segs, &nsegs);
+   busdma_map_sg_vec(txq, txsd->map, m0, segs, &nsegs);
ndesc = 1;
mlen = 0;
} else {
-   if ((err = busdma_map_sg_collapse(txq, txsd, &m0, segs, 
&nsegs))) {
+   if ((err = busdma_map_sg_collapse(txq, txsd->map, &m0, segs, 
&nsegs))) {
if (cxgb_debug)
printf("failed ... err=%d\n", err);
return (err);

Modified: head/sys/dev/cxgb/sys/mvec.h
==
--- head/sys/dev/cxgb/sys/mvec.hSat Jun 20 18:52:02 2009
(r194552)
+++ head/sys/dev/cxgb/sys/mvec.hSat Jun 20 18:57:14 2009
(r194553)
@@ -43,7 +43,7 @@
 #define m_ulp_mode m_pkthdr.tso_segsz  /* upper level protocol */
 
 static __inline void
-busdma_map_mbuf_fast(struct sge_txq *txq, struct tx_sw_desc *txsd,
+busdma_map_mbuf_fast(struct sge_txq *txq, bus_dmamap_t map,
 struct mbuf *m, bus_dma_segment_t *seg)
 {
 #if defined(__i386__) || defined(__amd64__)
@@ -52,14 +52,15 @@ busdma_map_mbuf_fast(struct sge_txq *txq
 #else
int nsegstmp;
 
-   bus_dmamap_load_mbuf_sg(txq->entry_tag, txsd->map, m, seg,
+   bus_dmamap_load_mbuf_sg(txq->entry_tag, map, m, seg,
&nsegstmp, 0);
 #endif
 }
 
-int busdma_map_sg_collapse(struct sge_txq *txq, struct tx_sw_desc *txsd,
+int busdma_map_sg_collapse(struct sge_txq *txq, bus_dmamap_t map,
 struct mbuf **m, bus_dma_segment_t *segs, int *nsegs);
-void busdma_map_sg_vec(struct sge_txq *txq, struct tx_sw_desc *txsd, struct 
mbuf *m, bus_dma_segment_t *segs, int *nsegs);
+void busdma_map_sg_vec(struct sge_txq *txq, bus_dmamap_t map,
+struct mbuf *m, bus_dma_segment_t *segs, int *nsegs);
 static __inline int
 busdma_map_sgl(bus_dma_segment_t *vsegs, bus_dma_segment_t *segs, int count) 
 {

Modified: head/sys/dev/cxgb/sys/uipc_mvec.c
==
--- head/sys/dev/cxgb/sys/uipc_mvec.c   Sat Jun 20 18:52:02 2009
(r194552)
+++ head/sys/dev/cxgb/sys/uipc_mvec.c   Sat Jun 20 18:57:14 2009
(r194553)
@@ -59,7 +59,7 @@ __FBSDID("$FreeBSD$");
 #endif
 
 int
-busdma_map_sg_collapse(struct sge_txq *txq, struct tx_sw_desc *txsd,
+busdma_map_sg_collapse(struct sge_txq *txq, bus_dmamap_t map,
struct mbuf **m, bus_dma_segment_t *segs, int *nsegs)
 {
struct mbuf *n = *m;
@@ -73,7 +73,7 @@ retry:
psegs = segs;
seg_count = 0;
if (n->m_next == NULL) {
-   busdma_map_mbuf_fast(txq, txsd, n, segs);
+   busdma_map_mbuf_fast(txq, map, n, segs);
*nsegs = 1;
return (0);
}
@@ -84,13 +84,13 @@ retry:
 */
if (__predict_true(n->m_len != 0)) {
seg_count++;
-   busdma_map_mbuf_fast(txq, txsd, n, psegs);
+   busdma_map_mbuf_fast(txq, map, n, psegs);
psegs++;
}
n = n->m_next;
}
 #else
-   err = bus_dmamap_load_mbuf_sg(txq->entry_tag, txsd->map, m, segs,
+   err = bus_dmamap_load_mbuf_sg(txq->entry_tag, map, m, segs,
&seg_count, 0);
 #endif 
if (seg_count == 0) {
@@ -122,11 +122,11 @@ err_out:  
 }
 
 void
-busdma_map_sg_vec(struct sge_txq *txq, struct tx_sw_desc *txsd,
+busdma_map_sg_vec(struct sge_txq *txq, bus_dmamap_t m

Re: svn commit: r194540 - head/sys/dev/drm

2009-06-20 Thread Daniel Eischen

On Sat, 20 Jun 2009, Andriy Gapon wrote:


on 20/06/2009 19:56 Daniel Eischen said the following:

On Sat, 20 Jun 2009, Robert Noland wrote:


Author: rnoland
Date: Sat Jun 20 16:45:14 2009
New Revision: 194540
URL: http://svn.freebsd.org/changeset/base/194540

Log:
 The G45 docs indicate that all G4X chips use the new framecount
register.

 Intel agrees with my reading of the docs, make it so for all G4X chips.

 The new register also has a 32 bit width as opposed to 24 bits.  Fix
 things up so that the counters roll over properly.


Could this possibly fix the problem I'm seeing with the screen being
garbage after a logout from KDE 3.x (using kdm)?  Everything works
fine after logging in, but when you log out, the screen is left with
garbage/lots of vertical striping.  This only happened after upgrading
my system (and all ports) to Xorg 7.4, worked just fine before that.

agp0:  on vgapci0
agp0: detected 7932k stolen memory
agp0: aperture size is 256M
vgapci1:  mem 0xdff8-0xdfff at device
2.1 on pci0


I had similar symptoms. In my case this was cause X server crashing?
Do you see the same. If yes, there might be a recipe for cure.


Possibly, I don't recall if the X server crashed after logout.
Ctrl-Alt-F1, then Ctrl-Alt-Del to reboot was the only way to
recover, sometimes a hard reset was required.  I guess I'll
have to try this change to see if it resolves my problem.

--
DE
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r194554 - head/sys/dev/cxgb

2009-06-20 Thread Kip Macy
Author: kmacy
Date: Sat Jun 20 19:09:41 2009
New Revision: 194554
URL: http://svn.freebsd.org/changeset/base/194554

Log:
  fix typo in conditional

Modified:
  head/sys/dev/cxgb/cxgb_sge.c

Modified: head/sys/dev/cxgb/cxgb_sge.c
==
--- head/sys/dev/cxgb/cxgb_sge.cSat Jun 20 18:57:14 2009
(r194553)
+++ head/sys/dev/cxgb/cxgb_sge.cSat Jun 20 19:09:41 2009
(r194554)
@@ -711,7 +711,7 @@ refill_fl(adapter_t *sc, struct sge_fl *
cl, q->buf_size, refill_fl_cb, &cb_arg, 0);

if (err != 0 || cb_arg.error) {
-   if (q->zone = zone_pack)
+   if (q->zone == zone_pack)
uma_zfree(q->zone, cl);
m_free(m);
goto done;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r194540 - head/sys/dev/drm

2009-06-20 Thread Robert Noland
On Sat, 2009-06-20 at 12:56 -0400, Daniel Eischen wrote:
> On Sat, 20 Jun 2009, Robert Noland wrote:
> 
> > Author: rnoland
> > Date: Sat Jun 20 16:45:14 2009
> > New Revision: 194540
> > URL: http://svn.freebsd.org/changeset/base/194540
> >
> > Log:
> >  The G45 docs indicate that all G4X chips use the new framecount register.
> >
> >  Intel agrees with my reading of the docs, make it so for all G4X chips.
> >
> >  The new register also has a 32 bit width as opposed to 24 bits.  Fix
> >  things up so that the counters roll over properly.
> 
> Could this possibly fix the problem I'm seeing with the screen being
> garbage after a logout from KDE 3.x (using kdm)?  Everything works
> fine after logging in, but when you log out, the screen is left with
> garbage/lots of vertical striping.  This only happened after upgrading
> my system (and all ports) to Xorg 7.4, worked just fine before that.
> 
> agp0:  on vgapci0
> agp0: detected 7932k stolen memory
> agp0: aperture size is 256M
> vgapci1:  mem 0xdff8-0xdfff at device  2.1 on 
> pci0

No, this only change only effects g45 chips, which would have been
incorrectly handling the hardware vblank counter.  It will have no
impact on 945.  I'm trying to pull changes that are definite wins from
my Intel branch right now.  I don't think that I have seen the symptoms
that you describe on my 945, except when it is resuming from suspend.  I
do only run gnome on it though, it is far too slow to do kde as well...
I'm trying to fix up the interrupt handling in a less invasive way than
I did previously, but even that should only effect 965+ with msi
enabled.

robert.

-- 
Robert Noland 
FreeBSD


signature.asc
Description: This is a digitally signed message part


svn commit: r194555 - head/usr.sbin/getpmac

2009-06-20 Thread Robert Watson
Author: rwatson
Date: Sat Jun 20 20:22:11 2009
New Revision: 194555
URL: http://svn.freebsd.org/changeset/base/194555

Log:
  If the label being printed by getpmac(8) is empty, then don't print a
  carriage return.
  
  Obtained from:TrustedBSD Project
  MFC after:3 days

Modified:
  head/usr.sbin/getpmac/getpmac.c

Modified: head/usr.sbin/getpmac/getpmac.c
==
--- head/usr.sbin/getpmac/getpmac.c Sat Jun 20 19:09:41 2009
(r194554)
+++ head/usr.sbin/getpmac/getpmac.c Sat Jun 20 20:22:11 2009
(r194555)
@@ -119,7 +119,8 @@ main(int argc, char *argv[])
exit(EX_DATAERR);
}
 
-   printf("%s\n", string);
+   if (strlen(string) > 0)
+   printf("%s\n", string);

mac_free(label);
free(string);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r194540 - head/sys/dev/drm

2009-06-20 Thread Daniel Eischen

On Sat, 20 Jun 2009, Robert Noland wrote:


On Sat, 2009-06-20 at 12:56 -0400, Daniel Eischen wrote:

On Sat, 20 Jun 2009, Robert Noland wrote:


Author: rnoland
Date: Sat Jun 20 16:45:14 2009
New Revision: 194540
URL: http://svn.freebsd.org/changeset/base/194540

Log:
 The G45 docs indicate that all G4X chips use the new framecount register.

 Intel agrees with my reading of the docs, make it so for all G4X chips.

 The new register also has a 32 bit width as opposed to 24 bits.  Fix
 things up so that the counters roll over properly.


Could this possibly fix the problem I'm seeing with the screen being
garbage after a logout from KDE 3.x (using kdm)?  Everything works
fine after logging in, but when you log out, the screen is left with
garbage/lots of vertical striping.  This only happened after upgrading
my system (and all ports) to Xorg 7.4, worked just fine before that.

agp0:  on vgapci0
agp0: detected 7932k stolen memory
agp0: aperture size is 256M
vgapci1:  mem 0xdff8-0xdfff at device  2.1 on 
pci0


No, this only change only effects g45 chips, which would have been
incorrectly handling the hardware vblank counter.  It will have no
impact on 945.  I'm trying to pull changes that are definite wins from
my Intel branch right now.  I don't think that I have seen the symptoms
that you describe on my 945, except when it is resuming from suspend.  I
do only run gnome on it though, it is far too slow to do kde as well...
I'm trying to fix up the interrupt handling in a less invasive way than
I did previously, but even that should only effect 965+ with msi
enabled.


I have not tried GNOME, but mine does work fine with plain old xdm
and twm.  It has been happily running for year(s) with previous
Xorg/KDE and drm.

--
DE
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r194556 - head/sys/kern

2009-06-20 Thread Brooks Davis
Author: brooks
Date: Sat Jun 20 20:29:21 2009
New Revision: 194556
URL: http://svn.freebsd.org/changeset/base/194556

Log:
  Change crsetgroups_locked() (called by crsetgroups()) to sort the
  supplemental groups using insertion sort.  Use this property in
  groupmember() to let us use a binary search instead of the previous
  linear search.

Modified:
  head/sys/kern/kern_prot.c

Modified: head/sys/kern/kern_prot.c
==
--- head/sys/kern/kern_prot.c   Sat Jun 20 20:22:11 2009(r194555)
+++ head/sys/kern/kern_prot.c   Sat Jun 20 20:29:21 2009(r194556)
@@ -86,7 +86,6 @@ static void crextend(struct ucred *cr, i
 static void crsetgroups_locked(struct ucred *cr, int ngrp,
 gid_t *groups);
 
-
 #ifndef _SYS_SYSPROTO_H_
 struct getpid_args {
int dummy;
@@ -1248,13 +1247,30 @@ __setugid(struct thread *td, struct __se
 int
 groupmember(gid_t gid, struct ucred *cred)
 {
-   register gid_t *gp;
-   gid_t *egp;
+   int l;
+   int h;
+   int m;
+
+   if (cred->cr_groups[0] == gid)
+   return(1);
+
+   /*
+* If gid was not our primary group, perform a binary search
+* of the supplemental groups.  This is possible because we
+* sort the groups in crsetgroups().
+*/
+   l = 1;
+   h = cred->cr_ngroups;
+   while (l < h) {
+   m = l + ((h - l) / 2);
+   if (cred->cr_groups[m] < gid)
+   l = m + 1; 
+   else
+   h = m; 
+   }
+   if ((l < cred->cr_ngroups) && (cred->cr_groups[l] == gid))
+   return (1);
 
-   egp = &(cred->cr_groups[cred->cr_ngroups]);
-   for (gp = cred->cr_groups; gp < egp; gp++)
-   if (*gp == gid)
-   return (1);
return (0);
 }
 
@@ -1986,18 +2002,37 @@ crextend(struct ucred *cr, int n)
 }
 
 /*
- * Copy groups in to a credential, preserving any necessicary invariants
- * (i.e. sorting in the future).  crextend() must have been called
- * before hand to ensure sufficient space is available.  If 
+ * Copy groups in to a credential, preserving any necessary invariants.
+ * Currently this includes the sorting of all supplemental gids.
+ * crextend() must have been called before hand to ensure sufficient
+ * space is available.
  */
 static void
 crsetgroups_locked(struct ucred *cr, int ngrp, gid_t *groups)
 {
+   int i;
+   int j;
+   gid_t g;

KASSERT(cr->cr_agroups >= ngrp, ("cr_ngroups is too small"));
 
bcopy(groups, cr->cr_groups, ngrp * sizeof(gid_t));
cr->cr_ngroups = ngrp;
+
+   /*
+* Sort all groups except cr_groups[0] to allow groupmember to
+* perform a binary search.
+*
+* XXX: If large numbers of groups become common this should
+* be replaced with shell sort like linux uses or possibly
+* heap sort.
+*/
+   for (i = 2; i < ngrp; i++) {
+   g = cr->cr_groups[i];
+   for (j = i-1; j >= 1 && g < cr->cr_groups[j]; j--)
+   cr->cr_groups[j + 1] = cr->cr_groups[j];
+   cr->cr_groups[j + 1] = g;
+   }
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r194558 - head/tools/tools/tinybsd

2009-06-20 Thread Remko Lodder
Author: remko
Date: Sat Jun 20 20:35:50 2009
New Revision: 194558
URL: http://svn.freebsd.org/changeset/base/194558

Log:
  Add architecture support for TinyBSD
  
  PR:   135301
  Submitted by: Olivier Cochard-Labbe 
  Reviewed by:  Jean Milanez Melo  
(maintainer)
  Approved by:  imp (mentor, implicit)
  MFC after:1 week

Modified:
  head/tools/tools/tinybsd/tinybsd

Modified: head/tools/tools/tinybsd/tinybsd
==
--- head/tools/tools/tinybsd/tinybsdSat Jun 20 20:35:42 2009
(r194557)
+++ head/tools/tools/tinybsd/tinybsdSat Jun 20 20:35:50 2009
(r194558)
@@ -19,6 +19,8 @@ BASEFILE="tinybsd.basefiles"
 PORTSFILE="tinybsd.ports"
 PORTSDIR=/usr/ports
 DEFINSTARGS="-o 0 -g 0 -m 555"
+TINYARCH=$(uname -p)
+
 TS="=>"
 
 splitarg1 () {
@@ -331,7 +333,7 @@ install_ports() {
 
 make_kernel() {
echo "${TS} Building customized tiny beastie kernel... "
-   cp -p ${CURRENTDIR}/conf/${CONF}/${KERNCONF} /usr/src/sys/i386/conf
+   cp -p ${CURRENTDIR}/conf/${CONF}/${KERNCONF} 
/usr/src/sys/${TINYARCH}/conf
cd /usr/src
make buildkernel KERNCONF=${KERNCONF} || exit 1
gzip -9 /usr/obj/usr/src/sys/${KERNCONF}/kernel
@@ -339,7 +341,7 @@ make_kernel() {
install ${DEFINSTARGS} \
  
/usr/obj/usr/src/sys/${KERNCONF}/modules/usr/src/sys/modules/acpi/acpi/acpi.ko \
${WORKDIR}/boot/kernel
-   install -o 0 -g 0 -m 444 /sys/i386/conf/GENERIC.hints 
${WORKDIR}/boot/device.hints
+   install -o 0 -g 0 -m 444 /sys/${TINYARCH}/conf/GENERIC.hints 
${WORKDIR}/boot/device.hints
 }
 
 copy_libraries() {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r194560 - head/bin/sh

2009-06-20 Thread Jilles Tjoelker
Author: jilles
Date: Sat Jun 20 20:44:27 2009
New Revision: 194560
URL: http://svn.freebsd.org/changeset/base/194560

Log:
  Fix race condition in noclobber option.
  
  Formerly, it was possible for the file to be created between the check if it
  existed and the open; the contents would then be lost.
  
  Because this must use O_EXCL, noclobber > will not create a file through a
  symlink anymore. This agrees with behaviour of other shells.
  
  Approved by:  ed (mentor) (implicit)

Modified:
  head/bin/sh/redir.c

Modified: head/bin/sh/redir.c
==
--- head/bin/sh/redir.c Sat Jun 20 20:36:51 2009(r194559)
+++ head/bin/sh/redir.c Sat Jun 20 20:44:27 2009(r194560)
@@ -188,13 +188,25 @@ movefd:
error("cannot create %s: %s", fname, strerror(errno));
goto movefd;
case NTO:
-   fname = redir->nfile.expfname;
-   if (Cflag && stat(fname, &sb) != -1 && S_ISREG(sb.st_mode))
-   error("cannot create %s: %s", fname,
-   strerror(EEXIST));
-   if ((f = open(fname, O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0)
-   error("cannot create %s: %s", fname, strerror(errno));
-   goto movefd;
+   if (Cflag) {
+   fname = redir->nfile.expfname;
+   if (stat(fname, &sb) == -1) {
+   if ((f = open(fname, O_WRONLY|O_CREAT|O_EXCL, 
0666)) < 0)
+   error("cannot create %s: %s", fname, 
strerror(errno));
+   } else if (!S_ISREG(sb.st_mode)) {
+   if ((f = open(fname, O_WRONLY, 0666)) < 0)
+   error("cannot create %s: %s", fname, 
strerror(errno));
+   if (fstat(f, &sb) != -1 && S_ISREG(sb.st_mode)) 
{
+   close(f);
+   error("cannot create %s: %s", fname,
+   strerror(EEXIST));
+   }
+   } else
+   error("cannot create %s: %s", fname,
+   strerror(EEXIST));
+   goto movefd;
+   }
+   /* FALLTHROUGH */
case NCLOBBER:
fname = redir->nfile.expfname;
if ((f = open(fname, O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r194561 - head/sys/netipx

2009-06-20 Thread Robert Watson
Author: rwatson
Date: Sat Jun 20 23:38:21 2009
New Revision: 194561
URL: http://svn.freebsd.org/changeset/base/194561

Log:
  Implement socket delivery MAC checks for IPX/SPX.
  
  Obtained from:TrustedBSD Project
  MFC after:3 days

Modified:
  head/sys/netipx/ipx_usrreq.c
  head/sys/netipx/spx_usrreq.c

Modified: head/sys/netipx/ipx_usrreq.c
==
--- head/sys/netipx/ipx_usrreq.cSat Jun 20 20:44:27 2009
(r194560)
+++ head/sys/netipx/ipx_usrreq.cSat Jun 20 23:38:21 2009
(r194561)
@@ -187,6 +187,12 @@ ipx_input(struct mbuf *m, struct ipxpcb 
m->m_pkthdr.len -= sizeof(struct ipx);
m->m_data += sizeof(struct ipx);
}
+#ifdef MAC
+   if (mac_socket_check_deliver(ipxp->ipxp_socket, m) != 0) {
+   m_freem(m);
+   return;
+   }
+#endif
if (sbappendaddr(&ipxp->ipxp_socket->so_rcv,
(struct sockaddr *)&ipx_ipx, m, NULL) == 0)
m_freem(m);

Modified: head/sys/netipx/spx_usrreq.c
==
--- head/sys/netipx/spx_usrreq.cSat Jun 20 20:44:27 2009
(r194560)
+++ head/sys/netipx/spx_usrreq.cSat Jun 20 23:38:21 2009
(r194561)
@@ -225,6 +225,11 @@ spx_input(struct mbuf *m, struct ipxpcb 
so = ipxp->ipxp_socket;
KASSERT(so != NULL, ("spx_input: so == NULL"));
 
+#ifdef MAC
+   if (mac_socket_check_deliver(so, m) != 0)
+   goto drop;
+#endif
+
if (so->so_options & SO_DEBUG || traceallspxs) {
ostate = cb->s_state;
spx_savesi = *si;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r194562 - head/sys/vm

2009-06-20 Thread Alan Cox
Author: alc
Date: Sun Jun 21 00:21:33 2009
New Revision: 194562
URL: http://svn.freebsd.org/changeset/base/194562

Log:
  Strive for greater consistency among the places that implement real,
  fictious, and contiguous page allocation.  Eliminate unnecessary
  reinitialization of a page's fields.

Modified:
  head/sys/vm/device_pager.c
  head/sys/vm/vm_page.c
  head/sys/vm/vm_phys.c

Modified: head/sys/vm/device_pager.c
==
--- head/sys/vm/device_pager.c  Sat Jun 20 23:38:21 2009(r194561)
+++ head/sys/vm/device_pager.c  Sun Jun 21 00:21:33 2009(r194562)
@@ -307,6 +307,7 @@ dev_pager_getfake(paddr)
 
m->flags = PG_FICTITIOUS;
m->oflags = VPO_BUSY;
+   /* Fictitious pages don't use "act_count". */
m->valid = VM_PAGE_BITS_ALL;
m->dirty = 0;
m->busy = 0;

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Sat Jun 20 23:38:21 2009(r194561)
+++ head/sys/vm/vm_page.c   Sun Jun 21 00:21:33 2009(r194562)
@@ -1108,10 +1108,13 @@ vm_page_alloc(vm_object_t object, vm_pin
 *  At this point we had better have found a good page.
 */
 
-   KASSERT(
-   m != NULL,
-   ("vm_page_alloc(): missing page on free queue")
-   );
+   KASSERT(m != NULL, ("vm_page_alloc: missing page"));
+   KASSERT(m->queue == PQ_NONE, ("vm_page_alloc: page %p has unexpected 
queue %d",
+   m, m->queue));
+   KASSERT(m->wire_count == 0, ("vm_page_alloc: page %p is wired", m));
+   KASSERT(m->hold_count == 0, ("vm_page_alloc: page %p is held", m));
+   KASSERT(m->busy == 0, ("vm_page_alloc: page %p is busy", m));
+   KASSERT(m->dirty == 0, ("vm_page_alloc: page %p is dirty", m));
if ((m->flags & PG_CACHED) != 0) {
KASSERT(m->valid != 0,
("vm_page_alloc: cached page %p is invalid", m));
@@ -1150,12 +1153,8 @@ vm_page_alloc(vm_object_t object, vm_pin
if (req & VM_ALLOC_WIRED) {
atomic_add_int(&cnt.v_wire_count, 1);
m->wire_count = 1;
-   } else
-   m->wire_count = 0;
-   m->hold_count = 0;
+   }
m->act_count = 0;
-   m->busy = 0;
-   KASSERT(m->dirty == 0, ("vm_page_alloc: free/cache page %p was dirty", 
m));
mtx_unlock(&vm_page_queue_free_mtx);
 
if ((req & VM_ALLOC_NOOBJ) == 0)

Modified: head/sys/vm/vm_phys.c
==
--- head/sys/vm/vm_phys.c   Sat Jun 20 23:38:21 2009(r194561)
+++ head/sys/vm/vm_phys.c   Sun Jun 21 00:21:33 2009(r194562)
@@ -689,6 +689,14 @@ done:
KASSERT(m->queue == PQ_NONE,
("vm_phys_alloc_contig: page %p has unexpected queue %d",
m, m->queue));
+   KASSERT(m->wire_count == 0,
+   ("vm_phys_alloc_contig: page %p is wired", m));
+   KASSERT(m->hold_count == 0,
+   ("vm_phys_alloc_contig: page %p is held", m));
+   KASSERT(m->busy == 0,
+   ("vm_phys_alloc_contig: page %p is busy", m));
+   KASSERT(m->dirty == 0,
+   ("vm_phys_alloc_contig: page %p is dirty", m));
m_object = m->object;
if ((m->flags & PG_CACHED) != 0) {
m->valid = 0;
@@ -705,10 +713,7 @@ done:
/* Don't clear the PG_ZERO flag; we'll need it later. */
m->flags = PG_UNMANAGED | (m->flags & PG_ZERO);
m->oflags = 0;
-   KASSERT(m->dirty == 0,
-   ("vm_phys_alloc_contig: page %p was dirty", m));
-   m->wire_count = 0;
-   m->busy = 0;
+   /* Unmanaged pages don't use "act_count". */
if (m_object != NULL &&
m_object->type == OBJT_VNODE &&
m_object->cache == NULL) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r194563 - head/sys/dev/cxgb/sys

2009-06-20 Thread Kip Macy
Author: kmacy
Date: Sun Jun 21 01:17:38 2009
New Revision: 194563
URL: http://svn.freebsd.org/changeset/base/194563

Log:
  fix !x86 cxgb compile

Modified:
  head/sys/dev/cxgb/sys/uipc_mvec.c

Modified: head/sys/dev/cxgb/sys/uipc_mvec.c
==
--- head/sys/dev/cxgb/sys/uipc_mvec.c   Sun Jun 21 00:21:33 2009
(r194562)
+++ head/sys/dev/cxgb/sys/uipc_mvec.c   Sun Jun 21 01:17:38 2009
(r194563)
@@ -90,7 +90,7 @@ retry:
n = n->m_next;
}
 #else
-   err = bus_dmamap_load_mbuf_sg(txq->entry_tag, map, m, segs,
+   err = bus_dmamap_load_mbuf_sg(txq->entry_tag, map, *m, segs,
&seg_count, 0);
 #endif 
if (seg_count == 0) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r194564 - head/gnu/lib/libgcov

2009-06-20 Thread Alexander Kabaev
Author: kan
Date: Sun Jun 21 01:54:47 2009
New Revision: 194564
URL: http://svn.freebsd.org/changeset/base/194564

Log:
  Compile static gcov library with -fPIC to match what stock GCC builds
  are doing. This is required for libgcov.a to be usable on amd64.
  
  Reported by:  stas

Modified:
  head/gnu/lib/libgcov/Makefile

Modified: head/gnu/lib/libgcov/Makefile
==
--- head/gnu/lib/libgcov/Makefile   Sun Jun 21 01:17:38 2009
(r194563)
+++ head/gnu/lib/libgcov/Makefile   Sun Jun 21 01:54:47 2009
(r194564)
@@ -27,7 +27,15 @@ OBJS_T=  ${SYMS:S/$/.o/}
 OBJS_P=${SYMS:S/$/.po/}
 OBJS_S=${SYMS:S/$/.So/}
 
-COMMONHDRS=tm.h tconfig.h gcov-iov.h options.h 
+#---
+#
+# Helpful shortcuts for compiler invocations.
+#
+CC_T = ${CC} -c ${CFLAGS} -fPIC
+CC_P = ${CC} -c ${CFLAGS} -p -fPIC
+CC_S = ${CC} -c ${CFLAGS} ${PICFLAG} -DSHARED
+
+COMMONHDRS=tm.h tconfig.h gcov-iov.h options.h
 CLEANFILES+=   ${COMMONHDRS} cs-tm.h cs-tconfig.h options.h optionlist
 
 ${COMMONHDRS}: ${.CURDIR}/../../usr.bin/cc/cc_tools/Makefile
@@ -36,16 +44,16 @@ ${COMMONHDRS}: ${.CURDIR}/../../usr.bin/
 ${OBJS} beforedepend: ${COMMONHDRS}
 
 ${OBJS_T}: libgcov.c
-   ${CC} -c ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
+   ${CC_T} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
 
 .if !defined(NO_PIC)
 ${OBJS_S}: libgcov.c
-   ${CC} -c ${PICFLAG} ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} 
${.ALLSRC:M*.c}
+   ${CC_S} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
 .endif
 
 .if ${MK_PROFILE} != "no"
 ${OBJS_P}: libgcov.c
-   ${CC} -c -p ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
+   ${CC_P} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c}
 .endif
 
 .include 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r194565 - stable/7/share/termcap

2009-06-20 Thread Edwin Groothuis
Author: edwin
Date: Sun Jun 21 02:45:23 2009
New Revision: 194565
URL: http://svn.freebsd.org/changeset/base/194565

Log:
  MFC of 194146
  
  Add missing termcap entry for rxvt-unicode.
  
The termcap database does not have an entry for rxvt-unicode.
This means that programs that need an entry such as vi fail
to work when connecting via ssh using this terminal emulator.
  
  The added data is not the same as the PR submitted by Richard, it
  uses the :tc=xxx: option to inherit everything from rxvt-mono.
  
  PR:   conf/117323
  Submitted by: Richard Bradshaw 

Modified:
  stable/7/share/termcap/   (props changed)
  stable/7/share/termcap/termcap.src

Modified: stable/7/share/termcap/termcap.src
==
--- stable/7/share/termcap/termcap.src  Sun Jun 21 01:54:47 2009
(r194564)
+++ stable/7/share/termcap/termcap.src  Sun Jun 21 02:45:23 2009
(r194565)
@@ -4547,6 +4547,12 @@ rxvt-mono|rxvt terminal emulator (monoch
:te=\E[?47l\E8:ti=\E7\E[?47h:ue=\E[24m:up=\E[A:us=\E[4m:\
:vb=\E[?5h\E[?5l:ve=\E[?25h:vi=\E[?25l:vs=\E[?25h:
 
+# Termcap entry for rxvt-unicode, taken from 
http://cvs.schmorp.de/rxvt-unicode/doc/rxvt.7.html#I_need_a_termcap_file_entry
+rxvt-unicode|rxvt-unicode terminal (X Window System):\
+   :SF=\E[%dS:SR=\E[%dT:bw:ec=\E[%dX:kb=\177:kd=\EOB:ke=\E[?1l\E>:\
+   :kl=\EOD:kr=\EOC:ks=\E[?1h\E=:ku=\EOA:lm#0:te=\E[r\E[?1049l:\
+   :ti=\E[?1049h:tc=rxvt-mono:
+
 rxvt|rxvt terminal emulator (X Window System):\
:pa#64:Co#8:AF=\E[3%dm:AB=\E[4%dm:op=\E[39;49m:tc=rxvt-mono:
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r194566 - stable/7/share/termcap

2009-06-20 Thread Edwin Groothuis
Author: edwin
Date: Sun Jun 21 02:46:56 2009
New Revision: 194566
URL: http://svn.freebsd.org/changeset/base/194566

Log:
  MFC of 194152
  
  Add missing terminal definition for Wyse 120 in termcap
  
  Although the PR contains also the definitions of the Wyse 60, they
  are not copied into it since there are already definition for them
  in the termcap file since 1997.
  
  Also, the PR didn't use the :tc=xxx: feature, so I've imploded them.
  
  PR:   conf/81882
  Submitted by: Meister des Chaos 

Modified:
  stable/7/share/termcap/   (props changed)
  stable/7/share/termcap/termcap.src

Modified: stable/7/share/termcap/termcap.src
==
--- stable/7/share/termcap/termcap.src  Sun Jun 21 02:45:23 2009
(r194565)
+++ stable/7/share/termcap/termcap.src  Sun Jun 21 02:46:56 2009
(r194566)
@@ -3998,6 +3998,31 @@ wy100q|Wyse 100 for Quotron:\
:dc=\EW:dl=\ER:do=^J:ei=\Er:im=\Eq:is=\E`\072\200\EC\EDF\E0\E'\E(\EA21:\
:kd=^J:kl=^H:kr=^L:ku=^K:li#24:nd=^L:up=^K:us=\EG8:ue=\EG0:\
:so=\EG4:se=\EG0:sg#1:sr=\Ej:ho=^^:ug#1:
+# Wyse 120 definitions from conf/81882 by Meister des Chaos 

+wy120|wyse120|wy150|wyse150|Wyse 120/150:\
+:am:bw:hs:km:mi:ms:xo:\
+:co#80:it#8:li#24:pb#9601:ws#45:\
+:ae=\EcD:al=\EE:as=\EcE:bl=^G:bt=\EI:cd=\EY:ce=\ET:cl=\E+:\
+:cm=\E=%+ %+ :cr=^M:ct=\E0:dc=\EW:dl=\ER:do=^J:ds=\EF\r:\
+:ei=\Er:fs=^M:ho=^^:i1=\EcB0\EcC1:i2=\EwJ\Ew1:im=\Eq:ip=:\
+:is=\Ed$\EcD\E'\Er\EH\003\Ed/\eo\ee1\ed*...@\e`9\e`1\016\024\el:\
+:k1...@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:k5=^AD\r:k6=^AE\r:\
+:k7=^AF\r:k8=^AG\r:k9=^AH\r:kD=\EW:kI=\EQ:kN=\EK:kP=\EJ:\
+:kb=^H:kd=^J:kh=^^:kl=^H:kr=^L:ku=^K:le=^H:ll=^^^K:mb=\EG2:\
+:me=\E(\EH\003\EG0\EcD:mh=\EGp:mr=\EG4:nd=^L:nw=\r\n:\
+:se=\EG0:sf=\n:so=\EGt:sr=\Ej:st=\E1:ta=\011:te=\Ew1:\
+:ti=\Ew0:ts=\EF:ue=\EG0:up=^K:us=\EG8:vb=\E`8\E`9:ve=\E`1:\
+:vi=\E`0:
+wy120-w|wyse120-w|wy150-w|wyse150-w|wyse 120/150 132-column:\
+   :cm=\Ea%i%dR%dC:co#132:ws#97:tc=wy120:
+wy120-25|wyse120-25|wy150-25|wyse150-25|wyse 120/150 80-column 25-lines:\
+:li#25:tc=wy120:
+wy120-25-w|wyse120-25-w|wy150-25-w|wyse150-25-w|wyse 120/150 132-column 
25-lines:\
+   :cm=\Ea%i%dR%dC:co#132:li#25:ws#97:tc=wy120:
+wy120-vb|wyse120-vb|wy150-vb|wyse150-vb|Wyse 120/150 visible bell:\
+   :bl@:tc=wy120:
+wy120-w-vb|wy120-wvb|wyse120-wvb|wy150-w-vb|wyse150-w-vb|Wyse 120/150 
132-column visible bell:\
+   :bl@:cm=\Ea%i%dR%dC:co#132:ws#97:tc=wy120:
 # # 
 #
 # y: TELERAY
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r194493 - head/usr.bin/catman

2009-06-20 Thread Bruce Evans

On Sat, 20 Jun 2009, Brooks Davis wrote:


On Sat, Jun 20, 2009 at 01:57:07PM +1000, Bruce Evans wrote:

On Fri, 19 Jun 2009, Brooks Davis wrote:


Log:
 When checking if we can write to a file, use access() instead of a
 manual permission check based on stat output.  Also, get rid of the
 executability check since it is not used.


This seems to add some security holes.  From "man assert | col -bx":

%%%
SECURITY CONSIDERATIONS
 The access() system call is a potential security hole due to race condi-
 tions and should never be used.  Set-user-ID and set-group-ID applica-
...
%%%


The code I replaced was effectivly a hand rolled version of access() based
on examining stat(1) results.  I think both are equivalently wrong from
a security perspective.


Not really.  It is impossible to hand-roll access using only stat()
results, since ACL/MAC/other results might also be needed, and it is
difficult to hand-roll it since it is difficult even to know which
results are needed.  The hand-rolling that you removed didn't even
know about the immutable flags, which _are_ in the stat() results.

This both are inequivalently wrong from a security perspective.

catman would probably be better from a non-secuity persepective if it
didn't use access().  It can only use the results to avoid some errors
in advance.  It does this, but the advantages of doing this are small
at best.  man(1) doesn't do this.  It just attempts to open a temporary
cat file in the cat directory.  When this fails, it assumes that this
is intended and doesn't print a warning.  If this succeeds, than it later
attempts to rename the temporary fail.  If this fails (e.g., due to someone
settting uchg on the source or target file), then it assumes that this is
not intended and prints a warning.


Modified: head/usr.bin/catman/catman.c
==
--- head/usr.bin/catman/catman.cFri Jun 19 15:31:40 2009
(r194492)
+++ head/usr.bin/catman/catman.cFri Jun 19 15:52:35 2009
(r194493)
@@ -759,14 +742,6 @@ main(int argc, char **argv)
{
int opt;

-   if ((uid = getuid()) == 0) {
-   fprintf(stderr, "don't run %s as root, use:\n   echo", argv[0]);
-   for (optind = 0; optind < argc; optind++) {
-   fprintf(stderr, " %s", argv[optind]);
-   }
-   fprintf(stderr, " | nice -5 su -m man\n");
-   exit(1);
-   }
while ((opt = getopt(argc, argv, "vnfLrh")) != -1) {
switch (opt) {
case 'f':


Surely it is wrong to remove the enforcement of not running as root?


Yes that was an error, I've restored that check.  Thanks for the catch.


The named `uid' variable should be removed now, since it is no longer
needed outside this function and was never needed inside this function.

Bruce
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r194567 - stable/7/share/termcap

2009-06-20 Thread Edwin Groothuis
Author: edwin
Date: Sun Jun 21 02:48:16 2009
New Revision: 194567
URL: http://svn.freebsd.org/changeset/base/194567

Log:
  MFC of 194172
  
  Termcap updates for screen and linux console:
  
  screen entry: F11-F20 keys added
  linux entry: F10-F20 keys added, ACS line graphics added
  
  PR:   kern/108899
  Submitted by: Joseph Terner

Modified:
  stable/7/share/termcap/   (props changed)
  stable/7/share/termcap/termcap.src

Modified: stable/7/share/termcap/termcap.src
==
--- stable/7/share/termcap/termcap.src  Sun Jun 21 02:46:56 2009
(r194566)
+++ stable/7/share/termcap/termcap.src  Sun Jun 21 02:48:16 2009
(r194567)
@@ -2771,6 +2771,8 @@ SC|screen|VT 100/ANSI X3.64 virtual term
:ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:kb=^H:\
:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k5=\E[15~:k6=\E[17~:\
:k7=\E[18~:k8=\E[19~:k9=\E[20~:k;=\E[21~:F1=\E[23~:F2=\E[24~:\
+   :F3=\E[25~:F4=\E[26~:F5=\E[28~:F6=\E[29~:\
+   :F7=\E[31~:F8=\E[32~:F9=\E[33~:FA=\E[34~:\
:kh=\E[1~:kI=\E[2~:kD=\E[3~:@7=\E[4~:kP=\E[5~:\
:kN=\E[6~:eA=\E(B\E)0:as=^N:ae=^O:ti=\E[?1049h:te=\E[?1049l:\
:vi=\E[?25l:ve=\E[34h\E[?25h:vs=\E[34l:\
@@ -4526,7 +4528,9 @@ linux|Linux Console:\
:me=\E[0;10m:mh=\E[2m:mr=\E[7m:nd=\E[C:nw=^M^J:rc=\E8:\
:sc=\E7:se=\E[m:sf=^J:so=\E[7m:sr=\EM:st=\EH:ta=^I:\
:ue=\E[24m:up=\E[A:us=\E[4m:vb=200\E[?5h\E[?5l:\
-   :ve=\E[?25h:vi=\E[?25l:
+   :ve=\E[?25h:vi=\E[?25l:\
+   :k;=\E[21~:F1=\E[23~:F2=\E[24~:F3=\E[25~:F4=\E[26~:F5=\E[28~:\
+   :F6=\E[29~:F7=\E[31~:F8=\E[32~:F9=\E[33~:FA=\E[34~:
 linux-m|Linux Console no color:\
:pa@:Co@:AF@:AB@:op@:\
:tc=linux:
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r194568 - stable/7/share/termcap

2009-06-20 Thread Edwin Groothuis
Author: edwin
Date: Sun Jun 21 02:49:21 2009
New Revision: 194568
URL: http://svn.freebsd.org/changeset/base/194568

Log:
  Add missing passthrough printing entries for VT100 and workalikes
  in /etc/termcap:
  
  VT100 spec indicates that passthrough printing can be enabled
  by sending ESC[5i and disabled by sending ESC[4i These entries
  should be listed as po and pf in /etc/termcap, but are absent.
  See http://www.vt100.net/docs/vt102-ug/chapter5.html#S5.5.2.23
  
  PR:   conf/71549
  Submitted by: Andrew Webster 

Modified:
  stable/7/share/termcap/   (props changed)
  stable/7/share/termcap/termcap.src

Modified: stable/7/share/termcap/termcap.src
==
--- stable/7/share/termcap/termcap.src  Sun Jun 21 02:48:16 2009
(r194567)
+++ stable/7/share/termcap/termcap.src  Sun Jun 21 02:49:21 2009
(r194568)
@@ -2481,7 +2481,7 @@ vt100|dec-vt100|vt100-am|vt100am|dec vt1
:K1=\EOq:K2=\EOr:K3=\EOs:K4=\EOp:K5=\EOn:pt:sr=2*\EM:xn:\
:sc=2\E7:rc=2\E8:cs=5\E[%i%d;%dr:UP=2\E[%dA:DO=2\E[%dB:RI=2\E[%dC:\
:LE=2\E[%dD:ct=2\E[3g:st=2\EH:ta=^I:ms:bl=^G:cr=^M:eo:it#8:\
-   :RA=\E[?7l:SA=\E[?7h:
+   :RA=\E[?7l:SA=\E[?7h:po=\E[5i:pf=\E[4i:
 vt100-nam|dec-vt100-nam|vt100nam|vt100 w/no am:\
:am@:xn@:\
:is=\E>\E[?1;3;4;5;7l\E[?8h\E[1;24r\E[24;1H:\
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r194569 - head/sys/dev/fxp

2009-06-20 Thread Pyun YongHyeon
Author: yongari
Date: Sun Jun 21 06:06:43 2009
New Revision: 194569
URL: http://svn.freebsd.org/changeset/base/194569

Log:
  Introduce Rx mbuf dma tag and use it in Rx path. Previously it used
  common mbuf dma tag for both Tx and Rx path but Rx buffer should
  have single DMA segment and maximum buffer size of the segment
  should be less than MCLBYTES.
  fxp(4) also have to check Tx completion status which was updated by
  DMA so we need BUS_DMASYNC_PREREAD and BUS_DMASYNC_POSTWRITE
  synchronization in Tx path. Fix all misuse of bus_dmamap_sync(9) in
  fxp(4). I guess this change shall fix occasional driver breakage in
  PAE environments.
  
  While I'm here add error messages of dma tag/buffer creation and
  correct messages.

Modified:
  head/sys/dev/fxp/if_fxp.c
  head/sys/dev/fxp/if_fxpvar.h

Modified: head/sys/dev/fxp/if_fxp.c
==
--- head/sys/dev/fxp/if_fxp.c   Sun Jun 21 02:49:21 2009(r194568)
+++ head/sys/dev/fxp/if_fxp.c   Sun Jun 21 06:06:43 2009(r194569)
@@ -642,9 +642,18 @@ fxp_attach(device_t dev)
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
sc->maxsegsize * sc->maxtxseg + sizeof(struct ether_vlan_header),
sc->maxtxseg, sc->maxsegsize, 0,
-   busdma_lock_mutex, &Giant, &sc->fxp_mtag);
+   busdma_lock_mutex, &Giant, &sc->fxp_txmtag);
if (error) {
-   device_printf(dev, "could not allocate dma tag\n");
+   device_printf(dev, "could not create TX DMA tag\n");
+   goto fail;
+   }
+
+   error = bus_dma_tag_create(bus_get_dma_tag(dev), 2, 0,
+   BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
+   MCLBYTES, 1, MCLBYTES, 0,
+   busdma_lock_mutex, &Giant, &sc->fxp_rxmtag);
+   if (error) {
+   device_printf(dev, "could not create RX DMA tag\n");
goto fail;
}
 
@@ -653,18 +662,20 @@ fxp_attach(device_t dev)
sizeof(struct fxp_stats), 1, sizeof(struct fxp_stats), 0,
busdma_lock_mutex, &Giant, &sc->fxp_stag);
if (error) {
-   device_printf(dev, "could not allocate dma tag\n");
+   device_printf(dev, "could not create stats DMA tag\n");
goto fail;
}
 
error = bus_dmamem_alloc(sc->fxp_stag, (void **)&sc->fxp_stats,
BUS_DMA_NOWAIT | BUS_DMA_ZERO, &sc->fxp_smap);
-   if (error)
+   if (error) {
+   device_printf(dev, "could not allocate stats DMA memory\n");
goto fail;
+   }
error = bus_dmamap_load(sc->fxp_stag, sc->fxp_smap, sc->fxp_stats,
sizeof(struct fxp_stats), fxp_dma_map_addr, &sc->stats_addr, 0);
if (error) {
-   device_printf(dev, "could not map the stats buffer\n");
+   device_printf(dev, "could not load the stats DMA buffer\n");
goto fail;
}
 
@@ -673,20 +684,22 @@ fxp_attach(device_t dev)
FXP_TXCB_SZ, 1, FXP_TXCB_SZ, 0,
busdma_lock_mutex, &Giant, &sc->cbl_tag);
if (error) {
-   device_printf(dev, "could not allocate dma tag\n");
+   device_printf(dev, "could not create TxCB DMA tag\n");
goto fail;
}
 
error = bus_dmamem_alloc(sc->cbl_tag, (void **)&sc->fxp_desc.cbl_list,
BUS_DMA_NOWAIT | BUS_DMA_ZERO, &sc->cbl_map);
-   if (error)
+   if (error) {
+   device_printf(dev, "could not allocate TxCB DMA memory\n");
goto fail;
+   }
 
error = bus_dmamap_load(sc->cbl_tag, sc->cbl_map,
sc->fxp_desc.cbl_list, FXP_TXCB_SZ, fxp_dma_map_addr,
&sc->fxp_desc.cbl_addr, 0);
if (error) {
-   device_printf(dev, "could not map DMA memory\n");
+   device_printf(dev, "could not load TxCB DMA buffer\n");
goto fail;
}
 
@@ -695,18 +708,23 @@ fxp_attach(device_t dev)
sizeof(struct fxp_cb_mcs), 1, sizeof(struct fxp_cb_mcs), 0,
busdma_lock_mutex, &Giant, &sc->mcs_tag);
if (error) {
-   device_printf(dev, "could not allocate dma tag\n");
+   device_printf(dev,
+   "could not create multicast setup DMA tag\n");
goto fail;
}
 
error = bus_dmamem_alloc(sc->mcs_tag, (void **)&sc->mcsp,
-   BUS_DMA_NOWAIT, &sc->mcs_map);
-   if (error)
+   BUS_DMA_NOWAIT | BUS_DMA_ZERO, &sc->mcs_map);
+   if (error) {
+   device_printf(dev,
+   "could not allocate multicast setup DMA memory\n");
goto fail;
+   }
error = bus_dmamap_load(sc->mcs_tag, sc->mcs_map, sc->mcsp,
sizeof(struct fxp_cb_mcs), fxp_dma_map_addr, &sc->mcs_addr, 0);
if (error) {
-   device_printf(dev, "can't map the multicast setup command\n");
+

svn commit: r194570 - head/sys/dev/fxp

2009-06-20 Thread Pyun YongHyeon
Author: yongari
Date: Sun Jun 21 06:18:19 2009
New Revision: 194570
URL: http://svn.freebsd.org/changeset/base/194570

Log:
  Due to possible PCI bus lock-up issues fxp(4) didn't perform full
  hardware reset in attach phase. Selective reset does not clear
  configured parameters so I think full hardware reset is required.
  To prevent PCI bus lock-up, do selective reset first which will get
  off the controller from PCI bus and request software reset after
  selective reset. Software reset will unmask interrupts so disable
  it after the reset.

Modified:
  head/sys/dev/fxp/if_fxp.c

Modified: head/sys/dev/fxp/if_fxp.c
==
--- head/sys/dev/fxp/if_fxp.c   Sun Jun 21 06:06:43 2009(r194569)
+++ head/sys/dev/fxp/if_fxp.c   Sun Jun 21 06:18:19 2009(r194570)
@@ -466,10 +466,14 @@ fxp_attach(device_t dev)
}
 
/*
-* Reset to a stable state.
+* Put CU/RU idle state and prepare full reset.
 */
CSR_WRITE_4(sc, FXP_CSR_PORT, FXP_PORT_SELECTIVE_RESET);
DELAY(10);
+   /* Full reset and disable interrupts. */
+   CSR_WRITE_4(sc, FXP_CSR_PORT, FXP_PORT_SOFTWARE_RESET);
+   DELAY(10);
+   CSR_WRITE_1(sc, FXP_CSR_SCB_INTRCNTL, FXP_SCB_INTR_DISABLE);
 
/*
 * Find out how large of an SEEPROM we have.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r194571 - head/sys/dev/fxp

2009-06-20 Thread Pyun YongHyeon
Author: yongari
Date: Sun Jun 21 06:27:35 2009
New Revision: 194571
URL: http://svn.freebsd.org/changeset/base/194571

Log:
  Don't blindly enable Rx lock-up workaround. Newer chips do not need
  the Rx lock-up workaround.
  
  Obtained from:NetBSD

Modified:
  head/sys/dev/fxp/if_fxp.c
  head/sys/dev/fxp/if_fxpvar.h

Modified: head/sys/dev/fxp/if_fxp.c
==
--- head/sys/dev/fxp/if_fxp.c   Sun Jun 21 06:18:19 2009(r194570)
+++ head/sys/dev/fxp/if_fxp.c   Sun Jun 21 06:27:35 2009(r194571)
@@ -500,6 +500,13 @@ fxp_attach(device_t dev)
sc->flags |= FXP_FLAG_WOLCAP;
}
 
+   /* Receiver lock-up workaround detection. */
+   fxp_read_eeprom(sc, &data, 3, 1);
+   if ((data & 0x03) != 0x03) {
+   sc->flags |= FXP_FLAG_RXBUG;
+   device_printf(dev, "Enabling Rx lock-up workaround\n");
+   }
+
/*
 * Determine whether we must use the 503 serial interface.
 */
@@ -2021,7 +2028,7 @@ fxp_tick(void *xsc)
if (sp->rx_good) {
ifp->if_ipackets += le32toh(sp->rx_good);
sc->rx_idle_secs = 0;
-   } else {
+   } else if (sc->flags & FXP_FLAG_RXBUG) {
/*
 * Receiver's been idle for another second.
 */

Modified: head/sys/dev/fxp/if_fxpvar.h
==
--- head/sys/dev/fxp/if_fxpvar.hSun Jun 21 06:18:19 2009
(r194570)
+++ head/sys/dev/fxp/if_fxpvar.hSun Jun 21 06:27:35 2009
(r194571)
@@ -204,6 +204,7 @@ struct fxp_softc {
 #define FXP_FLAG_82559_RXCSUM  0x1000  /* 82559 compatible RX checksum */
 #define FXP_FLAG_WOLCAP0x2000  /* WOL capability */
 #define FXP_FLAG_WOL   0x4000  /* WOL active */
+#define FXP_FLAG_RXBUG 0x8000  /* Rx lock-up bug */
 
 /* Macros to ease CSR access. */
 #defineCSR_READ_1(sc, reg) bus_read_1(sc->fxp_res[0], reg)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r194572 - head/sys/dev/fxp

2009-06-20 Thread Pyun YongHyeon
Author: yongari
Date: Sun Jun 21 06:46:32 2009
New Revision: 194572
URL: http://svn.freebsd.org/changeset/base/194572

Log:
  Always check fxp(4) is running, see if it can accept frames from
  upper stack in fxp_start_body().
  fxp(4) drops driver lock in Rx path so check the fxp(4) is still
  running after reacquiring driver lock in Rx path. Also don't
  invoke fxp_intr_body if fxp(4) is not running. With this change
  there is no need to set suspend bit in device attach phase.

Modified:
  head/sys/dev/fxp/if_fxp.c

Modified: head/sys/dev/fxp/if_fxp.c
==
--- head/sys/dev/fxp/if_fxp.c   Sun Jun 21 06:27:35 2009(r194571)
+++ head/sys/dev/fxp/if_fxp.c   Sun Jun 21 06:46:32 2009(r194572)
@@ -992,7 +992,6 @@ fxp_detach(device_t dev)
 #endif
 
FXP_LOCK(sc);
-   sc->suspended = 1;  /* Do same thing as we do for suspend */
/*
 * Stop DMA and drop transmit queue, but disable interrupts first.
 */
@@ -1319,6 +1318,10 @@ fxp_start_body(struct ifnet *ifp)
if (sc->need_mcsetup)
return;
 
+   if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) !=
+   IFF_DRV_RUNNING)
+   return;
+
if (sc->tx_queued > FXP_NTXCB_HIWAT)
fxp_txeof(sc);
/*
@@ -1727,7 +1730,8 @@ fxp_intr(void *xsc)
 * First ACK all the interrupts in this pass.
 */
CSR_WRITE_1(sc, FXP_CSR_SCB_STATACK, statack);
-   fxp_intr_body(sc, ifp, statack, -1);
+   if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
+   fxp_intr_body(sc, ifp, statack, -1);
}
FXP_UNLOCK(sc);
 }
@@ -1987,6 +1991,8 @@ fxp_intr_body(struct fxp_softc *sc, stru
(*ifp->if_input)(ifp, m);
FXP_LOCK(sc);
rx_npkts++;
+   if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
+   return (rx_npkts);
} else {
/* Reuse RFA and loaded DMA map. */
ifp->if_iqdrops++;
@@ -2070,7 +2076,8 @@ fxp_tick(void *xsc)
 */
if (sc->rx_idle_secs > FXP_MAX_RX_IDLE) {
sc->rx_idle_secs = 0;
-   fxp_mc_setup(sc);
+   if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
+   fxp_mc_setup(sc);
}
/*
 * If there is no pending command, start another stats
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"