Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Install floppies (haha) don't get built with ktrace...



details:   https://anonhg.NetBSD.org/src/rev/2ea519c395f6
branches:  trunk
changeset: 747872:2ea519c395f6
user:      elad <elad%NetBSD.org@localhost>
date:      Sun Oct 04 03:15:08 2009 +0000

description:
Install floppies (haha) don't get built with ktrace/ptrace, so they don't
include kern/sys_process.c. Move proc_uidmatch() to kern/kern_proc.c which
always gets built instead.

Pointed out by Kurt Schreiner on current-users@:

    http://mail-index.netbsd.org/current-users/2009/10/03/msg010745.html

diffstat:

 sys/kern/kern_proc.c   |  37 +++++++++++++++++++++++++++++++++++--
 sys/kern/sys_process.c |  40 ++--------------------------------------
 2 files changed, 37 insertions(+), 40 deletions(-)

diffs (113 lines):

diff -r 85d325d2d8a2 -r 2ea519c395f6 sys/kern/kern_proc.c
--- a/sys/kern/kern_proc.c      Sun Oct 04 01:40:53 2009 +0000
+++ b/sys/kern/kern_proc.c      Sun Oct 04 03:15:08 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_proc.c,v 1.153 2009/10/03 03:38:31 elad Exp $     */
+/*     $NetBSD: kern_proc.c,v 1.154 2009/10/04 03:15:08 elad Exp $     */
 
 /*-
  * Copyright (c) 1999, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.153 2009/10/03 03:38:31 elad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.154 2009/10/04 03:15:08 elad Exp $");
 
 #include "opt_kstack.h"
 #include "opt_maxuprc.h"
@@ -1436,3 +1436,36 @@
        specificdata_setspecific(proc_specificdata_domain,
                                 &p->p_specdataref, key, data);
 }
+
+int
+proc_uidmatch(kauth_cred_t cred, kauth_cred_t target)
+{
+       int r = 0;
+
+       if (kauth_cred_getuid(cred) != kauth_cred_getuid(target) ||
+           kauth_cred_getuid(cred) != kauth_cred_getsvuid(target)) {
+               /*
+                * suid proc of ours or proc not ours
+                */
+               r = EPERM;
+       } else if (kauth_cred_getgid(target) != kauth_cred_getsvgid(target)) {
+               /*
+                * sgid proc has sgid back to us temporarily
+                */
+               r = EPERM;
+       } else {
+               /*
+                * our rgid must be in target's group list (ie,
+                * sub-processes started by a sgid process)
+                */
+               int ismember = 0;
+
+               if (kauth_cred_ismember_gid(cred,
+                   kauth_cred_getgid(target), &ismember) != 0 ||
+                   !ismember)
+                       r = EPERM;
+       }
+
+       return (r);
+}
+
diff -r 85d325d2d8a2 -r 2ea519c395f6 sys/kern/sys_process.c
--- a/sys/kern/sys_process.c    Sun Oct 04 01:40:53 2009 +0000
+++ b/sys/kern/sys_process.c    Sun Oct 04 03:15:08 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sys_process.c,v 1.149 2009/10/02 22:38:45 elad Exp $   */
+/*     $NetBSD: sys_process.c,v 1.150 2009/10/04 03:15:08 elad Exp $   */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -118,7 +118,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_process.c,v 1.149 2009/10/02 22:38:45 elad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_process.c,v 1.150 2009/10/04 03:15:08 elad Exp $");
 
 #include "opt_ptrace.h"
 #include "opt_ktrace.h"
@@ -1032,39 +1032,3 @@
        KERNEL_LOCK(l->l_biglocks, l);
 }
 #endif /* KTRACE || PTRACE */
-
-/*
- * common code for corename, rlimit, and stopflag.
- */
-int
-proc_uidmatch(kauth_cred_t cred, kauth_cred_t target)
-{
-       int r = 0;
-
-       if (kauth_cred_getuid(cred) != kauth_cred_getuid(target) ||
-           kauth_cred_getuid(cred) != kauth_cred_getsvuid(target)) {
-               /*
-                * suid proc of ours or proc not ours
-                */
-               r = EPERM;
-       } else if (kauth_cred_getgid(target) != kauth_cred_getsvgid(target)) {
-               /*
-                * sgid proc has sgid back to us temporarily
-                */
-               r = EPERM;
-       } else {
-               /*
-                * our rgid must be in target's group list (ie,
-                * sub-processes started by a sgid process)
-                */
-               int ismember = 0;
-
-               if (kauth_cred_ismember_gid(cred,
-                   kauth_cred_getgid(target), &ismember) != 0 ||
-                   !ismember)
-                       r = EPERM;
-       }
-
-       return (r);
-}
-



Home | Main Index | Thread Index | Old Index