home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / KERNEL-S / V1.0 / PATCH2.GZ / patch2
Encoding:
Text File  |  1994-03-18  |  10.5 KB  |  309 lines

  1. diff -u --recursive --new-file v1.0.1/linux/Makefile linux/Makefile
  2. --- v1.0.1/linux/Makefile    Fri Mar 18 10:21:32 1994
  3. +++ linux/Makefile    Fri Mar 18 10:31:01 1994
  4. @@ -1,6 +1,6 @@
  5.  VERSION = 1
  6.  PATCHLEVEL = 0
  7. -SUBLEVEL = 1
  8. +SUBLEVEL = 2
  9.  
  10.  all:    Version zImage
  11.  
  12. diff -u --recursive --new-file v1.0.1/linux/drivers/scsi/scsi.c linux/drivers/scsi/scsi.c
  13. --- v1.0.1/linux/drivers/scsi/scsi.c    Mon Mar 14 11:30:54 1994
  14. +++ linux/drivers/scsi/scsi.c    Thu Mar 17 09:31:18 1994
  15. @@ -126,6 +126,7 @@
  16.  
  17.  static struct blist blacklist[] = 
  18.  {
  19. +   {"CHINON","CD-ROM CDS-431","H42"},  /* Locks up if polled for lun != 0 */
  20.     {"DENON","DRD-25X","V"},   /* A cdrom that locks up when probed at lun != 0 */
  21.     {"IMS", "CDD521/10","2.06"},   /* Locks-up when LUN>0 polled. */
  22.     {"MAXTOR","XT-3280","PR02"},   /* Locks-up when LUN>0 polled. */
  23. diff -u --recursive --new-file v1.0.1/linux/drivers/scsi/scsi_ioctl.c linux/drivers/scsi/scsi_ioctl.c
  24. --- v1.0.1/linux/drivers/scsi/scsi_ioctl.c    Wed Dec  1 14:44:16 1993
  25. +++ linux/drivers/scsi/scsi_ioctl.c    Wed Mar 16 19:12:10 1994
  26. @@ -235,7 +235,7 @@
  27.          char scsi_cmd[12];
  28.  
  29.      if ((cmd != 0 && dev->index > NR_SCSI_DEVICES))
  30. -        return -ENODEV;
  31. +        return -ENXIO;
  32.      
  33.      switch (cmd) {
  34.              case SCSI_IOCTL_GET_IDLUN:
  35. diff -u --recursive --new-file v1.0.1/linux/drivers/scsi/sd.c linux/drivers/scsi/sd.c
  36. --- v1.0.1/linux/drivers/scsi/sd.c    Wed Dec  1 14:44:16 1993
  37. +++ linux/drivers/scsi/sd.c    Wed Mar 16 19:12:09 1994
  38. @@ -59,7 +59,7 @@
  39.      target =  DEVICE_NR(MINOR(inode->i_rdev));
  40.  
  41.      if(target >= NR_SD || !rscsi_disks[target].device)
  42. -      return -ENODEV;   /* No such device */
  43. +      return -ENXIO;   /* No such device */
  44.      
  45.  /* Make sure that only one process can do a check_change_disk at one time.
  46.   This is also used to lock out further access when the partition table is being re-read. */
  47. diff -u --recursive --new-file v1.0.1/linux/drivers/scsi/sg.c linux/drivers/scsi/sg.c
  48. --- v1.0.1/linux/drivers/scsi/sg.c    Wed Dec  1 14:44:16 1993
  49. +++ linux/drivers/scsi/sg.c    Wed Mar 16 19:12:10 1994
  50. @@ -56,7 +56,7 @@
  51.   {
  52.    int dev = MINOR(inode->i_rdev);
  53.    if ((dev<0) || (dev>=NR_SG))
  54. -   return -ENODEV;
  55. +   return -ENXIO
  56.    switch(cmd_in)
  57.     {
  58.      case SG_SET_TIMEOUT:
  59. @@ -74,7 +74,7 @@
  60.    int dev=MINOR(inode->i_rdev);
  61.    int flags=filp->f_flags;
  62.    if (dev>=NR_SG)
  63. -   return -ENODEV;
  64. +   return -ENXIO;
  65.    if (O_RDWR!=(flags & O_ACCMODE))
  66.     return -EACCES;
  67.    if (flags & O_EXCL)
  68. diff -u --recursive --new-file v1.0.1/linux/drivers/scsi/sr.c linux/drivers/scsi/sr.c
  69. --- v1.0.1/linux/drivers/scsi/sr.c    Fri Dec 17 08:20:30 1993
  70. +++ linux/drivers/scsi/sr.c    Wed Mar 16 19:12:09 1994
  71. @@ -260,7 +260,7 @@
  72.  static int sr_open(struct inode * inode, struct file * filp)
  73.  {
  74.      if(MINOR(inode->i_rdev) >= NR_SR || 
  75. -       !scsi_CDs[MINOR(inode->i_rdev)].device) return -ENODEV;   /* No such device */
  76. +       !scsi_CDs[MINOR(inode->i_rdev)].device) return -ENXIO;   /* No such device */
  77.  
  78.          check_disk_change(inode->i_rdev);
  79.  
  80. diff -u --recursive --new-file v1.0.1/linux/drivers/scsi/sr_ioctl.c linux/drivers/scsi/sr_ioctl.c
  81. --- v1.0.1/linux/drivers/scsi/sr_ioctl.c    Sat Jan  8 14:35:09 1994
  82. +++ linux/drivers/scsi/sr_ioctl.c    Wed Mar 16 19:12:10 1994
  83. @@ -98,7 +98,7 @@
  84.      int result, target;
  85.  
  86.      target = MINOR(dev);
  87. -    if (target >= NR_SR) return -ENODEV;
  88. +    if (target >= NR_SR) return -ENXIO;
  89.  
  90.      switch (cmd) 
  91.          {
  92. diff -u --recursive --new-file v1.0.1/linux/drivers/scsi/st.c linux/drivers/scsi/st.c
  93. --- v1.0.1/linux/drivers/scsi/st.c    Thu Dec 30 11:39:06 1993
  94. +++ linux/drivers/scsi/st.c    Wed Mar 16 19:12:09 1994
  95. @@ -359,7 +359,7 @@
  96.  
  97.      dev = MINOR(inode->i_rdev) & 127;
  98.      if (dev >= NR_ST)
  99. -      return (-ENODEV);
  100. +      return (-ENXIO);
  101.      STp = &(scsi_tapes[dev]);
  102.      if (STp->in_use) {
  103.        printk("st%d: Device already in use.\n", dev);
  104. diff -u --recursive --new-file v1.0.1/linux/include/linux/in.h linux/include/linux/in.h
  105. --- v1.0.1/linux/include/linux/in.h    Thu Dec 30 13:25:45 1993
  106. +++ linux/include/linux/in.h    Fri Mar 18 10:30:26 1994
  107. @@ -135,10 +135,10 @@
  108.  static __inline__ unsigned long int
  109.  __constant_ntohl(unsigned long int x)
  110.  {
  111. -    return (((x & 0x000000ff) << 24) |
  112. -        ((x & 0x0000ff00) <<  8) |
  113. -        ((x & 0x00ff0000) >>  8) |
  114. -        ((x & 0xff000000) >> 24));
  115. +    return (((x & 0x000000ffU) << 24) |
  116. +        ((x & 0x0000ff00U) <<  8) |
  117. +        ((x & 0x00ff0000U) >>  8) |
  118. +        ((x & 0xff000000U) >> 24));
  119.  }
  120.  
  121.  static __inline__ unsigned short int
  122. @@ -164,19 +164,19 @@
  123.  
  124.  #ifdef  __OPTIMIZE__
  125.  #  define ntohl(x) \
  126. -(__builtin_constant_p((x)) ? \
  127. +(__builtin_constant_p((long)(x)) ? \
  128.   __constant_ntohl((x)) : \
  129.   __ntohl((x)))
  130.  #  define ntohs(x) \
  131. -(__builtin_constant_p((x)) ? \
  132. +(__builtin_constant_p((short)(x)) ? \
  133.   __constant_ntohs((x)) : \
  134.   __ntohs((x)))
  135.  #  define htonl(x) \
  136. -(__builtin_constant_p((x)) ? \
  137. +(__builtin_constant_p((long)(x)) ? \
  138.   __constant_htonl((x)) : \
  139.   __htonl((x)))
  140.  #  define htons(x) \
  141. -(__builtin_constant_p((x)) ? \
  142. +(__builtin_constant_p((short)(x)) ? \
  143.   __constant_htons((x)) : \
  144.   __htons((x)))
  145.  #endif
  146. diff -u --recursive --new-file v1.0.1/linux/include/linux/kernel.h linux/include/linux/kernel.h
  147. --- v1.0.1/linux/include/linux/kernel.h    Tue Jan 25 11:35:03 1994
  148. +++ linux/include/linux/kernel.h    Fri Mar 18 10:06:57 1994
  149. @@ -14,6 +14,8 @@
  150.  #define LONG_MAX    ((long)(~0UL>>1))
  151.  #define ULONG_MAX    (~0UL)
  152.  
  153. +#define STACK_MAGIC    0xdeadbeef
  154. +
  155.  #define    KERN_EMERG    "<0>"    /* system is unusable            */
  156.  #define    KERN_ALERT    "<1>"    /* action must be taken immediately    */
  157.  #define    KERN_CRIT    "<2>"    /* critical conditions            */
  158. diff -u --recursive --new-file v1.0.1/linux/kernel/exit.c linux/kernel/exit.c
  159. --- v1.0.1/linux/kernel/exit.c    Mon Jan  3 08:06:01 1994
  160. +++ linux/kernel/exit.c    Fri Mar 18 10:10:24 1994
  161. @@ -89,6 +89,8 @@
  162.          if (task[i] == p) {
  163.              task[i] = NULL;
  164.              REMOVE_LINKS(p);
  165. +            if (STACK_MAGIC != *(unsigned long *)p->kernel_stack_page)
  166. +                printk(KERN_ALERT "release: %s kernel stack corruption. Aiee\n", p->comm);
  167.              free_page(p->kernel_stack_page);
  168.              free_page((long) p);
  169.              return;
  170. @@ -395,9 +397,6 @@
  171.          }
  172.      }
  173.  
  174. -    current->state = TASK_ZOMBIE;
  175. -    current->exit_code = code;
  176. -    current->rss = 0;
  177.      /* 
  178.       * Check to see if any process groups have become orphaned
  179.       * as a result of our exiting, and if they have any stopped
  180. @@ -456,6 +455,9 @@
  181.          disassociate_ctty(1);
  182.      if (last_task_used_math == current)
  183.          last_task_used_math = NULL;
  184. +    current->state = TASK_ZOMBIE;
  185. +    current->exit_code = code;
  186. +    current->rss = 0;
  187.  #ifdef DEBUG_PROC_TREE
  188.      audit_ptree();
  189.  #endif
  190. diff -u --recursive --new-file v1.0.1/linux/kernel/fork.c linux/kernel/fork.c
  191. --- v1.0.1/linux/kernel/fork.c    Fri Mar  4 14:11:01 1994
  192. +++ linux/kernel/fork.c    Fri Mar 18 10:15:28 1994
  193. @@ -157,8 +157,9 @@
  194.  /*
  195.   * set up new TSS and kernel stack
  196.   */
  197. -    if (!(p->kernel_stack_page = __get_free_page(GFP_KERNEL)))
  198. +    if (!(p->kernel_stack_page = get_free_page(GFP_KERNEL)))
  199.          goto bad_fork_cleanup;
  200. +    *(unsigned long *)p->kernel_stack_page = STACK_MAGIC;
  201.      p->tss.es = KERNEL_DS;
  202.      p->tss.cs = KERNEL_CS;
  203.      p->tss.ss = KERNEL_DS;
  204. diff -u --recursive --new-file v1.0.1/linux/kernel/sched.c linux/kernel/sched.c
  205. --- v1.0.1/linux/kernel/sched.c    Tue Feb 22 09:05:37 1994
  206. +++ linux/kernel/sched.c    Fri Mar 18 10:18:02 1994
  207. @@ -85,7 +85,7 @@
  208.  extern int timer_interrupt(void);
  209.  asmlinkage int system_call(void);
  210.  
  211. -static unsigned long init_kernel_stack[1024];
  212. +static unsigned long init_kernel_stack[1024] = { STACK_MAGIC, };
  213.  struct task_struct init_task = INIT_TASK;
  214.  
  215.  unsigned long volatile jiffies=0;
  216. @@ -95,7 +95,7 @@
  217.  
  218.  struct task_struct * task[NR_TASKS] = {&init_task, };
  219.  
  220. -long user_stack [ PAGE_SIZE>>2 ] ;
  221. +long user_stack [ PAGE_SIZE>>2 ] = { STACK_MAGIC, };
  222.  
  223.  struct {
  224.      long * a;
  225. @@ -772,6 +772,7 @@
  226.  
  227.  static void show_task(int nr,struct task_struct * p)
  228.  {
  229. +    int free;
  230.      static char * stat_nam[] = { "R", "S", "D", "Z", "T", "W" };
  231.  
  232.      printk("%-8s %3d ", p->comm, (p == current) ? -nr : nr);
  233. @@ -783,8 +784,11 @@
  234.          printk(" current  ");
  235.      else
  236.          printk(" %08lX ", ((unsigned long *)p->tss.esp)[3]);
  237. -    printk("%5lu %5d %6d ",
  238. -        p->tss.esp - p->kernel_stack_page, p->pid, p->p_pptr->pid);
  239. +    for (free = 1; free < 1024 ; free++) {
  240. +        if (((unsigned long *)p->kernel_stack_page)[free])
  241. +            break;
  242. +    }
  243. +    printk("%5lu %5d %6d ", free << 2, p->pid, p->p_pptr->pid);
  244.      if (p->p_cptr)
  245.          printk("%5d ", p->p_cptr->pid);
  246.      else
  247. diff -u --recursive --new-file v1.0.1/linux/kernel/traps.c linux/kernel/traps.c
  248. --- v1.0.1/linux/kernel/traps.c    Mon Mar 14 11:30:56 1994
  249. +++ linux/kernel/traps.c    Fri Mar 18 10:12:02 1994
  250. @@ -101,7 +101,10 @@
  251.      printk("ds: %04x   es: %04x   fs: %04x   gs: %04x   ss: %04x\n",
  252.          regs->ds, regs->es, regs->fs, regs->gs, ss);
  253.      store_TR(i);
  254. -    printk("Pid: %d, process nr: %d (%s)\nStack: ", current->pid, 0xffff & i, current->comm);
  255. +    if (STACK_MAGIC != *(unsigned long *)current->kernel_stack_page)
  256. +        printk("Corrupted stack page\n");
  257. +    printk("Process %s (pid: %d, process nr: %d, stackpage=%08lx)\nStack: ",
  258. +        current->comm, current->pid, 0xffff & i, current->kernel_stack_page);
  259.      for(i=0;i<5;i++)
  260.          printk("%08lx ", get_seg_long(ss,(i+(unsigned long *)esp)));
  261.      printk("\nCode: ");
  262. diff -u --recursive --new-file v1.0.1/linux/mm/kmalloc.c linux/mm/kmalloc.c
  263. --- v1.0.1/linux/mm/kmalloc.c    Fri Mar 18 10:21:33 1994
  264. +++ linux/mm/kmalloc.c    Wed Mar 16 19:28:07 1994
  265. @@ -300,7 +300,6 @@
  266.      }
  267.  size = p->bh_length;
  268.  p->bh_flags = MF_FREE; /* As of now this block is officially free */
  269. -
  270.  save_flags(flags);
  271.  cli ();
  272.  p->bh_next = page->firstfree;
  273. diff -u --recursive --new-file v1.0.1/linux/net/inet/sock.c linux/net/inet/sock.c
  274. --- v1.0.1/linux/net/inet/sock.c    Mon Mar 14 11:30:59 1994
  275. +++ linux/net/inet/sock.c    Thu Mar 17 15:44:36 1994
  276. @@ -1194,8 +1194,11 @@
  277.     * We need to free it up because the tcp module creates
  278.     * it's own when it accepts one.
  279.     */
  280. -  if (newsock->data) kfree_s(newsock->data, sizeof(struct sock));
  281. -  newsock->data = NULL;
  282. +  if (newsock->data) {
  283. +      struct sock * sk = (struct sock *) newsock->data;
  284. +      newsock->data = NULL;
  285. +      kfree_s(sk, sizeof(struct sock));
  286. +  }
  287.  
  288.    if (sk1->prot->accept == NULL) return(-EOPNOTSUPP);
  289.  
  290. diff -u --recursive --new-file v1.0.1/linux/net/unix/sock.c linux/net/unix/sock.c
  291. --- v1.0.1/linux/net/unix/sock.c    Fri Mar  4 09:25:20 1994
  292. +++ linux/net/unix/sock.c    Thu Mar 17 10:01:26 1994
  293. @@ -413,10 +413,13 @@
  294.    old_fs = get_fs();
  295.    set_fs(get_ds());
  296.    i = do_mknod(fname, S_IFSOCK | S_IRWXUGO, 0);
  297. -  if (i == 0) i = open_namei(fname, 0, S_IFSOCK, &upd->inode, NULL);
  298. +  if (i == -EEXIST)
  299. +      i = -EADDRINUSE;
  300. +  if (i == 0)
  301. +      i = open_namei(fname, 0, S_IFSOCK, &upd->inode, NULL);
  302.    set_fs(old_fs);
  303.    if (i < 0) {
  304. -    printk("UNIX: bind: can't open socket %s\n", fname);
  305. +    dprintf(1, "UNIX: bind: can't open socket %s\n", fname);
  306.      return(i);
  307.    }
  308.    upd->sockaddr_len = sockaddr_len;    /* now its legal */
  309.