Advertisement
Guest User

John Morris

a guest
Dec 1st, 2009
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.77 KB | None | 0 0
  1. diff -ur ibcs-3.8.org/coff/binfmt-coff.c ibcs-3.8/coff/binfmt-coff.c
  2. --- ibcs-3.8.org/coff/binfmt-coff.c 2008-07-25 21:03:35.000000000 -0500
  3. +++ ibcs-3.8/coff/binfmt-coff.c 2009-09-18 15:54:06.000000000 -0500
  4. @@ -66,7 +66,6 @@
  5. };
  6. #endif
  7.  
  8. -
  9. typedef struct coff_section {
  10. long scnptr;
  11. long size;
  12. @@ -320,10 +319,17 @@
  13. int pageable = 1, sections = 0, status = 0, i, ce;
  14. int coff_exec_fileno;
  15. mm_segment_t old_fs;
  16. + kernel_cap_t cur_cap_effective;
  17. +
  18.  
  19. +#if _KSL > 30
  20. + cur_cap_effective = current_cap();
  21. +#else
  22. + cur_cap_effective = current->cap_effective;
  23. +#endif
  24.  
  25. lPers = abi_personality((char *)_BX(regs));
  26. - ce = cap_raised(current->cap_effective,CAP_SYS_RAWIO);
  27. + ce = cap_raised(cur_cap_effective,CAP_SYS_RAWIO);
  28.  
  29. coff_hdr = (COFF_FILHDR *)bprm->buf;
  30.  
  31. @@ -623,7 +629,11 @@
  32. (current->mm->start_brk = bss.vaddr);
  33.  
  34. current->mm->start_stack = p;
  35. +#if _KSL > 30
  36. + install_exec_creds(bprm);
  37. +#else
  38. compute_creds(bprm);
  39. +#endif
  40.  
  41. #if _KSL < 15
  42. #ifdef CONFIG_64BIT
  43. @@ -676,11 +686,11 @@
  44. status = 0;
  45. } else {
  46. /* map the text pages...*/
  47. - cap_raise(current->cap_effective,CAP_SYS_RAWIO);
  48. + cap_raise(cur_cap_effective,CAP_SYS_RAWIO);
  49. m_addr = map_coff(bprm->file, &text, PROT_READ | PROT_EXEC,
  50. MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE,
  51. text.scnptr & PAGE_MASK);
  52. - if(!ce) cap_lower(current->cap_effective,CAP_SYS_RAWIO);
  53. + if(!ce) cap_lower(cur_cap_effective,CAP_SYS_RAWIO);
  54.  
  55. if (m_addr != (text.vaddr & PAGE_MASK)) {
  56. status = -ENOEXEC;
  57. @@ -690,12 +700,12 @@
  58.  
  59. /* map the data pages */
  60. if (data.size != 0) {
  61. - cap_raise(current->cap_effective,CAP_SYS_RAWIO);
  62. + cap_raise(cur_cap_effective,CAP_SYS_RAWIO);
  63. m_addr = map_coff(bprm->file, &data,
  64. PROT_READ | PROT_WRITE | PROT_EXEC,
  65. MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE,
  66. data.scnptr & PAGE_MASK);
  67. - if(!ce) cap_lower(current->cap_effective,CAP_SYS_RAWIO);
  68. + if(!ce) cap_lower(cur_cap_effective,CAP_SYS_RAWIO);
  69.  
  70. if (m_addr != (data.vaddr & PAGE_MASK)) {
  71. status = -ENOEXEC;
  72. @@ -713,7 +723,7 @@
  73. * of the bss section. Allocate any necessary pages for the data.
  74. */
  75. if (bss.size != 0) {
  76. - cap_raise(current->cap_effective,CAP_SYS_RAWIO);
  77. + cap_raise(cur_cap_effective,CAP_SYS_RAWIO);
  78. down_write(&current->mm->mmap_sem);
  79. do_mmap(NULL, PAGE_ALIGN(bss.vaddr),
  80. bss.size + bss.vaddr -
  81. @@ -721,7 +731,7 @@
  82. PROT_READ | PROT_WRITE | PROT_EXEC,
  83. MAP_FIXED | MAP_PRIVATE | MAP_32BIT, 0);
  84. up_write(&current->mm->mmap_sem);
  85. - if(!ce) cap_lower(current->cap_effective,CAP_SYS_RAWIO);
  86. + if(!ce) cap_lower(cur_cap_effective,CAP_SYS_RAWIO);
  87.  
  88. if ((status = coff_clear_memory(bss.vaddr, bss.size)) < 0) {
  89. set_fs(old_fs);
  90. diff -ur ibcs-3.8.org/cxenix/misc.c ibcs-3.8/cxenix/misc.c
  91. --- ibcs-3.8.org/cxenix/misc.c 2008-07-16 07:49:22.000000000 -0500
  92. +++ ibcs-3.8/cxenix/misc.c 2009-09-18 17:13:37.000000000 -0500
  93. @@ -301,16 +301,21 @@
  94. uid_t ouid;
  95. gid_t ogid;
  96. int err;
  97. +#if _KSL > 30
  98. + struct cred *cred = current_cred();
  99. +#else
  100. + struct task_struct cred = current;
  101. +#endif
  102.  
  103. - ouid = current->uid;
  104. - ogid = current->gid;
  105. - current->uid = current->euid;
  106. - current->gid = current->egid;
  107. + ouid = cred->uid;
  108. + ogid = cred->gid;
  109. + cred->uid = cred->euid;
  110. + cred->gid = cred->egid;
  111.  
  112. err = SYS(access,path, mode);
  113.  
  114. - current->uid = ouid;
  115. - current->gid = ogid;
  116. + cred->uid = ouid;
  117. + cred->gid = ogid;
  118.  
  119. return err;
  120. }
  121. diff -ur ibcs-3.8.org/sco/secureware.c ibcs-3.8/sco/secureware.c
  122. --- ibcs-3.8.org/sco/secureware.c 2007-02-27 10:02:00.000000000 -0600
  123. +++ ibcs-3.8/sco/secureware.c 2009-09-18 17:14:40.000000000 -0500
  124. @@ -46,7 +46,11 @@
  125. * specifically so we'll just use the real uid
  126. * instead - it should be good enough.
  127. */
  128. +#if _KSL > 30
  129. + return (current_cred()->uid);
  130. +#else
  131. return (current->uid);
  132. +#endif
  133. case SW_SETLUID:
  134. /*
  135. * Strictly we should only be able to call setluid()
  136. diff -ur ibcs-3.8.org/svr4/misc.c ibcs-3.8/svr4/misc.c
  137. --- ibcs-3.8.org/svr4/misc.c 2009-01-31 18:42:01.000000000 -0600
  138. +++ ibcs-3.8/svr4/misc.c 2009-09-18 17:17:19.000000000 -0500
  139. @@ -227,8 +227,13 @@
  140. int
  141. abi_getuid(struct pt_regs *regs)
  142. {
  143. +#if _KSL > 30
  144. + _DX(regs) = current_cred()->euid;
  145. + return current_cred()->uid;
  146. +#else
  147. _DX(regs) = current->euid;
  148. return current->uid;
  149. +#endif
  150. }
  151.  
  152. /*
  153. @@ -237,8 +242,13 @@
  154. int
  155. abi_getgid(struct pt_regs *regs)
  156. {
  157. +#if _KSL > 30
  158. + _DX(regs) = current_cred()->egid;
  159. + return current_cred()->gid;
  160. +#else
  161. _DX(regs) = current->egid;
  162. return current->gid;
  163. +#endif
  164. }
  165.  
  166.  
  167. diff -ur ibcs-3.8.org/uw7/access.c ibcs-3.8/uw7/access.c
  168. --- ibcs-3.8.org/uw7/access.c 2009-01-23 17:31:43.000000000 -0600
  169. +++ ibcs-3.8/uw7/access.c 2009-09-18 17:21:01.000000000 -0500
  170. @@ -103,14 +103,19 @@
  171. mode |= UW7_X_OK;
  172. }
  173. if (mode & UW7_EFF_ONLY_OK) {
  174. - uid_t old_uid = current->uid, old_gid = current->gid;
  175. +#if _KSL > 30
  176. + struct cred *cred = current_cred();
  177. +#else
  178. + struct task_struct cred = current;
  179. +#endif
  180. + uid_t old_uid = cred->uid, old_gid = cred->gid;
  181.  
  182. - current->uid = current->euid;
  183. - current->gid = current->egid;
  184. + cred->uid = cred->euid;
  185. + cred->gid = cred->egid;
  186. mode &= ~UW7_EFF_ONLY_OK;
  187. error = SYS(access,filename, mode);
  188. - current->uid = old_uid;
  189. - current->gid = old_gid;
  190. + cred->uid = old_uid;
  191. + cred->gid = old_gid;
  192. } else
  193. error = SYS(access,filename, mode);
  194.  
  195. diff -ur ibcs-3.8.org/xout/binfmt-xout.c ibcs-3.8/xout/binfmt-xout.c
  196. --- ibcs-3.8.org/xout/binfmt-xout.c 2008-07-25 20:51:03.000000000 -0500
  197. +++ ibcs-3.8/xout/binfmt-xout.c 2009-09-18 17:30:42.000000000 -0500
  198. @@ -149,9 +149,15 @@
  199. {
  200. u_long bss_size, bss_base, ce;
  201. int err = 0;
  202. + kernel_cap_t cur_cap_effective;
  203.  
  204. - ce = cap_raised(current->cap_effective,CAP_SYS_RAWIO);
  205. - cap_raise(current->cap_effective,CAP_SYS_RAWIO);
  206. +#if _KSL > 30
  207. + cur_cap_effective = current_cap();
  208. +#else
  209. + cur_cap_effective = current->cap_effective;
  210. +#endif
  211. + ce = cap_raised(cur_cap_effective,CAP_SYS_RAWIO);
  212. + cap_raise(cur_cap_effective,CAP_SYS_RAWIO);
  213.  
  214. bss_size = sp->xs_vsize - sp->xs_psize;
  215. bss_base = sp->xs_rbase + sp->xs_psize;
  216. @@ -222,7 +228,7 @@
  217. }
  218.  
  219. out:
  220. - if (!ce) cap_lower(current->cap_effective,CAP_SYS_RAWIO);
  221. + if (!ce) cap_lower(cur_cap_effective,CAP_SYS_RAWIO);
  222. return (err);
  223. }
  224.  
  225. @@ -397,7 +403,11 @@
  226. current->mm->start_brk =
  227. current->mm->brk = xexec->x_text + xexec->x_data + xexec->x_bss;
  228.  
  229. +#if _KSL > 30
  230. + install_exec_creds(bpp);
  231. +#else
  232. compute_creds(bpp);
  233. +#endif
  234. current->flags &= ~PF_FORKNOEXEC;
  235.  
  236. #if _KSL < 15
  237.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement