Allow TIOCUCNTL issued on a pty(4) master in promise "tty".
authormpi <mpi@openbsd.org>
Mon, 8 Jan 2018 11:54:28 +0000 (11:54 +0000)
committermpi <mpi@openbsd.org>
Mon, 8 Jan 2018 11:54:28 +0000 (11:54 +0000)
This will be soon be used to emulate BREAK commands in vmd(8).

ok nicm@, ccardenas@, deraadt@

sys/kern/kern_pledge.c

index 232d300..3586720 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: kern_pledge.c,v 1.226 2017/12/12 01:12:34 deraadt Exp $       */
+/*     $OpenBSD: kern_pledge.c,v 1.227 2018/01/08 11:54:28 mpi Exp $   */
 
 /*
  * Copyright (c) 2015 Nicholas Marriott <nicm@openbsd.org>
@@ -1123,6 +1123,14 @@ pledge_ioctl(struct proc *p, long com, struct file *fp)
                        if (cdevsw[major(vp->v_rdev)].d_open != ptmopen)
                                break;
                        return (0);
+               case TIOCUCNTL:         /* vmd */
+                       if ((p->p_p->ps_pledge & PLEDGE_RPATH) == 0)
+                               break;
+                       if ((p->p_p->ps_pledge & PLEDGE_WPATH) == 0)
+                               break;
+                       if (cdevsw[major(vp->v_rdev)].d_open != ptcopen)
+                               break;
+                       return (0);
 #endif /* NPTY > 0 */
                case TIOCSPGRP:
                        if ((p->p_p->ps_pledge & PLEDGE_PROC) == 0)