Index | Thread | Search

From:
Jonathan Gray <jsg@jsg.id.au>
Subject:
Re: [EXT] AMD SEV 1/5: ccp(4): pledge for ioctl(2
To:
Alexander Bluhm <bluhm@openbsd.org>
Cc:
Hans-J?rg H?xer <Hans-Joerg_Hoexer@genua.de>, tech@openbsd.org
Date:
Mon, 2 Sep 2024 10:27:19 +1000

Download raw body.

Thread
On Fri, Aug 30, 2024 at 11:54:31AM +0200, Alexander Bluhm wrote:
> On Thu, Aug 29, 2024 at 11:15:55AM +0200, Hans-J?rg H?xer wrote:
> > Hi,
> > 
> > On Thu, Aug 29, 2024 at 10:14:12AM +1000, Jonathan Gray wrote:
> > > On Thu, Aug 29, 2024 at 09:28:50AM +1000, Jonathan Gray wrote:
> > > > >  
> > > > > +#if NCCP > 0
> > > > > +#if NVMM > 0
> > > > 
> > > > can't this be only #if NCCP > 0?
> > 
> > yes, there's actually no need for depending on NVMM
> 
> RAMDISK_CD does not build.  It has ccp, but #include <machine/conf.h>
> is within #if NVMM > 0.
> 
> /crypt/home/bluhm/openbsd/cvs/src/sys/kern/kern_pledge.c:1357:44: error: use of undeclared identifier 'pspopen'; did you mean 'pppopen'?
>                     (cdevsw[major(vp->v_rdev)].d_open == pspopen)) {
>                                                          ^~~~~~~
>                                                          pppopen
> 
> If there is no VMM, the psp call make not much sense.  So I put
> back #if defined(__amd64__) && NCCP > 0 && NVMM > 0

I'd prefer it to be detangled

Index: kern_pledge.c
===================================================================
RCS file: /cvs/src/sys/kern/kern_pledge.c,v
diff -u -p -U4 -r1.317 kern_pledge.c
--- kern_pledge.c	1 Sep 2024 17:13:46 -0000	1.317
+++ kern_pledge.c	2 Sep 2024 00:10:38 -0000
@@ -72,12 +72,10 @@
 #include "pty.h"
 
 #if defined(__amd64__)
 #include "vmm.h"
-#if NVMM > 0
-#include <machine/conf.h>
-#endif
 #include "ccp.h"
+#include <machine/conf.h>
 #endif
 
 #include "drm.h"
 
@@ -1349,9 +1347,9 @@ pledge_ioctl(struct proc *p, long com, s
 		}
 	}
 #endif
 
-#if defined(__amd64__) && NCCP > 0 && NVMM > 0
+#if NCCP > 0
 	if ((pledge & PLEDGE_VMM)) {
 		if ((fp->f_type == DTYPE_VNODE) &&
 		    (vp->v_type == VCHR) &&
 		    (cdevsw[major(vp->v_rdev)].d_open == pspopen)) {