オープンソース・ソフトウェアの開発とダウンロード

Subversion リポジトリの参照

Diff of /trunk/1.7.x/ccs-patch/security/ccsecurity/domain.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2968 by kumaneko, Fri Aug 28 07:09:03 2009 UTC revision 2969 by kumaneko, Fri Aug 28 07:47:48 2009 UTC
# Line 863  static int ccs_get_root_depth(void) Line 863  static int ccs_get_root_depth(void)
863  }  }
864    
865  static LIST_HEAD(ccs_execve_list);  static LIST_HEAD(ccs_execve_list);
866  static DEFINE_SPINLOCK(ccs_execve_list_lock);  DEFINE_SPINLOCK(ccs_execve_list_lock);
867    unsigned int ccs_in_execve_counter;
868    
869  /**  /**
870   * ccs_allocate_execve_entry - Allocate memory for execve().   * ccs_allocate_execve_entry - Allocate memory for execve().
871   *   *
872   * Returns pointer to "struct ccs_execve_entry" on success, NULL otherwise.   * Returns pointer to "struct ccs_execve_entry" on success, NULL otherwise.
873   */   */
874  static struct ccs_execve_entry *ccs_allocate_execve_entry(void)  static inline struct ccs_execve_entry *ccs_allocate_execve_entry(void)
875  {  {
876          struct ccs_execve_entry *ee = kzalloc(sizeof(*ee), GFP_KERNEL);          struct ccs_execve_entry *ee = kzalloc(sizeof(*ee), GFP_KERNEL);
877          if (!ee)          if (!ee)
# Line 885  static struct ccs_execve_entry *ccs_allo Line 886  static struct ccs_execve_entry *ccs_allo
886          ee->task = current;          ee->task = current;
887          ee->previous_domain = ee->task->ccs_domain_info;          ee->previous_domain = ee->task->ccs_domain_info;
888          spin_lock(&ccs_execve_list_lock);          spin_lock(&ccs_execve_list_lock);
889            ccs_in_execve_counter++;
890          list_add(&ee->list, &ccs_execve_list);          list_add(&ee->list, &ccs_execve_list);
891          spin_unlock(&ccs_execve_list_lock);          spin_unlock(&ccs_execve_list_lock);
892          return ee;          return ee;
893  }  }
894    
895  /**  /**
  * ccs_find_execve_entry - Find ccs_execve_entry of current process.  
  *  
  * @task: Task to find.  
  *  
  * Returns pointer to "struct ccs_execve_entry" on success, NULL otherwise.  
  */  
 static struct ccs_execve_entry *ccs_find_execve_entry(struct task_struct *task)  
 {  
         struct ccs_execve_entry *ee = NULL;  
         struct ccs_execve_entry *p;  
         spin_lock(&ccs_execve_list_lock);  
         list_for_each_entry(p, &ccs_execve_list, list) {  
                 if (p->task != task)  
                         continue;  
                 ee = p;  
                 break;  
         }  
         spin_unlock(&ccs_execve_list_lock);  
         return ee;  
 }  
   
 /**  
896   * ccs_free_execve_entry - Free memory for execve().   * ccs_free_execve_entry - Free memory for execve().
897   *   *
898   * @ee: Pointer to "struct ccs_execve_entry".   * @ee: Pointer to "struct ccs_execve_entry".
899   */   */
900  static void ccs_free_execve_entry(struct ccs_execve_entry *ee)  static inline void ccs_free_execve_entry(struct ccs_execve_entry *ee)
901  {  {
902          if (!ee)          if (!ee)
903                  return;                  return;
904          spin_lock(&ccs_execve_list_lock);          spin_lock(&ccs_execve_list_lock);
905          list_del(&ee->list);          list_del(&ee->list);
906            ccs_in_execve_counter--;
907          spin_unlock(&ccs_execve_list_lock);          spin_unlock(&ccs_execve_list_lock);
908          kfree(ee->handler_path);          kfree(ee->handler_path);
909          kfree(ee->tmp);          kfree(ee->tmp);
# Line 1281  int ccs_start_execve(struct linux_binprm Line 1262  int ccs_start_execve(struct linux_binprm
1262  void ccs_finish_execve(int retval)  void ccs_finish_execve(int retval)
1263  {  {
1264          struct task_struct *task = current;          struct task_struct *task = current;
1265          struct ccs_execve_entry *ee = ccs_find_execve_entry(task);          struct ccs_execve_entry *ee = NULL;
1266            struct ccs_execve_entry *p;
1267          task->ccs_flags &= ~CCS_CHECK_READ_FOR_OPEN_EXEC;          task->ccs_flags &= ~CCS_CHECK_READ_FOR_OPEN_EXEC;
1268            spin_lock(&ccs_execve_list_lock);
1269            list_for_each_entry(p, &ccs_execve_list, list) {
1270                    if (p->task != task)
1271                            continue;
1272                    ee = p;
1273                    break;
1274            }
1275            spin_unlock(&ccs_execve_list_lock);
1276          if (!ee)          if (!ee)
1277                  return;                  return;
1278          if (retval < 0) {          if (retval < 0) {

Legend:
Removed from v.2968  
changed lines
  Added in v.2969

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26