Ejemplo n.º 1
0
void armv7a::spsr_access_valid(uint32_t sysm, uint32_t mode)
{
    switch(sysm)
    {
        case B(01110):
            if((!is_secure() /* && (cp15.read(SCR_RFR) == 1)*/) || (mode == B(10001)))
            {
                printb(d_armv7a_bank, "error 9");
            }
            break;
        case B(10000):
            if(mode == B(10010))
            {
                printb(d_armv7a_bank, "error 10");
            }
            break;
        case B(10010):
            if(mode == B(10011))
            {
                printb(d_armv7a_bank, "error 11");
            }
            break;
        case B(10100):
            if(mode == B(10111))
            {
                printb(d_armv7a_bank, "error 12");
            }
            break;
        case B(10110):
            if(mode == B(11011))
            {
                printb(d_armv7a_bank, "error 13");
            }
            break;
        case B(11100):
            if((mode == B(10110)) || !is_secure())
            {
                printb(d_armv7a_bank, "error 14");
            }
            break;
        case B(11110):
            if(mode == B(10110))
            {
                printb(d_armv7a_bank, "error 15");
            }
            break;
        default:
            printb(d_armv7a_bank, "error 15");
            break;
    }//end switch
}
Ejemplo n.º 2
0
void
bridge_rewrite_rep::my_typeset (int desired_status) {
  initialize (env->rewrite (st));
  ttt->insert_marker (st, ip);
  if (is_func (st, VAR_INCLUDE)) {
    url save_name= env->cur_file_name;
    url file_name= url_unix (env->exec_string (st[0]));
    env->cur_file_name= relative (env->base_file_name, file_name);
    env->secure= is_secure (env->cur_file_name);
    body->typeset (desired_status);
    env->cur_file_name= save_name;
    env->secure= is_secure (env->cur_file_name);
  }
  else body->typeset (desired_status);
}
Ejemplo n.º 3
0
edit_env_rep::edit_env_rep (drd_info& drd2,
			    url base_file_name2,
			    hashmap<string,tree>& local_ref2,
			    hashmap<string,tree>& global_ref2,
			    hashmap<string,tree>& local_aux2,
			    hashmap<string,tree>& global_aux2,
			    hashmap<string,tree>& local_att2,
			    hashmap<string,tree>& global_att2):
  drd (drd2),
  env (UNINIT), back (UNINIT), src (path (DECORATION)),
  var_type (default_var_type),
  base_file_name (base_file_name2),
  cur_file_name (base_file_name2),
  secure (is_secure (base_file_name2)),
  local_ref (local_ref2), global_ref (global_ref2),
  local_aux (local_aux2), global_aux (global_aux2),
  local_att (local_att2), global_att (global_att2),
  missing (UNINIT), redefined (), touched (false)
{
  initialize_default_env ();
  initialize_default_var_type ();
  env= copy (default_env);
  style_init_env ();
  update ();
  complete= false;
  recover_env= tuple ();
}
Ejemplo n.º 4
0
void armv7a::banked_register_access_valid(uint32_t sysm, uint32_t mode)
{
    if(get_field(sysm, 4, 3) == B(00))
    {
        if(get_field(sysm, 2, 0) == B(111))
        {
            printb(d_armv7a_bank, "error 1");
        }
        else if(get_field(sysm, 2, 0) == B(110))
        {
            if((mode == B(11010)) || (mode == B(11111)))
            {
                printb(d_armv7a_bank, "error 2");
            }
        }
        else if(get_field(sysm, 2, 0) == B(101))
        {
            if(mode == B(11111))
            {
                printb(d_armv7a_bank, "error 3");
            }
        }
        else if(mode != B(10001))
        {
            printb(d_armv7a_bank, "error 4");
        }
    }
    else if(get_field(sysm, 4, 3) == B(01))
    {
        if((get_field(sysm, 2, 0) == B(111)) || (mode == B(10001)) || (/*(cp15.read(SCR_RFR) == 1) &&*/ !is_secure()))
        {
            printb(d_armv7a_bank, "error 5");
        }
    }
    else if(get_field(sysm, 4, 3) == B(11))
    {
        if(get_bit(sysm, 2) == 0)
        {
            printb(d_armv7a_bank, "error 6");
        }
        else if(get_bit(sysm, 1) == 0)
        {
            if(!is_secure() || (mode == B(10110)))
            {
                printb(d_armv7a_bank, "error 7");
            }
        }
        else
        {
            if(mode != B(10110))
            {
                /* If this comment is removed the program will blow up
                printb(d_armv7a_bank, "error 8");
                */
            }
        }
    }
}
Ejemplo n.º 5
0
/* We don't allow the use of kpwvalid executable scripts to set policy
 * for passwd changes.
 */
int
init_child(char *myname)
{

    using_child = 0;
    return using_child;

}
#else /* !NT40 */
int
init_child(char *myname)
{
    int pipe1[2], pipe2[2];
    pid_t pid;
    char dirpath[1024];
    char *argv[2];

    if (!(find_me(myname, dirpath) && is_secure(dirpath)
	  && kpwvalid_is(dirpath))) {
	using_child = 0;
	return 0;
    }

    /* make a couple of pipes, one for the child's stdin, and the other
     * for the child's stdout.  The parent writes to the former, and
     * reads from the latter, the child reads from the former, and
     * writes to the latter.
     */
    pipe(pipe1);
    pipe(pipe2);

    /* fork a child */
    pid = fork();
    if (pid == -1) {
	using_child = 0;
	perror("kpasswd: can't fork because ");
	return (using_child);
    }
    if (pid == 0) {		/* in child process */
	/* tie stdin and stdout to these pipes */
	/* if dup2 doesn't exist everywhere, close and then dup, but make */
	/* sure that you really get stdin or stdout from the dup. */
	if ((-1 == dup2(pipe1[0], 0)) || (-1 == dup2(pipe2[1], 1))) {
	    perror("kpasswd: can't exec kpwvalid because ");
	    exit(-1);
	}

	strcat(dirpath, "/kpwvalid");
	argv[1] = NULL;
	argv[0] = dirpath;
	execv(dirpath, argv);
	return 0;
    } else {
	using_child = pid;	/* save it for later */
	childin = fdopen(pipe1[1], "w");
	childout = fdopen(pipe2[0], "r");
	return (using_child);
    }
}