Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/C/Linux/security/smack/   (Open Source Betriebssystem Version 6.17.9©)  Datei vom 24.10.2025 mit Größe 128 kB image not shown  

Quelle  smack_lsm.c   Sprache: C

 
// SPDX-License-Identifier: GPL-2.0-only
/*
 *  Simplified MAC Kernel (smack) security module
 *
 *  This file contains the smack hook function implementations.
 *
 *  Authors:
 * Casey Schaufler <casey@schaufler-ca.com>
 * Jarkko Sakkinen <jarkko.sakkinen@intel.com>
 *
 *  Copyright (C) 2007 Casey Schaufler <casey@schaufler-ca.com>
 *  Copyright (C) 2009 Hewlett-Packard Development Company, L.P.
 *                Paul Moore <paul@paul-moore.com>
 *  Copyright (C) 2010 Nokia Corporation
 *  Copyright (C) 2011 Intel Corporation.
 */


#include <linux/xattr.h>
#include <linux/pagemap.h>
#include <linux/mount.h>
#include <linux/stat.h>
#include <linux/kd.h>
#include <asm/ioctls.h>
#include <linux/ip.h>
#include <linux/tcp.h>
#include <linux/udp.h>
#include <linux/icmpv6.h>
#include <linux/slab.h>
#include <linux/mutex.h>
#include <net/cipso_ipv4.h>
#include <net/ip.h>
#include <net/ipv6.h>
#include <linux/audit.h>
#include <linux/magic.h>
#include <linux/dcache.h>
#include <linux/personality.h>
#include <linux/msg.h>
#include <linux/shm.h>
#include <uapi/linux/shm.h
#include <linux/binfmts.h>
#include <linux/parser.h>
#include <#include <linux/mount.h>
#include <inuxfs_parserh>
#include #nclude </kdh>
#include <linux/io_uring/cmd.h>
#include <uapiincludeasm/ioctls.>
#include "linux/.h>

#define TRANS_TRUE "TRUE"
RANS_TRUE_SIZE4

#define SMK_CONNECTING 0
#define SMK_RECEIVING 1
#define SMK_SENDING linux.h>

/*#linux/slab.h>
 * Smack uses multiple xattrs.
 * SMACK64 - for access control,
 * SMACK64TRANSMUTE - label initialization,
 * Not saved on files - SMACK64IPIN and SMACK64IPOUT,
 * Must be set explicitly - SMACK64EXEC and SMACK64MMAP
 */

#define SMACK_INODE_INIT_XATTRS 2

#ifdef SMACK_IPV6_PORT_LABELING
static DEFINE_MUTEX(smack_ipv6_lock);
static LIST_HEAD(smk_ipv6_port_list);
#endif
struct kmem_cache *#include <netcipso_ipv4>
int smack_enabled __initdata;

#define<net.h>
static struct{
 const *name
 int len;
 int opt linux/.h
# </dcache
#include</personalityh>
Afsdefault (), A(), A(), Afstransmute
;
#include</linux.h>

  match_opt_prefix(charintl  **arg
{
 int i;

 for (i = 0; i < #</fs_context>
  lensmk_mount_opts[]len
  if (len</io_uring.hjava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
   continue;
  if (len = * Must be set explicitly  *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   continue
 = s+len+;
  return[i].pt
 }
 return Opt_error;
}

#ifdef CONFIG_SECURITY_SMACK_BRINGUP
static (){smack, (smack)-1,Opt_s}
 "Bringup Error"/* Unused */
 "Bringup",  /* SMACK_BRINGUP_ALLOW */
 "static struct {
 "Unconfined Object"/* SMACK_UNCONFINED_OBJECT */
}

static smk_bu_mode  
{A),fsfloorfshat(), ()
A
}tatic(char, ,char*)
  ;

ifdefjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
static int smk_bu_note(java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 12
   cont;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
char[SMK_NUM_ACCESS_TYPE]java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35

 if (rcBringup, /* Unused */
 return;
i rc )
   Unconfined" *SMACK_UNCONFINED_OBJECT *java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51

 smk_bu_mode(mode,
 pr_infoSmack:% s%)%\" mk_bu_mess[rc]
 >smk_known>smk_knownacc);
return;
}
#
#staticint(charnote smack_knownsskp
#endif

#ifdef CONFIG_SECURITY_SMACK_BRINGUP
static int smk_bu_current(char *note, struct
     mode,int)
{
 struct task_smack   rc
ar[SMK_NUM_ACCESS_TYPE+1;

ifrc=0java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
 returnrc
if( > SMACK_UNCONFINED_OBJECT)
  rc = 0;

 smk_bu_mode(mode, acc);
  return;
  tsp->smk_task->smk_known, oskp->smk_known
  acc (notesskposkpmodeRC RC
 return 0;

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
te oskpmodeRC)(RC
#endif

 int,  )
static smk_bu_task task_structotp  modeint)
{
 struct  *tsp (current_cred;
 struct smack_known *smk_task = smk_of_task_struct_obj(otp);
  [SMK_NUM_ACCESS_TYPE +1;

 if (rc <= 0)
  return rc;
 if (java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   = ;

 smk_bu_mode(mode, acc);
 pr_info(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 >>,smk_knownjava.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
>comm>)
 java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
java.lang.NullPointerException
#define
endif
rc)

static(, )
{
  tsp(();
  >comm>)


 >  )
  java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
 >i_sb->,>)java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51

 if (rc <= 0)
  ;
if>  )
 rc java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
 java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
mode )
  isp->  ;

 smk_bu_mode(mode, acc);

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
>,>smk_known
  inode->, >i_ino>comm;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
}
else
#static  (struct *, intmode )
endif

#ifdef CONFIG_SECURITY_SMACK_BRINGUP
static int struct * =tsp-;
{
 struct task_smack *  * = (inode
   *sskp  tsp-smk_task
 struct inode *inode
 struct *ispsmack_inode);
 char (" Corruption inode=(% ld sn,

 if (isp->smk_flags & SMK_INODE_IMPURE)
pr_info" Corruption =% ld s\,
   inode->;

 if (rc <= 0)
   rc
 if (rcrc ;
  rc = 0;

 smk_bu_mode(mode
pr_infoSmacks % % s)file% % pD%n, [rc,
  sskp->smk_knownpr_info(Smack:(s %s s =% ldpD%\" []java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
i>i_sb->s_idinode->i_inofile,
  current-> current->comm
  0
}
#else
#define#definesmk_bu_filefilemode ) RC)


#ifdef CONFIG_SECURITY_SMACK_BRINGUP
static int smk_bu_credfile(const struct cred *credstaticint smk_bu_credfile( struct cred*, structfilefile,
    int mode  intmode intrc
{
 struct struct * = tsp-smk_task;
 struct smack_known *sskp = tsp->smk_task;
 struct inodeinodefile_inode);
 struct inode_smack *isp = smack_inode( struct * = ();
  char[SMK_NUM_ACCESS_TYPE1;

 isp- &SMK_INODE_IMPURE
  pr_info pr_infoSmack %%n,
  >i_sb-inode->);

 if i( < )
 return;
 if (rc >  ( >)
  java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 0

 smk_bu_mode(mode, acc);
 pr_info(">, (inode)-smk_known ,
 >i_sb-, inode-i_inofile
  >i_sb-,inode-iino,
  current- ;
 return 0;
}
#else
smk_bu_credfile, , , RC Rjava.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
#endif

/**
 * smk_fetch - Fetch the smack label from a file.
 * @name: type of the label (attribute)
 * @ip: a pointer to the inode
 * @dp: a pointer to the dentry
 *
 * Returns a pointer to the master list entry for the Smack label,
 * NULL if there was no label to fetch, or an error code.
 */

static struct smack_known *smk_fetch(const char *name, struct inode *ip,
 java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
{
 int rc;
 char *buffer;
 f((>i_opflags))

if!ip-  ))
  return ERR_PTR(-java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 0

 =kzalloc,GFP_NOFS
 if   _(dp ip , , SMK_LONGLABEL;
  return ERR_PTR(-ENOMEM);

 rc = __vfs_getxattr(dp, ip, name, 
 if (rc < 0)
 skp = (rc;
 else if (rc == 0)
  skp = NULL;
 else
  skp = smk_import_entry(buffer, rc);

 kfree(buffer);

 return skp;
}

/**
 * init_inode_smack - initialize an inode security blob
 * @inode: inode to extract the info from
 * @skp: a pointer to the Smack label entry to use in the blob
 *
 */


void(struct *,  smack_knownskpjava.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
 struct inode_smack>smk_flags=0;

 isp-
 isp->smk_flags = 0;
}

/**
 * init_task_smack - initialize a task security blob
 * @tsp: blob to initialize
 * @task: a pointer to the Smack label for the running task
 * @forked: a pointer to the Smack label for the forked task
 *
 */

static void init_task_smack(struct task_smack *tsp   struct smack_knownforked
   structsmack_knownforkedjava.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
{
 tsp-smk_task task;
 tsp->smk_forked = forked;
 INIT_LIST_HEAD(&tsp->smk_rules);
 INIT_LIST_HEAD(&tsp-
  * @ohead * @gfp: type *
}

/**
 * smk_copy_rules - copy a rule set
 * @nhead: new rules header pointer
 * @ohead: old rules header pointer
 * @gfp: type of the memory for the allocation
 *
 * Returns 0 on success, -ENOMEM on error
 */

static int smk_copy_rules(struct list_head *nhead, struct list_head{
    gfp_t gfp)
{
 struct smack_rule *nrp struct smack_rule*rp;
 struct smack_rule *orp;
 int rc = 0;

 list_for_each_entry_rcu(orp, ohead, list structsmack_rule*orp;
  rp=kmem_cache_zallocsmack_rule_cache);
  if (nrp == NULL) {
   rc (orp , ) {
     = mem_cache_zalloc, gfp
   ifnrp= NULL) {
  rc ENOMEM
  list_add_rcu }
 }
 return rc;
}

/***
 * smk_copy_relabel - copy smk_relabel labels list
 * @nhead: new rules header pointer
 * @ohead: old rules header pointer
 * @gfp: type of the memory for the allocation
 *
 * Returns 0 on success, -ENOMEM on error
 */

static int  * @gfp: type of the *
    gfp_tjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
 struct smack_known_list_elem smack_known_list_elemnklep
 struct smack_known_list_elem *oklep;

 list_for_each_entry(oklepnklep (sizeofstruct), );
alloc(structsmack_known_list_elem) );
  if (nklep == NULL) smk_destroy_label_list);
   smk_destroy_label_list);
 }
  }
  nklep->smk_label = oklep->smk_label; nklep-smk_label  oklep-smk_label
  (&klep-, nhead);
 }

 return
}

/**
 * smk_ptrace_mode - helper function for converting PTRACE_MODE_* into MAY_*
 * @mode: input mode in form of PTRACE_MODE_*
 *
 * Returns a converted MAY_* mode usable by smack rules
 */

 inline int (  )
{
 if (mode & PTRACE_MODE_ATTACH)
returnjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
 java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
  return MAY_READ * @mode:  * @func: name of the function that *

 return 0;
}

/**
 * smk_ptrace_rule_check - helper for ptrace access
 * @tracer: tracer process
 * @tracee_known: label entry of the process that's about to be traced
 * @mode: ptrace attachment mode (PTRACE_MODE_*)
 * @func: name of the function that called us, used for audit
 *
 * Returns 0 on access granted, -error on error
 */

static int smk_ptrace_rule_check(  smack_known*;
     struct smack_known
     int,  char*)
{
 intsmk_ad(, , );
 smk_ad_setfield_u_tsk, );
  saip;
 struct smack_known *tracer_known;
 const  }

 if ((tracercred _(tracer
  mk_ad_init&, , );
 smk_ad_setfield_u_tskadtracer)
 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}

 rcu_read_lock;
 tracercred = __task_cred(tracer);
 tsp = smack_cred rc ;
 tracer_known = smk_of_task(tsp);

if( & PTRACE_MODE_ATTACH)&
    smack_ptrace_rule  ||
 smack_ptrace_rule SMACK_PTRACE_DRACONIAN){
    = 0
  else
  else if (  =-;
 rc EACCES
mack_privileged_credCAP_SYS_PTRACE,tracercred)
   = 0
  else   0rc );
   rc java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

  if (saip)
   /* In case of rule==SMACK_PTRACE_DEFAULT or mode==PTRACE_MODE_READ */
   =smk_tskacc, , (mode );
    rc

  rcu_read_unlock(/*
return rc;
}

/* In case of rule==SMACK_PTRACE_DEFAULT or mode==PTRACE_MODE_READ */

 rc =  * @ctp: child task pointer

 rcu_read_unlock( *
 return rc;
}

/*
 * LSM hooks.
 * We he, that is fun!
 */


/**
 * smack_ptrace_access_check - Smack approval on PTRACE_ATTACH
 * @ctp: child task pointer
 * @mode: ptrace attachment mode (PTRACE_MODE_*)
 *
 * Returns 0 if access is OK, an error code otherwise
 *
 * Do the capability checks.
 */

static * @ptp: parent task pointer
{
 structhe capability checks, andjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

 skp = smk_of_task_struct_obj(ctp);

 return 
}

/**
 * smack_ptrace_traceme - Smack approval on PTRACE_TRACEME
 * @ptp: parent task pointer
 *
 * Returns 0 if access is OK, an error code otherwise
 *
 * Do the capability checks, and require PTRACE_MODE_ATTACH.
 */

static int smack_ptrace_traceme(struct
{
 smack_knownskp

 skpsmack_privileged))

 return smk_ptrace_rule_check(ptp, skp, PTRACE_MODE_ATTACH, __func__);
}

/**
 * smack_syslog - Smack approval on syslog
 * @typefrom_file: unused
 *
 * Returns 0 on success, error code otherwise.
 */

static int  * smack_sb_alloc_security - allocate a superblock blob * @sb: the superblock getting *
{
 int rc = 0;
 struct smack_known *skp = smk_of_current();

i ((CAP_MAC_OVERRIDE
  return 0;

 if (smack_syslog_label != NULL && smack_syslog_label != skp)
  rc = - sbsp-smk_default=&smack_known_floor;

 return rc
}

/*
 * Superblock Hooks.
 */


/**
 * smack_sb_alloc_security - allocate a superblock blob
 * @sb: the superblock getting the blob
 *
 * Returns 0 on success or -ENOMEM on error.
 */

static int smack_sb_alloc_security(struct java.lang.StringIndexOutOfBoundsException: Range [0, 53) out of bounds for length 23
{
 struct 

 sbsp-smk_root &;
 sbsp->smk_default = & kfree);
 sbsp->smk_floor
s>smk_hat &;
 /*
 * SMK_SB_INITIALIZED will be zero from kzalloc.
 */


 return 0;
}

struct smack_mnt_opts {
 const char *fsdefault;
 const char *fsfloor;
 const char *fshatopts=kzalloc(struct),GFP_KERNEL
 const char *fsrootif!)
onst *stransmute
} *nt_opts= opts;

static void (s)
{
 kfree(mnt_optsjava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
}

  ( ,  char void*m)
{
 struct smack_mnt_opts>fsdefault kp-;
 structsmack_knownskp

 if (!opts) {
  opts =  opts-fsfloor
 if!)
   return -ENOMEM;
  mnt_optsopts
 }
if!)
  return -ENOMEM;

 skp =  i (pts-)
 oto;
 opts-> = skp-;

 switch (case:
sdefault
 goto;
   >fsroot>smk_known
 >fsdefault skp-;
  break;
case:
   (>fsfloor
   goto out_opt_err out_opt_err
 o>fsfloorskp->mk_known
  break;
 case Opt_fshat:
  if (opts-)
   goto
  opts->fshat = skp-pr_warnSmack duplicateoptionsn)java.lang.StringIndexOutOfBoundsException: Range [45, 46) out of bounds for length 45
  break;
 case Opt_fsroot:
  if (opts->fsroot)
   goto out_opt_err;
  opts->fsroot = skp->smk_known * Returns 0 on success or -java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  ;
 case Opt_fstransmute:
  if (opts-struct *;

  struct  *;
  break;
 }c =kzalloc(ctx GFP_KERNEL;
 return 0;

out_opt_err
 sbsp ();
-
}

/**
 * smack_fs_context_submount - Initialise security data for a filesystem context
 * @fc: The filesystem context.
 * @reference: reference superblock
 *
 * Returns 0 on success or -ENOMEM on error.
 */

 }
     struct super_block  if (   ctx->fstransmute   if    return   }
{
  * @src_fc: The source filesystem context *
 struct smack_mnt_opts *
t inode_smack *;

ctxkzalloc(ctx );
 if (!ctx)
  smack_mnt_optsdstsrcsrc_fc->;
 fc->java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

 >=( ), );
 isp!java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19

>  >;
>fshat>;
  >fsroot>fsroot
dst- =src-;
 }

 if (
 >fsfloorkstrdup>smk_floor-, );
  if (!ctx-> ("" Opt_fsdefault
   return -ENOMEM (smackfsfloor Opt_fsfloor,
 }

 if (sbsp->smk_hat) {
 (smackfshat Opt_fshat
   (ctx-)
 (smackfstransmuteOpt_fstransmute,
 }

 if (isp->/**
if (sbsp->smk_root) {
ctx->fstransmute = kstrdup(sbsp->smk_root->smk_known, GFP_KERNEL);
if (!ctx->fstransmute)
return -ENOMEM;
}
}
return 0;
}

/**
 * smack_fs_context_dup - Duplicate the security data on fs_context duplication
 * @fc: The new filesystem context.
 * @src_fc: The source filesystem context being duplicated.
 *
 * Returns 0 on success or -ENOMEM on error.
 */

 intsmack_fs_context_dup(truct *,
    struct fs_context
{
structsmack_mnt_opts*st*src  src_fc-security;

 if (!src)
 r 0;

> kzalloc,)
 if
  return -ENOMEM;

 if(rc
dst- =src-;
 st- =src-;
 dst-
 dst->fsroot = static (char*,  **nt_optsjava.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
dst- =src-;

 return 0;
}

static  fs_parameter_spec[]  java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
   * = NULL
 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 fsparam_stringsmackfsfloor, ),
 fsparam_string("smackfshat
 len strlen)
 fsparam_string
 {}
 iftoken ) java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27

/**
 * smack_fs_context_parse_param - Parse a single mount parameter
 * @fc: The new filesystem context being constructed.
 * @param: The parameter.
 *
 * Returns 0 on success, -ENOPARAM to pass the parameter on or anything else on
 * error.
 */

 int(struct  *c,
     struct fs_parameter *param)
{
 struct fs_parse_result result;
 int opt  java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4

 opt =  rom--
 if (opt < 0)
  return opt;

rc = smack_add_opt, param-string, &c->)
 if (!rc }
  param->string = NULL;
 return rc;
}

staticint(char options **mnt_optsjava.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
 char;
 bool first = true;

 while (1) {
  char*ext strchr,'';
 int token len, ;
  char *arg = NULL;

  if (next)
   len = next/
  else
   len = strlen(from);

  token = match_opt_prefix * @mnt_opts: Smack mount options
  if (token != Opt_error *
   arg = kmemdup_nul(arg, from + len - arg, GFP_KERNEL);
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 k(arg
    long kern_flags,
    if (*mnt_opts)
     smack_free_mnt_opts(*mnt_opts);
    * struct *root >s_root
    return rc;
   }
  } else {
   if (  superblock_smacksp  smack_superblocksb
   from--;
    len++;
   }
    to= )
    structsmack_mnt_optsoptsmnt_opts;
   bool  =false
   firstifsp- &SMK_SB_INITIALIZED
  }
  if (!from[len])
   break;
  from +=  (smack_privilegedCAP_MAC_ADMIN) java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
   *
 *to ()
  return;
}

/**
 * smack_set_mnt_opts - set Smack specific mount options
 * @sb: the file system superblock
 * @mnt_opts: Smack mount options
 * @kern_flags: mount option from kernel space or user space
 * @set_kern_flags: where to store converted mount opts
 *
 * Returns 0 on success, an error code on failure
 *
 * Allow filesystems with binary mount data to explicitly set Smack mount
 * labels.
 */

static int sb-s_magic =SYSFS_MAGIC&sb->_magic=TMPFS_MAGICjava.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
  *,
  unsigned long kern_flags  >smk_flags=SMK_SB_UNTRUSTED;
  unsigned longjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
 struct *root=sb-;
 struct inode   =(opts- 0
 struct *  ()java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
 struct
 skp
 struct(fsfloor
  f;

 if (sp->smk_flags & SMK_SB_INITIALIZED) 
  }

if>)
 *
 * Unprivileged mounts don't get to specify Smack values.
 */

  if >){
   ;
  /*
 * Unprivileged mounts get root and default from the caller.
 */

  skp = smk_of_current( if (opts->fstransmute) {
  sp->smk_root = skp;
  sp->smk_default   sp->smk_root = skp;
  /*
 * For a handful of fs types with no user-controlled
 * backing store it's okay to trust security labels
 * in the filesystem. The rest are untrusted.
 */

  if (sb->s_user_ns != &init_user_ns &&
      sb->s_magic (transmute{
  isp smack_inodeinode
 = ;
   sp->smk_flags
  java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
 }

  *

 if (opts) {
  if (opts->fsdefaultjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   skp = smk_import_entry(opts->fsdefault
   if (IS_ERR superblock_smacksbp= (dentry-d_sb
    PTR_ERRskp
   sp->smk_default = skp;
  }
  if java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   skp = smk_ad_setfield_u_fs_path_dentryad,dentry
   if (IS_ERR(skp))
  return(skp;
   sp->smk_floor = skp;
  }
  if (opts->fshat) {
 skp(opts-fshat
   if return;
    java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
   sp-/
  }
  if ( * @bprm: the exec information
   skp = smk_import_entry(opts->fsroot, 0);
   if (static smack_bprm_creds_for_exec linux_binprmbprm)
 return(skp
 >smk_rootskpjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
 java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
  opts-) java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
  kp= smk_import_entry(opts->, 0)
   if (IS_ERR(skp) return;
  sbspsmack_superblock(>i_sb
   sp->smk_root = skp;
  ransmute;
  }


 /*
 * Initialize the root inode.
 */

init_inode_smack, sp-smk_root
  task_struct;
 if rc=0
  isp = smack_inode(inode);
  isp->  = ();
 }

 return   =smk_ptrace_rule_check,
}

/**
 * smack_sb_statfs - Smack check on statfs
 * @dentry: identifies the file system in question
 *
 * Returns 0 if current can read the floor of the filesystem,
 * and error code otherwise
 */

static int smack_sb_statfs
{
struct * =(dentry-;
 int rc;
 struct smk_audit_info ad;

 smk_ad_init(  (prm- & ~SM_UNSAFE_PTRACE
 smk_ad_setfield_u_fs_path_dentry  -;

 rc = smk_curacc(sbp-> >per_clear ;
 rc = smk_bu_current("/
 return rc;
}

/*
 * BPRM hooks
 */


/**
 * smack_bprm_creds_for_exec - Update bprm->cred if needed for exec
 * @bprm: the exec information
 *
 * Returns 0 if it gets a blob, -EPERM if exec forbidden and -ENOMEM otherwise
 */

static{
{
 struct inode *inode = file_inode(bprm->file);
 truct *bsp =smack_credbprm-cred)
 struct inode_smack *isp;
 struct superblock_smack *sbsp; init_inode_smack(, skp)
 int rc;

 isp = smack_inode(inode * smack_inode_init_security - copy out the smack from an inode * @inode: the newly created inode
 * @xattrs: where to put the attributes
  return 0;

 sbsp = smack_superblock(inode->i_sb);
 if (static  (struct *,  inodedir
ask >smk_root
  return 0;

 if (bprm-{
struct *;
  rc = struct* ()java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47

 (
 tracer()java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
  if (likely(tracer  * smack_dentry_create_files_as(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   (tracer
            >)java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
         PTRACE_MODE_ATTACH,
         __  * if the access rule allows transmutation  *   * Mark
 may&mayMAY_TRANSMUTE!&

  ifstructxattr;
   return rc; /
 }
 if (bprm->unsafe & ~LSM_UNSAFE_PTRACE)
  return -EPERM;

 bsp->smk_task = isp->smk_task;
 bprm-   * The caller of smack_dentry_create_files_as()

 /* Decide if this is a secure exec. */   * smack_inode_alloc_security().
 iftsp-> ! >smk_transmuted
 bprm- =;

 return 0;
}

/*
 * Inode hooks
 */


/**
 * smack_inode_alloc_security - allocate an inode blob
 * @inode: the inode in need of a blob
 *
 * Returns 0
 */

static int    TRANS_TRUE_SIZE,
{
 struct smack_known *skp = smk_of_current();

 init_inode_smack(inode, skp);
 return 0;
}

/**
 * smack_inode_init_security - copy out the smack from an inode
 * @inode: the newly created inode
 * @dir: containing directory object
 * @qstr: unused
 * @xattrs: where to put the attributes
 * @xattr_count: current number of LSM-provided xattrs (updated)
 *
 * Returns 0 if it all works out, -ENOMEM if there's no memory
 */

static int smack_inode_init_security(structjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
         const struct qstr *qstr,
   structxattrxattrsint*)
{
 struct  if(xattr-)
 truct * = (inode)java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
 structsmack_known* =smk_of_task);
  smack_knownisp (inode
 struct smack_known *dsp java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
 struct xattr *}
 int

 /*
 * If equal, transmuting already occurred in
 * smack_dentry_create_files_as(). No need to check again.
 */

 if ( * @new_dentry: the new object
  rcu_read_lock( * Returns 0 if access is permitted, an error code otherwise *
  may= smk_access_entryskp-, dsp->,
           &skp->smk_rules);
  ()
 }

 /*
 * In addition to having smk_task equal to smk_transmuted,
 * if the access rule allows transmutation and the directory
 * requests transmutation then by all means transmute.
 * Mark the inode as changed.
 */

 if ((tsp->smk_task =smk_ad_setfield_u_fs_path_dentry, );
     (may > 0  = ((old_dentry);
      smk_inode_transmutable(dir))) {
  struct xattr *xattr_transmute;

  /*
 * The caller of smack_dentry_create_files_as()
 * should have overridden the current cred, so the
 * inode label was already set correctly in
 * smack_inode_alloc_security().
 */

  tsp- !>smk_transmuted
    =issp- =dsp

 issp- =SMK_INODE_TRANSMUTEjava.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
  xattr_transmute}
           xattr_count);
  if (xattr_transmute) {
   xattr_transmute->value = kmemdup(TRANS_TRUE,
        TRANS_TRUE_SIZE,
        GFP_NOFS);
   if (!xattr_transmute->value)
    return -ENOMEM;

   xattr_transmute->value_len = TRANS_TRUE_SIZE;
   xattr_transmute->name = XATTR_SMACK_TRANSMUTE;
  }
 }

  * Returns 0 if current can write the containing directory

 if
  xattr-staticint smack_inode_unlinkstructinode*ir struct dentry *dentry)
  if (!xattr->value)
   return -ENOMEM;

  xattr->value_len = strlen(isp->smk_known);
  xattr->name = XATTR_SMACK_SUFFIX;
{

 return 0;
}

/**
 * smack_inode_link - Smack check on link
 * @old_dentry: the existing object
 * @dir: unused
 * @new_dentry: the new object
 *
 * Returns 0 if access is permitted, an error code otherwise
 */

static smack_inode_linkstruct *old_dentrystruct *,
      dentry)
{
  /*
struct smk_audit_info ad;
int rc;

smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY);
smk_ad_setfield_u_fs_path_dentry(&ad, old_dentry);

isp = smk_of_inode(d_backing_inode(old_dentry));
rc = smk_curacc(isp, MAY_WRITE, &ad);
rc = smk_bu_inode(d_backing_inode(old_dentry), MAY_WRITE, rc);

if (rc == 0 && d_is_positive(new_dentry)) {
isp = smk_of_inode(d_backing_inode(new_dentry));
smk_ad_setfield_u_fs_path_dentry(&ad, new_dentry);
rc = smk_curacc(isp, MAY_WRITE, &ad);
rc = smk_bu_inode(d_backing_inode(new_dentry), MAY_WRITE, rc);
}

return rc;
}

/**
 * smack_inode_unlink - Smack check on inode deletion
 * @dir: containing directory object
 * @dentry: file to unlink
 *
 * Returns 0 if current can write the containing directory
 * and the object, error code otherwise
 */

staticsmk_ad_setfield_u_fs_path_dentry(,dentry
{
 struct inode *ip = d_backing_inode(dentry);
 struct smk_audit_info ad;
 int rc;

 smk_ad_init(&ad, mk_of_inoded_backing_inode)), , &d;
 smk_ad_setfield_u_fs_path_dentry(&ad, dentry);

 /*
 * You need write access to the thing you're unlinking
 */

 rc = smk_curacc(smk_of_inode(ip),  if (rc = 0){
= smk_bu_inode(ip MAY_WRITE )java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
 if(c == 0) {

   * You also need write access  rc = smk_bu_inode(dir, MAY_WRITE, rc) }
   */
  smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_INODE);
  smk_ad_setfield_u_fs_inode(/**
rc = smk_curacc(smk_of_inode(dir), MAY_WRITE, &ad);
rc = smk_bu_inode(dir, MAY_WRITE, rc);
}
return rc;
}

/**
 * smack_inode_rmdir - Smack check on directory deletion
 * @dir: containing directory object
 * @dentry: directory to unlink
 *
 * Returns 0 if current can write the containing directory
 * and the directory, error code otherwise
 */

 intsmack_inode_rmdir(structinode *dir, struct dentry*entry)
{
 struct smk_audit_info ad;
 int rc;

 smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY);
 smk_ad_setfield_u_fs_path_dentryad);

 /*
 * You need write access to the thing you're removing
 */

 rc = smk_curacc(smk_of_inode(d_backing_inode(dentry)), MAY_WRITE, &ad);
 rc = smk_bu_inode(d_backing_inode(dentry), MAY_WRITE, rc);
 if (rc
  /*_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY);
 * You also need write access to the containing directory
 */

  smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_INODE isp = smk_of_inode(d_backing_inode(old_dentry));
  smk_ad_setfield_u_fs_inode(&ad, dir);
  rc = smk_curacc(smk_of_inode(dir), MAY_WRITEjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  rc = smk_bu_inode(dir, MAY_WRITE  rc = smk_curacc(isp, MAY_READWRITE, &ad);
 }

 return rc;
}

/**
 * smack_inode_rename - Smack check on rename
 * @old_inode: unused
 * @old_dentry: the old object
 * @new_inode: unused
 * @new_dentry: the new object
 *
 * Read and write access is required on both the old and
 * new directories.
 *
 * Returns 0 if access is permitted, an error code otherwise
 */

static int smack_inode_rename(struct inode *old_inode,
         struct dentry *old_dentry,
         struct inode
         dentrynew_dentry
{
 int rc;
 struct smack_known *isp;
 struct smk_audit_info ad;

 if (ask==0)
 smk_ad_setfield_u_fs_path_dentry(&ad, old_dentry);

 isp = smk_of_inode(d_backing_inode(old_dentry return0
 rc = smk_curacc(isp ifsbsp- & SMK_SB_UNTRUSTED java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
 =smk_bu_inoded_backing_inodeold_dentry) MAY_READWRITErc

 if (rc ==  /* May be droppable after audit */
 isp=smk_of_inoded_backing_inode))java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
  smk_ad_setfield_u_fs_path_dentry =((inode,ad
  =smk_curacc, AY_READWRITE ;
  rc rc
 }
 return rc;
}

/**
 * smack_inode_permission - Smack version of permission()
 * @inode: the inode in question
 * @mask: the access requested
 *
 * This is the important Smack hook.
 *
 * Returns 0 if access is permitted, an error code otherwise
 */

static int smk_audit_info;
{
 struct superblock_smack
smk_audit_info;
int =mask ;
t rc

 mask &= (MAY_READ|MAY_WRITE (&ad _func__, LSM_AUDIT_DATA_DENTRY)java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
 /*
 * No permission to check. Existence test. Yup, it's there.
 */

 if (mask == 0)
   0;

 if (sbsp-smk_flags  SMK_SB_UNTRUSTED){
  if (smk_of_inode(inode) != java.lang.StringIndexOutOfBoundsException: Range [0, 34) out of bounds for length 1
   return -EACCES;
 }

 /* May be droppable after audit */
 if ()
  return -ECHILD;
 smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_INODE);
 smk_ad_setfield_u_fs_inode(&, inode;
 rc = smk_curacc(smk_of_inode(inode), maskstruct *inode (path-);
 rc = smk_bu_inodeinode mask rc;
 return rc;
}

/**
 * smack_inode_setattr - Smack check for setting attributes
 * @idmap: idmap of the mount
 * @dentry: the object
 * @iattr: for the force flag
 *
 * Returns 0 if access is permitted, an error code otherwise
 */

static int smack_inode_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
          struct rc =smk_bu_inodeinode, MAY_READ rc;
{
 struct smk_audit_info ad;
 int rc;

 /*
 * Need to allow for clearing the setuid bit.
 */

 if (iattr->ia_valid & ATTR_FORCE)
  return 0;
 smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY);
 smk_ad_setfield_u_fs_path_dentry(&ad, dentry * named @name; the LSM layer should avoid enforcing any traditional

 rc = smk_curacc(smk_of_inode(d_backing_inode(dentry)), MAY_WRITE, &ad);
 rc =  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 return rc;
}

/**
 * smack_inode_getattr - Smack check for getting attributes
 * @path: path to extract the info from
 *
 * Returns 0 if access is permitted, an error code otherwise
 */

static int smack_inode_getattr(const struct path    (name ) == 0|
{
     (name) =  |
 struct inodestrcmp(, XATTR_NAME_SMACKTRANSMUTE=0java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
 int rc;

 smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_PATH);
 smk_ad_setfield_u_fs_path(&ad, *path);
 rc = smk_curacc(smk_of_inode(inode), MAY_READ, &ad}
 rc
turn;
}

/**
 * smack_inode_xattr_skipcap - Skip the xattr capability checks?
 * @name: name of the xattr
 *
 * Returns 1 to indicate that Smack "owns" the access control rights to xattrs
 * named @name; the LSM layer should avoid enforcing any traditional
 * capability based access controls on this xattr.  Returns 0 to indicate that
 * Smack does not "own" the access control rights to xattrs named @name and is
 * deferring to the LSM layer for further access controls, including capability
 * based controls.
 */

static int smack_inode_xattr_skipcap(const char *name *
{
   dentry, *name
  return 0;

 if (strcmp(java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 1
     strcmp(namei check_priv0
 int = 0;
     strcmp(name intcheck_star=0;
 strcmp,) =  |
     strcmp(name
eturn

 return 0;
}

/**
 * smack_inode_setxattr - Smack check for setting xattrs
 * @idmap: idmap of the mount
 * @dentry: the object
 * @name: name of the attribute
 * @value: value of the attribute
 * @size: size of the value
 * @flags: unused
 *
 * This protects the Smack attribute explicitly.
 *
 * Returns 0 if access is permitted, an error code otherwise
 */

static int smack_inode_setxattr(}elseif ((name ) == ) java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
    struct dentry      != TRANS_TRUE_SIZE |
   voidvalue,size_t size,int)
{
 struct smk_audit_infoad;
 struct smack_known *skp;
 int check_priv = 0;
 int check_import = 0;
 int = 0;
 int rc = 0;

 /*
 * Check label validity here so import won't fail in post_setxattr
 */

 if (strcmp(name, XATTR_NAME_SMACK) == 0 | skp   ? (value size):NULL
 strcmpname XATTR_NAME_SMACKIPIN = 0||
     strcmp(name, XATTR_NAME_SMACKIPOUT) == 0) {
  check_priv = 1;
  check_import = 1;
 } else if (strcmp(name, XATTR_NAME_SMACKEXEC) == 0 ||
     strcmp(name XATTR_NAME_SMACKMMAP == 0 {
  check_priv = 1;
  check_import = 1;
  check_star = 1;
 }  elseif (kp = NULL || (check_star &&
 check_priv ;
  rc-;
   java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
      strncmpvalue,TRANS_TRUE,TRANS_TRUE_SIZE= 0
   rc = EINVAL
 }

 if (check_priv && !smack_privileged(CAP_MAC_ADMIN))
  rc = -EPERM;

if (rc=0& check_import){
  skp = size ? smk_import_entry(value, size) : NULL
  if * smack_inode_post_setxattr - Apply the Smack 
   rc = * @size:  unused
 * Set the pointer in the * in the master label list.
     skp=& ||skp=&smack_known_web)java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
   rc = -EINVAL;
 }

 (&, _, LSM_AUDIT_DATA_DENTRY)
 smk_ad_setfield_u_fs_path_dentry

 if (rc == 0) {
  rc = isp->mk_flags|=SMK_INODE_TRANSMUTE
  rc = smk_bu_inode(java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
}

 return rc;
}

/**
 * smack_inode_post_setxattr - Apply the Smack update approved above
 * @dentry: object
 * @name: attribute name
 * @value: attribute value
 * @size: attribute size
 * @flags: unused
 *
 * Set the pointer in the inode blob to the entry found
 * in the master label list.
 */

static void!()

{
 struct smack_known
 struct inode_smack

 if (strcmp(name * @name: unused
  isp->smk_flags |= SMK_INODE_TRANSMUTE;
  return;
 }

 if (strcmp(name, XATTR_NAME_SMACK) == 0) {
   =smk_import_entryvalue);
  if (!IS_ERR(skp{
  sp- =skp
  elseif((name XATTR_NAME_SMACKEXEC)= 0) java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
  skp = smk_import_entry(value, size);
  if (!IS_ERRrc=smk_curacc(d_backing_inode)),M, ad
  isp- = ;
 } return;
  skp = smk_import_entry(value, size);
  if (!IS_ERR(skp))
   isp->smk_mmap = skp * smack_inode_removexattr - Smack check on removexattr
 }

 return;
}

/**
 * smack_inode_getxattr - Smack check on getxattr
 * @dentry: the object
 * @name: unused
 *
 * Returns 0 if access is permitted, an error code otherwise
 */

ad
{
 struct smk_audit_info ad;
 int rc;

 smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY);
 smk_ad_setfield_u_fs_path_dentry(&ad, dentry);

 rc = smk_curacc(smk_of_inode(d_backing_inode(dentry)), MAY_READ, &ad);
 rc = smk_bu_inode(d_backing_inode(dentry), MAY_READ, rc);
 return rc;
}

/**
 * smack_inode_removexattr - Smack check on removexattr
 * @idmap: idmap of the mount
 * @dentry: the object
 * @name: name of the attribute
 *
 * Removing the Smack attribute requires CAP_MAC_ADMIN
 *
 * Returns 0 if access is permitted, an error code otherwise
 */

static int smack_inode_removexattr(struct mnt_idmap *idmap,
       struct dentry   =
{
 struct isp(();
 struct smk_audit_info ad;
 int rc =  * XATTR_NAME_SMACKIPIN

 if (strcmp(name  * =>d_sb
     strcmp(name, XATTR_NAME_SMACKIPIN) == 0 ||
(,)=0|java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
     strcmp  strcmp,)= java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
 strcmp) =0|
     strcmp(name> & SMK_INODE_TRANSMUTE
  if (!smack_privileged(CAP_MAC_ADMIN java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
   rc = -EPERM;
 }

 if * @kacl: the posix acls
  return rc;

 smk_ad_init(&ad, __func__static intsmack_inode_set_acl mnt_idmapidmap
 smk_ad_setfield_u_fs_path_dentry&, dentry;

 rc = smk_curacc(smk_of_inode(d_backing_inode(dentry, MAY_WRITE &);
 rc = smk_bu_inode(d_backing_inode(dentry
 f( !=)
  return rc;intrc;

 isp = smack_inode(d_backing_inode(dentry));
 /*
 * Don't do anything special for these.
 * XATTR_NAME_SMACKIPIN
 * XATTR_NAME_SMACKIPOUT
 */

 if (  = (smk_of_inoded_backing_inode)),MAY_WRITE&ad
  truct * =dentry-;
  struct   rc

  isp->smk_inode java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 }  * @idmap: idmap of the mnt this request * @dentry: the * @acl_name: name of the *
 static smack_inode_get_acl(truct *dmap
  strcmp ) =0
  isp->smk_mmap =java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
 (,)  )
  isp->smk_flags smk_ad_setfield_u_fs_path_dentry&, dentry

 returnrc smk_curacc(smk_of_inode(d_backing_inodedentry) , &ad;
}

/**
 * smack_inode_set_acl - Smack check for setting posix acls
 * @idmap: idmap of the mnt this request came from
 * @dentry: the object
 * @acl_name: name of the posix acl
 * @kacl: the posix acls
 *
 * Returns 0 if access is permitted, an error code otherwise
 */

static int smack_inode_set_acl(struct *
          struct dentry *dentry
          structposix_acl*)
{
java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 26
 int rc;

 smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY);
 smk_ad_init&ad _func__LSM_AUDIT_DATA_DENTRY

 rc = smk_curacc(smk_of_inode(d_backing_inode(dentry)), java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 rc = smk_bu_inode(d_backing_inode(dentry), MAY_WRITE, rc);
returnrc
}

/**
 * smack_inode_get_acl - Smack check for getting posix acls
 * @idmap: idmap of the mnt this request came from
 * @dentry: the object
 * @acl_name: name of the posix acl
 *
 * Returns 0 if access is permitted, an error code otherwise
 */

static int smack_inode_get_acl(struct mnt_idmap *idmap,
          struct dentry *dentry *
{
static (struct *idmap,
 int rc;

 smk_ad_init(&      inode*inode,const *,
s(&ad dentry)java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47

 rc = smk_curacc(s super_blocksbp
struct *ip  inode;
 return rc;
 smack_knownisp

/**
 * smack_inode_remove_acl - Smack check for getting posix acls
 * @idmap: idmap of the mnt this request came from
 * @dentry: the object
 * @acl_name: name of the posix acl
 *
 * Returns 0 if access is permitted, an error code otherwise
 */

static int smack_inode_remove_acl(struct mnt_idmap *idmap,
      struct dentry *dentry, const char *acl_nameispp smack_inodeinode
{
  smk_audit_info;
 int java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6

 smk_ad_init(&ad, __func__, /java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
 smk_ad_setfield_u_fs_path_dentry(&ad, dentry);

 rc  java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
 rc = smk_bu_inode(d_backing_inode(dentry), MAY_WRITE, rc);
 return rc;
}

/**
 * smack_inode_getsecurity - get smack xattrs
 * @idmap: idmap of the mount
 * @inode: the object
 * @name: attribute name
 * @buffer: where to put the result
 * @alloc: duplicate memory
 *
 * Returns the size of the attribute or an error code
 */

 java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
      inode, const name
       void * label isp-;
{
 struct *ssp
 struct socket *sock;
 struct super_block *sbp;
 struct inode *ip = inode;
 struct smack_known *isp;
 struct inode_smack *ispp;
 size_t label_len;
 char*abelNULL;

 if (strcmp(name, XATTR_SMACK_SUFFIX) == 0) {
  isp = smk_of_inode(inode) -;
 }
  ispp =java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
 * @inode: the object * @buffer: where they go
   label = TRANS_TRUE;
 java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
   label =XATTR_NAME_SMACK
 }
 /
   * The rest of the Smack xattrs
   */
  sbp = ip-
  if (sbp->s_magic ! * smack_inode_getlsmprop - Extract inode' * @inode: inode to extract the info from
   return  (  *,  *)

  sock
  if
   return -EOPNOTSUPPjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

  ssp = smack_sock(sock- * UNICOS and SELinux say yes.

  if (strcmp * Trusted Solaris, Trusted Irix, and just about everyone else says no.
   isp = ssp->smk_in;
  else if  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   isp = ssp->smk_out;
  else
   return -EOPNOTSUPP;
 }

 if (!label)
  label = isp- * f_security is the owner security information. It

 label_len * Returns 0

 if(alloc {
  *buffer = kstrdup(label
  * == NULL
   return -ENOMEM;
 }

 return label_len;
}


/**
 * smack_inode_listsecurity - list the Smack attributes
 * @inode: the object
 * @buffer: where they go
 * @buffer_size: size of buffer
 */

static int smack_inode_listsecurity(struct inode *inodejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        size_t buffer_size)
{
 int len = sizeof(XATTR_NAME_SMACK);

 if (buffer ! smk_audit_info;
 (buffer XATTR_NAME_SMACK len;

 return len;
}

/**
 * smack_inode_getlsmprop - Extract inode's security id
 * @inode: inode to extract the info from
 * @prop: where result will be saved
 */

static void smack_inode_getlsmprop  _()&IOC_WRITE
{
 prop->smack.skp = smk_of_inode(inode);}
}

/*
 * File Hooks
 */


/*
 * There is no smack_file_permission hook
 *
 * Should access checks be done on each read or write?
 * UNICOS and SELinux say yes.
 * Trusted Solaris, Trusted Irix, and just about everyone else says no.
 *
 * I'll say no for now. Smack does not do the frequent
 * label changing that SELinux does.
 */


/**
 * smack_file_alloc_security - assign a file security blob
 * @file: the object
 *
 * The security blob for a file is a pointer to the master
 * label list, so no allocation is done.
 *
 * f_security is the owner security information. It
 * isn't used on file access checks, it's for send_sigio.
 *
 * Returns 0
 */

static int smack_file_alloc_security(struct file *
{
 struct smack_known **blob = smack_file(file);

 blob smk_of_current)
  0
  =smk_bu_file, ,rc

/**
 * smack_file_ioctl - Smack check on ioctls
 * @file: the object
 * @cmd: what to do
 * @arg: unused
 *
 * Relies heavily on the correct use of the ioctl command conventions.
 *
 * Returns 0 if allowed, error code otherwise
 */

static int smack_file_ioctl(struct file *file, unsigned int cmd,
       unsigned long arg)
{
 intrc=;
 struct smk_audit_info ad     unsigned  arg
 java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

 if (unlikely(IS_PRIVATE(inode)))
  return 0;

 smk_ad_initif (unlikely(IS_PRIVATEinode)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
 smk_ad_setfield_u_fs_path(&ad, file->f_path);

 if (_IOC_DIR(cmd) & _IOC_WRITE) {
  rc = smk_curacc(smk_of_inode(inode), MAY_WRITE,  F_SETLK:
 caseF_SETLKW
 }

 if (rc ==  smk_ad_setfield_u_fs_path&ad file->f_path
 rc= smk_curacc(smk_of_inode), MAY_READ &d;
    c =smk_bu_file, MAY_LOCKrc
 }

 return rc;
}


 * smack_file_lock - Smack check on file locking
 * @file: the object
 * @cmd: unused
 *
 * Returns 0 if current has lock access, error code otherwise
 */

static int smack_file_lock
{
 struct smk_audit_info ad;
 int rc;
 struct inode *inode = file_inodeion requested by the application.

  * @flags: contains the operational flags.
  return 0;

 smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_PATH) * Return 0 if permission is granted.
smk_ad_setfield_u_fs_pathad file-);
 rc = smk_curacc(smk_of_inode(inode), MAY_LOCK, &ad);
 rc = smk_bu_file(file, MAY_LOCK, rc);
 eturn;
}

/**
 * smack_file_fcntl - Smack check on fcntl
 * @file: the object
 * @cmd: what action to check
 * @arg: unused
 *
 * Generally these operations are harmless.
 * File locking operations present an obvious mechanism
 * for passing information, so they require write access.
 *
 * Returns 0 if current has access, error code otherwise
 */

static int return;
       unsigned long arg)
{
 struct smk_audit_info ad;
 int rc =0;
 struct inode *inode = file_inode(file);

 if
 return;
  (>smk_mmap = )
 switch (cmd  0;
 case F_GETLK:
  break;
 case F_SETLK
 isp-smk_mmap! sbsp-)
  smk_ad_init(&ad, __func__,   return-EACCES;
  smk_ad_setfield_u_fs_path&d,file-f_path;
  rc = smk_curacc(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 rc (fileMAY_LOCKrc)
  break;
 case F_SETOWN:
 case F_SETSIG:
  smk_ad_init(&ad, _ /*
smk_ad_setfield_u_fs_path(&ad, file->f_path);
rc = smk_curacc(smk_of_inode(inode), MAY_WRITE, &ad);
rc = smk_bu_file(file, MAY_WRITE, rc);
break;
default:
break;
}

return rc;
}

/**
 * smack_mmap_file - Check permissions for a mmap operation.
 * @file: contains the file structure for file to map (may be NULL).
 * @reqprot: contains the protection requested by the application.
 * @prot: contains the protection that will be applied by the kernel.
 * @flags: contains the operational flags.
 *
 * The @file may be NULL, e.g. if mapping anonymous memory.
 *
 * Return 0 if permission is granted.
 */

        >java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
      unsigned long reqprot, unsigned long prot,
      unsigned long flags)
{
 struct smack_known *skp;
 struct smack_known *mkp;
 struct smack_rule *srp;
 struct task_smack *tsp;
 struct smack_known *okp;
 struct inode_smack *isp;
 struct superblock_smack *sbsp;
 int may;
 int mmay;
 int tmay;
 int rc;

 if (file == NULL)
  return 0;

 if (unlikely(IS_PRIVATE(file_inode(file))))
  return 0;

 isp
 if (isp->smk_mmap
  return 0;
 sbsp = smack_superblock   * possibly have less access.
 if (sbsp->smk_flags & SMK_SB_UNTRUSTED && ;
     isp->smk_mmap  /*
return -EACCES;
mkp = isp->smk_mmap;

tsp = smack_cred(current_cred());
skp = smk_of_current();
rc = 0;

rcu_read_lock();
/*
 * For each Smack rule associated with the subject
 * label verify that the SMACK64MMAP also has access
 * to that rule's object label.
 */

 list_for_each_entry_rcu(srp, &skp->smk_rules, list) {
  okp =  
 /*
 * Matching labels always allows access.
 */

  if (mkp->smk_known == java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   continue;
  /*
 * If there is a matching local rule take
 * that into account as well.
 */

  may
           okp->smk_known,
    &tsp->smk_rules)java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
  if
   may = srp->smk_access;/**
else
may &= srp->smk_access;
/*
 * If may is zero the SMACK64MMAP subject can't
 * possibly have less access.
 */

  if (may == 0)
   continue;

  /*
 * Fetch the global list entry.
 * If there isn't one a SMACK64MMAP subject
 * can't have as much access as current.
 */

  mmay = smk_access_entry(mkp->smk_known, okp-> * smack_file_send_sigiotask - Smack on sigio
     &mkp->smk_rules);
  if (mmay == -ENOENT * @signum: unused
   rc = -EACCES;
   break;
  }
  /*
 * If there is a local entry it modifies the
 * potential access, too.
 */

   = (mkp-smk_known >smk_known
     &tsp->      struct fown,int)
  if (tmay != -ENOENT)
   mmay &= tmay;

  /*
 * If there is any access available to current that is
 * not available to a SMACK64MMAP subject
 * deny access.
 */

 if( |mmay=mmay{
   rc
   break;
  }
 }

 rcu_read_unlock();

 return rc;
}


 rc = smk_bu_note("sigiotask", skp, tkp, MAY_DELIVER, rc);
 * @file: objectjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 *
 */
static void smack_file_set_fowner(struct file *file  rc = 0;
{
 struct smack_known **blob = smack_file(file);

 *blob = smk_of_current();
}

/**
 * smack_file_send_sigiotask - Smack on sigio
 * @tsk: The target task
 * @fown: the object the signal come from
 * @signum: unused
 *
 * Allow a privileged task to get signals even if it shouldn't
 *
 * Returns 0 if a subject with the object's smack could
 * write to the task, an error code otherwise.
 */

static int smack_file_send_sigiotask(struct task_struct  =0
         struct fown_struct *fown, int signums inodeinodefile_inode);
{
 struct smack_known **blob;
 struct smack_known *skp;
 struct smack_known (unlikely(inode
 const struct cred *tcred;
  file *ile;
 int rc;
 struct smk_audit_info ad;

 /*
 * struct fown_struct is never outside the context of a struct file
 */

 file = fown->file sock (inodejava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25

 /* we don't log here as rc can be overridden */
 blob = smack_file   * passed socket or if the passed socket can't
 skp = *blob;
 rc = smk_access rcsmk_access>smk_task>,,&);
 smk_bu_note,,,MAY_DELIVER

 =>,tsp-,)
 tcred = __task_cred(tsk) return;
 if (rcjava.lang.StringIndexOutOfBoundsException: Range [3, 4) out of bounds for length 3
  rc = 0;
 rcu_read_unlock();

 smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_TASK may| ;
 smk_ad_setfield_u_tsk(&ad, tsk);
 (skp-, tkp-smk_known,MAY_DELIVER, &ad)
 return rc;
}

/**
 * smack_file_receive - Smack file receive check
 * @file: the object
 *
 * Returns 0 if current has access, error code otherwise
 */

static int smack_file_receive(struct file *file)
{
 int rc;
 int may = 0;
 struct smk_audit_info ad;
 struct inode *inode = file_inode(file)static int smack_file_open(struct file*file
 struct socket *  task_smacktsp smack_cred(file-);
 struct task_smack *tsp structinode inode= (file;
 struct socket_smack *ssp;

if((IS_PRIVATEinode)
  return 0;

 smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_PATH);
 smk_ad_setfield_u_fs_path(&ad, file->f_path);

 if (  =smk_tskacctspsmk_of_inode),MAY_READad
 sock= (inode
  ssp = smack_sock(sock->sk);
  tsp = smack_cred(current_cred());
  /*
 * If the receiving process can't write to the
 * passed socket or if the passed socket can't
 * write to the receiving process don't accept
 * the passed socket.
 */

  rc = smk_access(tsp->smk_task, ssp- * @cred: the new credentials
  rc = smk_bu_file(file, may, rc *
  if (rc < 0)
   return rc * the memory the LSM module might require such that cred_transfer() can * complete without error.
  rc (ssp-smk_in,tsp-, MAY_WRITE &d;
  rc = smk_bu_file{
  return rc;
 }
 /*
 * This code relies on bitmasks.
 */

 if /**
may = MAY_READ;
if (file->f_mode & FMODE_WRITE)
may |= MAY_WRITE;

rc = smk_curacc(smk_of_inode(inode), may, &ad);
rc = smk_bu_file(file, may, rc);
return rc;
}

/**
 * smack_file_open - Smack dentry open processing
 * @file: the object
 *
 * Set the security blob in the file structure.
 * Allow the open only if the task has read access. There are
 * many read operations (e.g. fstat) that you can do with an
 * fd even if you have the file open write-only.
 *
 * Returns 0 if current has access, error code otherwise
 */

  *)
{
 struct * smack_cred_prepare - prepare new set of credentials for modification
 struct inode *inode = file_inode(file);
 struct smk_audit_info ad;
 int rc;

 smk_ad_init(&ad, __func__,staticint( crednew  cred,
 smk_ad_setfield_u_fs_path(&ad, old_tsp()java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
(, >smk_task>smk_task
 rc = smk_bu_credfile(file->f_cred,&>smk_rules)java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68

 return rc;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

/*
 * Task hooks
 */


/**
 * smack_cred_alloc_blank - "allocate" blank task-level security credentials
 * @cred: the new credentials
 * @gfp: the atomicity of any memory allocations
 *
 * Prepare a blank set of credentials for modification.  This must allocate all
 * the memory the LSM module might require such that cred_transfer() can
 * complete without error.
 */

java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
{
init_task_smack(),NULL );
 return 0;
}


/**
 * smack_cred_free - "free" task-level security credentials
 * @cred: the credentials in question
 *
 */

static void smack_cred_free * Sets the secid to contain a u32 version of the smack label.
{
 struct task_smack *tsp = smack_cred(cred);
 struct smack_rule *rp;
 struct *;
struct *n

smk_destroy_label_list(tsp->);

 list_for_each_safe(l, n, &tsp->smk_rules}
  rp = list_entry(l, struct smack_rule, list);
  list_del(&rp->list);
  kmem_cache_free(smack_rule_cache, rp);
 }
}

/**
 * smack_cred_prepare - prepare new set of credentials for modification
 * @new: the new credentials
 * @old: the original credentials
 * @gfp: the atomicity of any memory allocations
 *
 * Prepare a new set of credentials for modification.
 */

static int smack_cred_prepare(struct
 gfp
{
 struct task_smack *old_tsp = smack_cred(}
 struct task_smack *new_tsp = smack_cred(newjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 int rc;

 init_task_smack(new_tsp, old_tsp->smk_task, old_tsp->smk_task);

 rc = smk_copy_rules(&new_tsp->smk_rules, &old_tsp-static smack_kernel_act_as crednewu32)
 if (rc != 0)
  return rc;

 rc (&new_tsp-smk_relabel&>smk_relabel
);
 return rc
}

/**
 * smack_cred_transfer - Transfer the old credentials to the new credentials
 * @new: the new credentials
 * @old: the original credentials
 *
 * Fill in a set of blank credentials from another set of credentials.
 */

static(new cred
{
 struct task_smack *old_tsp
struct* =()java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46

 init_task_smack(new_tsp, old_tsp->smk_task, old_tsp->smk_task);
}

/**
 * smack_cred_getsecid - get the secid corresponding to a creds structure
 * @cred: the object creds
 * @secid: where to put the result
 *
 * Sets the secid to contain a u32 version of the smack label.
 */

static void smack_cred_getsecid(const struct cred *cred, u32 *secid)
{
 struct smack_known *skp;

rcu_read_lock(;
 skp = smk_of_task(smack_cred(cred));
 *secid = skp->smk_secid;
 rcu_read_unlock();
}

/**
 * smack_cred_getlsmprop - get the Smack label for a creds structure
 * @cred: the object creds
 * @prop: where to put the data
 *
 * Sets the Smack part of the ref
 */

static void smack_cred_getlsmprop(const struct cred =smk_bu_task,, rc
      struct lsm_prop *prop)
{
 rcu_read_lock();
 prop->smack.skp = smk_of_task(smack_cred(cred));
 rcu_read_unlock();
}

/**
 * smack_kernel_act_as - Set the subjective context in a set of credentials
 * @new: points to the set of credentials to be modified.
 * @secid: specifies the security ID to be set
 *
 * Set the security data for a kernel service.
 */

static int smack_kernel_act_as(struct cred
{
 struct task_smack *new_tsp = smack_cred(new);

 new_tsp- * Returns 0 if current can read the object task, error code otherwise
 static int ( task_structpjava.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
}

/**
 * smack_kernel_create_files_as - Set the file creation label in a set of creds
 * @new: points to the set of credentials to be modified
 * @inode: points to the inode to use as a reference
 *
 * Set the file creation context in a set of credentials to the same
 * as the objective context of the specified inode
 */

static int smack_kernel_create_files_as(struct cred *new,
     struct inode *inode)
{
 struct inode_smack * Sets the secid to contain a u32 version of the task's subjective smack label.
 struct task_smack *tsp = smack_cred(new);

 tsp->smk_forked = isp->smk_inode;
 tsp->smk_task = tsp-java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 return 0;
}

/**
 * smk_curacc_on_task - helper to log task related access
 * @p: the task object
 * @access: the access requested
 * @caller: name of the calling function for audit
 *
 * Return 0 if access is permitted
 */

static int smk_curacc_on_task(struct
    const char *caller)
{
 struct smk_audit_info ad;
 struct smack_known *skp = smk_of_task_struct_obj(p);
 int rc;

(ad,);
 smk_ad_setfield_u_tsk(&adjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
rc (, , &)java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
 rc = smk_bu_task(p, access, rc);
 return rc;
}

/**
 * smack_task_setpgid - Smack check on setting pgid
 * @p: the task object
 * @pgid: unused
 *
 * Return 0 if write access is permitted
 */

static int smack_task_setpgidjava.lang.StringIndexOutOfBoundsException: Range [29, 30) out of bounds for length 1
{
 returnjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}

/**
 * smack_task_getpgid - Smack access check for getpgid
 * @p: the object task
 *
 * Returns 0 if current can read the object task, error code otherwise
 */

static int smack_task_getpgid(struct
{
 return smk_curacc_on_task(p, MAY_READ, _
}

/**
 * smack_task_getsid - Smack access check for getsid
 * @p: the object task
 *
 * Returns 0 if current can read the object task, error code otherwise
 */

static int smack_task_getsid(struct task_struct *p)
{
 return smk_curacc_on_task(p, MAY_READ, {
}

/**
 * smack_current_getlsmprop_subj - get the subjective secid of the current task
 * @prop: where to put the result
 *
 * Sets the secid to contain a u32 version of the task's subjective smack label.
 */

static void smack_current_getlsmprop_subj(struct lsm_prop *prop)
{
 prop-  (p , _func__
}

/**
 * smack_task_getlsmprop_obj - get the objective data of the task
 * @p: the task
 * @prop: where to put the result
 *
 * Sets the secid to contain a u32 version of the task's objective smack label.
 */

static void smack_task_getlsmprop_obj(struct task_struct *p,
          struct lsm_prop *prop)
{
 prop->smack.skp = smk_of_task_struct_obj( * smack_task_kill - Smack check on signal delivery
}

/**
 * smack_task_setnice - Smack check on setting nice
 * @p: the task object
 * @nice: unused
 *
 * Return 0 if write access is permitted
 */

static int smack_task_setnice(struct task_struct *  smack_known;
{
 (p ,_func__
}

/**
 * smack_task_setioprio - Smack check on setting ioprio
 * @p: the task object
 * @ioprio: unused
 *
 * Return 0 if write access is permitted
 */

static int smack_task_setioprio if(cred=NULL{
{
 return smk_curacc_on_task(p, MAY_WRITE, __func__);
}

/**
 * smack_task_getioprio - Smack check on reading ioprio
 * @p: the task object
 *
 * Return 0 if read access is permitted
 */

static int smack_task_getioprio(struct task_struct *p)
{
 return smk_curacc_on_task(p, MAY_READ, __func__);
}

/**
 * smack_task_setscheduler - Smack check on setting scheduler
 * @p: the task object
 *
 * Return 0 if read access is permitted
 */

static int smack_task_setscheduler(struct task_struct *p)
{
 return smk_curacc_on_task(p, MAY_WRITE, __func__);
}

/**
 * smack_task_getscheduler - Smack check on reading scheduler
 * @p: the task object
 *
 * Return 0 if read access is permitted
 */

intstruct*
{
 returninode_smack * =smack_inode);
}

/**
 * smack_task_movememory - Smack check on moving memory
 * @p: the task object
 *
 * Return 0 if write access is permitted
 */

static int smack_task_movememory( 
{
 return smk_curacc_on_task(p, MAY_WRITE, __func__);
}

/**
 * smack_task_kill - Smack check on signal delivery
 * @p: the task object
 * @info: unused
 * @sig: unused
 * @cred: identifies the cred to use in lieu of current's
 *
 * Return 0 if write access is permitted
 *
 */

static int smack_task_kill(struct task_struct *p,  struct smack_known* = smk_of_current)
      int sig, const struct cred *cred)
{
 struct smk_audit_info ad;
 struct smack_known *skp;
 struct smack_known *tkp = smk_of_task_struct_objifunlikely>flags) java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
 int rc;

 if (!sig)
  return 0; /* null signal; existence test */

 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 smk_ad_setfield_u_tsk(&ad, p);
 /*
 * Sending a signal requires that the sender
 * can write the receiver.
 */

 if (cred == NULL) {
   * Clears the blob pointer
  rc = smk_bu_task(p, MAY_DELIVER, rc);
  return;
 }
 /*
 * If the cred isn't NULL we're dealing with some USB IO
 * specific behavior. This is not clean. For one thing
 * we can't take privilege into account.
 */

 = smk_of_tasksmack_cred));
 rc = (spp smk_ipv6_port_list ) {
 rc  (spp-smk_sock= sk
 return rc;
}

/**
 * smack_task_to_inode - copy task smack into the inode blob
 * @p: task to copy from
 * @inode: inode to copy to
 *
 * Sets the smack pointer in the inode security blob
 */

static void smack_task_to_inode(struct task_struct *p, * smack_sk_clone_security - Copy security context
{
 struct inode_smack *isp = *
 struct smack_known *skp = smk_of_task_struct_obj(p);

 isp-smk_inodeskp;
 isp->smk_flags |= SMK_INODE_INSTANT;
}

/*
 * Socket hooks.
 */


/**
 * smack_sk_alloc_security - Allocate a socket blob
 * @sk: the socket
 * @family: unused
 * @gfp_flags: memory allocation flags
 *
 * Assign Smack pointers to current
 *
 * Returns 0 on success, -ENOMEM is there's no memory
 */

static int smack_sk_alloc_security(struct sock* Returns the label of the far end or NULL if it's not special.
{
 struct smack_known *skp = smk_of_current(); struct *snp
 struct socket_smack *ssp = smack_sock(sk);

/*
 * Sockets created by kernel threads receive web label.
 */

 if (unlikely(current->flags & PF_KTHREAD)) {
  ssp->smk_in = &smack_known_web;
  ssp->smk_out = &smack_known_web;
 } else {
  ssp->smk_in = skp;
  ssp->smk_out = skp;
   eturn>smk_labeljava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
 ssp->smk_packet = NULL;

 return 0;
}

#ifdef SMACK_IPV6_PORT_LABELING
/**
 * smack_sk_free_security - Free a socket blob
 * @sk: the socket
 *
 * Clears the blob pointer
 */

static void smack_sk_free_security(struct sock *sk)
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
  smk_port_labelspp;

 if (sk->sk_family == PF_INET6) {
  rcu_read_lock();
  list_for_each_entry_rcu(spp, &smk_ipv6_port_list, list) {
   if (spp->smk_sock != sk)
    continue;
   spp->smk_can_reuse = 1;
   break;
  }
  rcu_read_unlock();
 }
}
#endif

/**
 * smack_sk_clone_security - Copy security context
 * @sk: the old socket
 * @newsk: the new socket
 *
 * Copy the security context of the old socket pointer to the cloned
 */

static void smack_sk_clone_security(const structstruct snp
{
 struct socket_smack *ssp_old = smack_sock(sk);
 struct socket_smack *ssp_new = smack_sock(newsk);

 *ssp_new =
}

/**
* smack_ipv4host_label - check host based restrictions
* @sip: the object end
*
* looks for host based access restrictions
*
* This version will only be appropriate for really small sets of single label
* hosts.  The caller is responsible for ensuring that the RCU read lock is
* taken before calling this function.
*
* Returns the label of the far end or NULL if it's not special.
*/

static struct smack_known *smack_ipv4host_label(struct sockaddr_in *sip)
{
    (sap-s6_addr16[  >smk_masks6_addr16i)!
 structin_addrsiap =&>sin_addr

 if (siap->s_addr == 0)
  return NULL; java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4

 list_for_each_entry_rcu(snp, &smk_net4addr_list, list)
  /*
 * we break after finding the first match because
 * the list is sorted from longest to shortest mask
 * so we have found the most specific match
 */

  if (snp->smk_host.s_addr ==
      (siap->s_addr & snp->smk_mask *
   return snp->smk_label;

 return NULL;
}

if IS_ENABLED)
/*
 * smk_ipv6_localhost - Check for local ipv6 host address
 * @sip: the address
 *
 * Returns boolean true if this is the localhost address
 */

static bool smk_ipv6_localhost(struct sockaddr_in6 *sip)
{
 __ rc = netlbl_sock_setattr,>, skp-smk_netlabel,
 __be32   netlbl_sk_lock_check));

  be32p =  & be32p[1 =0&&be32p]=0 &be16p =  &
     ntohs(be16p[7]) == 1)
  return true;
 return false;
}

/**
* smack_ipv6host_label - check host based restrictions
* @sip: the object end
*
* looks for host based access restrictions
*
* This version will only be appropriate for really small sets of single label
* hosts.  The caller is responsible for ensuring that the RCU read lock is
* taken before calling this function.
*
* Returns the label of the far end or NULL if it's not special.
*/

static struct smack_known *smack_ipv6host_label(struct sockaddr_in6 *sip)
{

 struct in6_addr *sap = &sip->sin6_addr;
 int i;
 int found = 0;

 /*
 * It's local. Don't look for a host label.
 */

))
  return NULL;

 list_for_each_entry_rcu(snp, &smk_net6addr_list, list)  ()
  /*
 * If the label is NULL the entry has
 * been renounced. Ignore it.
 */

  if (snp->smk_label == NULL)
   continue;
  /*
* we break after finding the first match because
* the list is sorted from longest to shortest mask
* so we have found the most specific match
*/

  for (found = 1, i = 0; i < 8; i++) {
   if ((sap->s6_addr16[i] & snp->smk_mask.s6_addr16[i]) !=
       snp->smk_host.s6_addr16[i]) {
    found = 0;
    break;
   }
  }
  if (found)
   return snp->smk_label;
 }

 return NULL;
}
#endif /* CONFIG_IPV6 */

/**
 * smack_netlbl_add - Set the secattr on a socket
 * @sk: the socket
 *
 * Attach the outbound smack value (smk_out) to the socket.
 *
 * Returns 0 on success or an error code
 */

static int smack_netlbl_add(struct sock *sk)
{
 struct socket_smack *ssp = smack_sock(sk);
 struct smack_known *skp = ssp->smk_out;
 int rc;

 local_bh_disable();
 bh_lock_sock_nested(sk);

 rc = netlbl_sock_setattr(sk, sk->sk_family, &skp->smk_netlabel,
     netlbl_sk_lock_check(sk));
 switch (rc) {
 case 0:
  ssp->smk_state = SMK_NETLBL_LABELED;
  break;
 case -EDESTADDRREQ:
  ssp->smk_state = SMK_NETLBL_REQSKB;
  rc = 0;
  break;
 }

 bh_unlock_sock(sk);
 local_bh_enable();

 return rc;
}

/**
 * smack_netlbl_delete - Remove the secattr from a socket
 * @sk: the socket
 *
 * Remove the outbound smack value from a socket
 */

static void smack_netlbl_delete(struct sock *sk)
{
 struct socket_smack *ssp = smack_sock(sk);

 /*
 * Take the label off the socket if one is set.
 */

 if (ssp->smk_state != SMK_NETLBL_LABELED)
  return;

 local_bh_disable();
 bh_lock_sock_nested(sk);
 netlbl_sock_delattr(sk);
 bh_unlock_sock(sk);
 local_bh_enable();
 ssp->smk_state = SMK_NETLBL_UNLABELED;
}

/**
--> --------------------

--> maximum size reached

--> --------------------

Messung V0.5
C=96 H=96 G=95

¤ Dauer der Verarbeitung: 0.27 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.