Path: blob/main/sys/security/mac_grantbylabel/mac_grantbylabel.h
39564 views
/*1* SPDX-License-Identifier: BSD-2-Clause2*3* Copyright (c) 2018-2023, Juniper Networks, Inc.4* All rights reserved.5*6* Redistribution and use in source and binary forms, with or without7* modification, are permitted provided that the following conditions8* are met:9* 1. Redistributions of source code must retain the above copyright10* notice, this list of conditions and the following disclaimer.11* 2. Redistributions in binary form must reproduce the above copyright12* notice, this list of conditions and the following disclaimer in the13* documentation and/or other materials provided with the distribution.14*15* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR16* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES17* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.18* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,19* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,20* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED22* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,23* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY24* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF25* SUCH DAMAGE.26*/2728#ifndef _SECURITY_MAC_GRANTBYLABEL_H29#define _SECURITY_MAC_GRANTBYLABEL_H3031#include <security/mac_veriexec/mac_veriexec.h>3233#define MAC_GRANTBYLABEL_NAME "mac_grantbylabel"3435/* the bits we use to represent tokens */36#define GBL_EMPTY (1<<0)37#define GBL_BIND (1<<1)38#define GBL_IPC (1<<2)39#define GBL_NET (1<<3)40#define GBL_PROC (1<<4)41#define GBL_RTSOCK (1<<5)42#define GBL_SYSCTL (1<<6)43#define GBL_VACCESS (1<<7)44#define GBL_VERIEXEC (1<<8)45#define GBL_KMEM (1<<9)46#define GBL_MAX 94748/* this should suffice for now */49typedef uint32_t gbl_label_t;5051#define MAC_GRANTBYLABEL_FETCH_GBL 152#define MAC_GRANTBYLABEL_FETCH_PID_GBL 25354struct mac_grantbylabel_fetch_gbl_args {55union {56int fd;57pid_t pid;58} u;59gbl_label_t gbl;60};6162#endif636465