]> Zhao Yanbai Git Server - minix.git/commitdiff
Improved access checks in system.c. Grant drivers and FS the rights they need.
authorPhilip Homburg <philip@cs.vu.nl>
Thu, 10 Aug 2006 10:56:16 +0000 (10:56 +0000)
committerPhilip Homburg <philip@cs.vu.nl>
Thu, 10 Aug 2006 10:56:16 +0000 (10:56 +0000)
kernel/system.c
kernel/table.c

index 6f7648e91a7b6dfcd830f2661771a8bfb4e2c6cc..1968e6b8d04b6c1de22ba5e77600c2fed19e4f31 100755 (executable)
@@ -83,20 +83,20 @@ PUBLIC void sys_task()
       caller_ptr = proc_addr(who_p);
 
       /* See if the caller made a valid request and try to handle it. */
-      if (!GET_BIT(priv(caller_ptr)->s_k_call_mask, call_nr)) {
-#if DEBUG_ENABLE_IPC_WARNINGS
-         kprintf("SYSTEM: request %d from %d denied.\n",
-               call_nr,m.m_source);
-#endif
-         result = ECALLDENIED;                 /* illegal message type */
-      } /* else */
-      if (call_nr >= NR_SYS_CALLS) {           /* check call number */
+      if (call_nr < 0 || call_nr >= NR_SYS_CALLS) {    /* check call number */
 #if DEBUG_ENABLE_IPC_WARNINGS
          kprintf("SYSTEM: illegal request %d from %d.\n",
                call_nr,m.m_source);
 #endif
          result = EBADREQUEST;                 /* illegal message type */
       } 
+      else if (!GET_BIT(priv(caller_ptr)->s_k_call_mask, call_nr)) {
+#if DEBUG_ENABLE_IPC_WARNINGS
+         kprintf("SYSTEM: request %d from %d denied.\n",
+               call_nr,m.m_source);
+#endif
+         result = ECALLDENIED;                 /* illegal message type */
+      }
       else {
           result = (*call_vec[call_nr])(&m); /* handle the system call */
       }
index af0746dc64ff2d207f0ce37b90476edf4d6722d1..1ed9dfcae130179e797d7a61f6839e8ce5f02cb1 100755 (executable)
@@ -82,9 +82,9 @@ PUBLIC char *t_stack[TOT_STACK_SPACE / sizeof(char *)];
  */
 #define FS_C SYS_KILL, SYS_VIRCOPY, SYS_SAFECOPYFROM, SYS_SAFECOPYTO, \
     SYS_VIRVCOPY, SYS_UMAP, SYS_GETINFO, SYS_EXIT, SYS_TIMES, SYS_SETALARM, \
-    SYS_PRIVCTL, SYS_TRACE 
+    SYS_PRIVCTL, SYS_TRACE , SYS_SETGRANT
 #define DRV_C  FS_C, SYS_SEGCTL, SYS_IRQCTL, SYS_INT86, SYS_DEVIO, \
-       SYS_SDEVIO, SYS_VDEVIO 
+       SYS_SDEVIO, SYS_VDEVIO, SYS_SETGRANT
 
 PRIVATE int
   fs_c[] = { FS_C },
@@ -92,7 +92,7 @@ PRIVATE int
   rs_c[] = { SYS_ALL_CALLS },
   ds_c[] = { SYS_ALL_CALLS },
   drv_c[] = { DRV_C },
-  tty_c[] = { DRV_C, SYS_ABORT, SYS_VM_MAP, SYS_IOPENABLE },
+  tty_c[] = { DRV_C, SYS_ABORT, SYS_VM_MAP, SYS_IOPENABLE, SYS_READBIOS },
   mem_c[] = { DRV_C, SYS_PHYSCOPY, SYS_PHYSVCOPY, SYS_VM_MAP, SYS_IOPENABLE };
 
 /* The system image table lists all programs that are part of the boot image.