Only in TAME_ROUTE, allow ioctl SIOCGIFADDR/SIOCGIFFLAGS/SIOCGIFRDOMAIN,
authorderaadt <deraadt@openbsd.org>
Thu, 8 Oct 2015 13:21:06 +0000 (13:21 +0000)
committerderaadt <deraadt@openbsd.org>
Thu, 8 Oct 2015 13:21:06 +0000 (13:21 +0000)
because many routing daemon processes with this attribute need to fetch
that information to work.
discussed with claudio and renato

sys/kern/kern_tame.c

index ccd26b1..fc36a71 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: kern_tame.c,v 1.67 2015/10/07 19:52:54 deraadt Exp $  */
+/*     $OpenBSD: kern_tame.c,v 1.68 2015/10/08 13:21:06 deraadt Exp $  */
 
 /*
  * Copyright (c) 2015 Nicholas Marriott <nicm@openbsd.org>
@@ -1040,6 +1040,17 @@ tame_ioctl_check(struct proc *p, long com, void *v)
                }
        }
 
+       if ((p->p_p->ps_tame & TAME_ROUTE)) {
+               switch (com) {
+               case SIOCGIFADDR:
+               case SIOCGIFFLAGS:
+               case SIOCGIFRDOMAIN:
+                       if (fp->f_type == DTYPE_SOCKET)
+                               return (0);
+                       break;
+               }
+       }
+
        if ((p->p_p->ps_tame & TAME_TTY)) {
                switch (com) {
                case TIOCSPGRP: