Add command to get version of the ioctl interface for the veriexec device.

Obtained from:	Juniper Networks, Inc.
MFC after:	1 week
This commit is contained in:
Stephen J. Kiernan 2019-05-17 18:25:53 +00:00
parent 5eaa7d4d65
commit 910013c6a8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=347941
2 changed files with 12 additions and 1 deletions

View File

@ -1,7 +1,7 @@
/*
* $FreeBSD$
*
* Copyright (c) 2011-2013, 2015, Juniper Networks, Inc.
* Copyright (c) 2011-2013, 2015, 2019, Juniper Networks, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -54,6 +54,7 @@ struct verified_exec_params {
#define VERIEXEC_DEBUG_OFF _IO('S', 0x6) /* reset debug */
#define VERIEXEC_GETSTATE _IOR('S', 0x7, int) /* get state */
#define VERIEXEC_SIGNED_LOAD _IOW('S', 0x8, struct verified_exec_params)
#define VERIEXEC_GETVERSION _IOR('S', 0x9, int) /* get version */
#define _PATH_DEV_VERIEXEC _PATH_DEV "veriexec"

View File

@ -138,6 +138,16 @@ verifiedexecioctl(struct cdev *dev __unused, u_long cmd, caddr_t data,
error = EINVAL;
mtx_unlock(&ve_mutex);
break;
case VERIEXEC_GETVERSION:
{
int *ip = (int *)data;
if (ip)
*ip = MAC_VERIEXEC_VERSION;
else
error = EINVAL;
}
break;
case VERIEXEC_LOCK:
mtx_lock(&ve_mutex);
mac_veriexec_set_state(VERIEXEC_STATE_LOCKED);