valgrind.patch 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. diff -urN y/valgrind-2.2.0/coregrind/vg_libpthread.c x/valgrind-2.2.0/coregrind/vg_libpthread.c
  2. --- valgrind-2.2.0/coregrind/vg_libpthread.c 2004-08-29 15:02:27.000000000 -0600
  3. +++ valgrind-2.2.0/coregrind/vg_libpthread.c 2005-01-21 03:42:19.000000000 -0700
  4. @@ -3389,6 +3389,8 @@
  5. pthread_mutex). So basically, this is completely broken on recent
  6. glibcs. */
  7. +#ifndef __UCLIBC__
  8. +
  9. #undef _IO_flockfile
  10. void _IO_flockfile ( _IO_FILE * file )
  11. {
  12. @@ -3406,6 +3408,7 @@
  13. weak_alias(_IO_funlockfile, funlockfile);
  14. #endif
  15. +#endif
  16. /* This doesn't seem to be needed to simulate libpthread.so's external
  17. interface, but many people complain about its absence. */
  18. diff -urN y/valgrind-2.2.0/coregrind/vg_syscalls.c x/valgrind-2.2.0/coregrind/vg_syscalls.c
  19. --- valgrind-2.2.0/coregrind/vg_syscalls.c 2004-08-30 18:08:37.000000000 -0600
  20. +++ valgrind-2.2.0/coregrind/vg_syscalls.c 2005-01-21 03:49:05.000000000 -0700
  21. @@ -3323,6 +3323,16 @@
  22. break;
  23. # endif /* BLKGETSIZE */
  24. + case BLKBSZSET:
  25. + SYSCALL_TRACK( pre_mem_write,tid, "ioctl(BLKBSZSET)", arg3,
  26. + sizeof(unsigned long));
  27. + break;
  28. + case BLKRAGET:
  29. + SYSCALL_TRACK( pre_mem_write,tid, "ioctl(BLKRAGET)", arg3,
  30. + sizeof(unsigned long));
  31. + break;
  32. + case BLKRASET:
  33. + break;
  34. /* Hard disks */
  35. case HDIO_GET_IDENTITY: /* 0x030d */
  36. SYSCALL_TRACK( pre_mem_write,tid, "ioctl(HDIO_GET_IDENTITY)", arg3,
  37. @@ -3375,6 +3385,7 @@
  38. break;
  39. /* The following two are probably bogus (should check args
  40. for readability). JRS 20021117 */
  41. + case CDROMEJECT:
  42. case CDROM_DRIVE_STATUS: /* 0x5326 */
  43. case CDROM_CLEAR_OPTIONS: /* 0x5321 */
  44. break;
  45. @@ -3383,10 +3394,12 @@
  46. SYSCALL_TRACK( pre_mem_write,tid, "ioctl(FIGETBSZ)", arg3,
  47. sizeof(unsigned long));
  48. break;
  49. +#if 0
  50. case FIBMAP:
  51. SYSCALL_TRACK( pre_mem_read,tid, "ioctl(FIBMAP)", arg3,
  52. sizeof(unsigned long));
  53. break;
  54. +#endif
  55. #ifdef HAVE_LINUX_FB_H
  56. case FBIOGET_VSCREENINFO: /* 0x4600 */
  57. @@ -3483,6 +3496,87 @@
  58. sizeof(struct timeval) );
  59. break;
  60. +#define BLKSSZGET _IO(0x12,104)
  61. + case BLKSSZGET:
  62. + SYSCALL_TRACK( pre_mem_write, tid, "ioctl(BLKSSZGET)", arg3,
  63. + sizeof(int));
  64. + break;
  65. +#undef BLKGETSIZE64
  66. +#undef _IOR
  67. +#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
  68. +#define BLKGETSIZE64 _IOR(0x12,114,size_t)
  69. + case BLKGETSIZE64:
  70. + SYSCALL_TRACK( pre_mem_write, tid, "ioctl(BLKGETSIZE64)", arg3,
  71. + sizeof(uint64_t));
  72. + break;
  73. +#define HDIO_GETGEO 0x0301 /* get device geometry */
  74. + case HDIO_GETGEO:
  75. + {
  76. + struct hd_geometry {
  77. + unsigned char heads;
  78. + unsigned char sectors;
  79. + unsigned short cylinders;
  80. + unsigned long start;
  81. + };
  82. +
  83. + SYSCALL_TRACK( pre_mem_write, tid, "ioctl(HDIO_GETGEO)", arg3,
  84. + sizeof(struct hd_geometry));
  85. + }
  86. + break;
  87. +#define SCSI_IOCTL_GET_IDLUN 0x5382
  88. + case SCSI_IOCTL_GET_IDLUN:
  89. + {
  90. + struct scsi_idlun
  91. + {
  92. + int mux4;
  93. + int host_unique_id;
  94. +
  95. + };
  96. +
  97. + SYSCALL_TRACK( pre_mem_write, tid, "ioctl(SCSI_IOCTL_GET_IDLUN)", arg3,
  98. + sizeof(struct scsi_idlun));
  99. + }
  100. + break;
  101. +#define SCSI_IOCTL_SEND_COMMAND 1
  102. + case SCSI_IOCTL_SEND_COMMAND:
  103. + SYSCALL_TRACK( pre_mem_write, tid, "ioctl(SCSI_IOCTL_SEND_COMMAND)", arg3,
  104. + ((2 * sizeof(unsigned int)) + 6 + 512));
  105. + break;
  106. +#define SCSI_IOCTL_GET_BUS_NUMBER 0x5386
  107. + case SCSI_IOCTL_GET_BUS_NUMBER:
  108. + SYSCALL_TRACK( pre_mem_write, tid, "ioctl(SCSI_IOCTL_GET_BUS_NUMBER)", arg3,
  109. + sizeof(long));
  110. + break;
  111. +#define SCSI_IOCTL_PROBE_HOST 0x5385
  112. + case SCSI_IOCTL_PROBE_HOST:
  113. + {
  114. + unsigned long xxxx;
  115. + char *array = (char*)arg3;
  116. + xxxx = array[0] + (array[1]<<8) + (array[2]<<16) + (array[3]<<24);
  117. + SYSCALL_TRACK( pre_mem_write, tid, "ioctl(SCSI_IOCTL_PROBE_HOST)", arg3,
  118. + sizeof(unsigned long));
  119. + }
  120. + break;
  121. +#define BLKFLSBUF _IO(0x12,97)
  122. + case BLKFLSBUF:
  123. + break;
  124. +#define BLKRRPART _IO(0x12,95)
  125. + case BLKRRPART:
  126. + break;
  127. +#define MTIOCTOP _IO(0x6d,0x1)
  128. + case MTIOCTOP:
  129. + {
  130. + struct mtop
  131. + {
  132. + short int mt_op; /* Operations defined below. */
  133. + int mt_count; /* How many of them. */
  134. + };
  135. + SYSCALL_TRACK( pre_mem_write, tid, "ioctl(MTIOCTOP)", arg3,
  136. + sizeof(struct mtop));
  137. + }
  138. + break;
  139. +
  140. +
  141. /* We don't have any specific information on it, so
  142. try to do something reasonable based on direction and
  143. size bits. The encoding scheme is described in
  144. @@ -3519,12 +3614,16 @@
  145. "guidance on writing a proper wrapper." );
  146. }
  147. } else {
  148. - if ((dir & _IOC_WRITE) && size > 0)
  149. + if ((dir & _IOC_WRITE) && size > 0) {
  150. + VG_(message)(Vg_UserMsg, "genric ioctl 0x%x", arg2);
  151. SYSCALL_TRACK( pre_mem_read,tid, "ioctl(generic)",
  152. arg3, size);
  153. - if ((dir & _IOC_READ) && size > 0)
  154. + }
  155. + if ((dir & _IOC_READ) && size > 0) {
  156. + VG_(message)(Vg_UserMsg, "genric ioctl 0x%x", arg2);
  157. SYSCALL_TRACK( pre_mem_write,tid, "ioctl(generic)",
  158. arg3, size);
  159. + }
  160. }
  161. break;
  162. }
  163. @@ -3874,6 +3973,18 @@
  164. VG_TRACK( post_mem_write,arg3, sizeof(unsigned long));
  165. break;
  166. # endif /* BLKGETSIZE */
  167. + case BLKRAGET:
  168. + if (res == 0)
  169. + VG_TRACK( post_mem_write,arg3, sizeof(unsigned long));
  170. + break;
  171. + case BLKBSZSET:
  172. + if (res == 0)
  173. + VG_TRACK( post_mem_write,arg3, sizeof(unsigned long));
  174. + break;
  175. + case BLKBSZGET:
  176. + if (res == 0)
  177. + VG_TRACK( post_mem_write,arg3, sizeof(unsigned long));
  178. + break;
  179. /* Hard disks */
  180. case HDIO_GET_IDENTITY: /* 0x030d */
  181. @@ -3897,7 +4008,8 @@
  182. case CDROMPLAYMSF:
  183. break;
  184. /* The following two are probably bogus (should check args
  185. - for readability). JRS 20021117 */
  186. + for readability). JRS 20021117 */
  187. + case CDROMEJECT:
  188. case CDROM_DRIVE_STATUS: /* 0x5326 */
  189. case CDROM_CLEAR_OPTIONS: /* 0x5321 */
  190. break;
  191. @@ -3906,10 +4018,12 @@
  192. if (res == 0)
  193. VG_TRACK( post_mem_write,arg3, sizeof(unsigned long));
  194. break;
  195. +#if 0
  196. case FIBMAP:
  197. if (res == 0)
  198. VG_TRACK( post_mem_write,arg3, sizeof(unsigned long));
  199. break;
  200. +#endif
  201. #ifdef HAVE_LINUX_FB_H
  202. case FBIOGET_VSCREENINFO: //0x4600
  203. @@ -3965,6 +4079,28 @@
  204. VG_TRACK( post_mem_write, arg3, sizeof(struct timeval) );
  205. break;
  206. + case SCSI_IOCTL_GET_IDLUN:
  207. + {
  208. + struct scsi_idlun
  209. + {
  210. + int mux4;
  211. + int host_unique_id;
  212. +
  213. + };
  214. +
  215. + VG_TRACK( post_mem_write, arg3, sizeof(struct scsi_idlun) );
  216. + }
  217. + break;
  218. + case SCSI_IOCTL_SEND_COMMAND:
  219. + VG_TRACK( post_mem_write, arg3, ((2 * sizeof(unsigned int)) + 6 + 512));
  220. + break;
  221. + case SCSI_IOCTL_GET_BUS_NUMBER:
  222. + VG_TRACK( post_mem_write, arg3, sizeof(long) );
  223. + break;
  224. + case SCSI_IOCTL_PROBE_HOST:
  225. + VG_TRACK( post_mem_write, arg3, sizeof(unsigned long) );
  226. + break;
  227. +
  228. /* We don't have any specific information on it, so
  229. try to do something reasonable based on direction and
  230. size bits. The encoding scheme is described in
  231. --- valgrind-2.2.0.orig/coregrind/vg_unsafe.h 2005-02-18 18:49:47.000000000 -0700
  232. +++ valgrind-2.2.0/coregrind/vg_unsafe.h 2005-02-18 19:40:39.000000000 -0700
  233. @@ -72,7 +72,13 @@
  234. #ifndef HAVE_U16
  235. typedef unsigned short u16;
  236. #endif
  237. -#include <linux/mii.h> /* for mii_* structs */
  238. +/* Extracted from linux/mii.h for mii_* structs */
  239. +struct mii_ioctl_data {
  240. + u16 phy_id;
  241. + u16 reg_num;
  242. + u16 val_in;
  243. + u16 val_out;
  244. +};
  245. #endif
  246. #include <linux/ppdev.h> /* for PP* ioctls */