The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/security/mac_veriexec/mac_veriexec_internal.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * $FreeBSD$
    3  *
    4  * Copyright (c) 2011, 2012, 2013, 2015, 2016, 2019, Juniper Networks, Inc.
    5  * All rights reserved.
    6  *
    7  * Redistribution and use in source and binary forms, with or without
    8  * modification, are permitted provided that the following conditions
    9  * are met:
   10  * 1. Redistributions of source code must retain the above copyright
   11  *    notice, this list of conditions and the following disclaimer.
   12  * 2. Redistributions in binary form must reproduce the above copyright
   13  *    notice, this list of conditions and the following disclaimer in the
   14  *    documentation and/or other materials provided with the distribution.
   15  *
   16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   19  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
   21  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   22  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
   23  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   24  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   26  * SUCH DAMAGE.
   27  */
   28 
   29 #ifndef _SECURITY_MAC_VERIEXEC_INTERNAL_H
   30 #define _SECURITY_MAC_VERIEXEC_INTERNAL_H
   31 
   32 #ifndef _KERNEL
   33 #error "no user-serviceable parts inside"
   34 #endif
   35 
   36 #include <sys/queue.h>
   37 #include <sys/malloc.h>
   38 #include <sys/sysctl.h>
   39 
   40 #define MAC_VERIEXEC_FULLNAME   "MAC/veriexec"
   41 
   42 #define VERIEXEC_FILES_FIRST    1
   43 
   44 #if defined(VERIFIED_EXEC_DEBUG) || defined(VERIFIED_EXEC_DEBUG_VERBOSE)
   45 # define VERIEXEC_DEBUG(n, x) if (mac_veriexec_debug > (n)) printf x
   46 #else
   47 # define VERIEXEC_DEBUG(n, x)
   48 #endif
   49 
   50 struct mac_veriexec_file_info
   51 {
   52         int flags;
   53         long fileid;
   54         unsigned long gen;
   55         struct mac_veriexec_fpops *ops;
   56         unsigned char fingerprint[MAXFINGERPRINTLEN];
   57         char *label;
   58         size_t labellen;
   59         LIST_ENTRY(mac_veriexec_file_info) entries;
   60 };
   61 
   62 MALLOC_DECLARE(M_VERIEXEC);
   63 
   64 SYSCTL_DECL(_security_mac_veriexec);
   65 
   66 struct cred;
   67 struct image_params;
   68 struct proc;
   69 struct sbuf;
   70 struct thread;
   71 struct ucred;
   72 struct vattr;
   73 struct vnode;
   74 
   75 int     mac_veriexec_metadata_fetch_fingerprint_status(struct vnode *vp,
   76             struct vattr *vap, struct thread *td, int check_files);
   77 int     mac_veriexec_metadata_get_executable_flags(struct ucred *cred,
   78             struct proc *p, int *flags, int check_files);
   79 int     mac_veriexec_metadata_get_file_flags(dev_t fsid, long fileid,
   80             unsigned long gen, int *flags, int check_files);
   81 struct mac_veriexec_file_info *
   82         mac_veriexec_metadata_get_file_info(dev_t fsid, long fileid,
   83             unsigned long gen, int *found_dev, int check_files);
   84 void    mac_veriexec_metadata_init(void);
   85 void    mac_veriexec_metadata_print_db(struct sbuf *sbp);
   86 int     mac_veriexec_metadata_unmounted(dev_t fsid, struct thread *td);
   87 
   88 int     mac_veriexec_fingerprint_add_ops(struct mac_veriexec_fpops *fpops);
   89 
   90 int     mac_veriexec_fingerprint_check_image(struct image_params *imgp,
   91             int check_files, struct thread *td);
   92 int     mac_veriexec_fingerprint_check_vnode(struct vnode *vp,
   93             struct mac_veriexec_file_info *ip, struct thread *td,
   94             off_t file_size, unsigned char *fingerprint);
   95 void    mac_veriexec_fingerprint_init(void);
   96 struct mac_veriexec_fpops *
   97         mac_veriexec_fingerprint_lookup_ops(const char *type);
   98 
   99 fingerprint_status_t
  100         mac_veriexec_get_fingerprint_status(struct vnode *vp);
  101 int     mac_veriexec_get_state(void);
  102 int     mac_veriexec_in_state(int state);
  103 void    mac_veriexec_set_fingerprint_status(struct vnode *vp,
  104             fingerprint_status_t fp_status);
  105 void    mac_veriexec_set_state(int state);
  106 
  107 #endif  /* !_SECURITY_MAC_VERIEXEC_INTERNAL_H */

Cache object: bac598b7104a5da043f706cc1c19ae07


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.