diff -u --recursive --new-file v1.0.1/linux/Makefile linux/Makefile --- v1.0.1/linux/Makefile Fri Mar 18 10:21:32 1994 +++ linux/Makefile Fri Mar 18 10:31:01 1994 @@ -1,6 +1,6 @@ VERSION = 1 PATCHLEVEL = 0 -SUBLEVEL = 1 +SUBLEVEL = 2 all: Version zImage diff -u --recursive --new-file v1.0.1/linux/drivers/scsi/scsi.c linux/drivers/scsi/scsi.c --- v1.0.1/linux/drivers/scsi/scsi.c Mon Mar 14 11:30:54 1994 +++ linux/drivers/scsi/scsi.c Thu Mar 17 09:31:18 1994 @@ -126,6 +126,7 @@ static struct blist blacklist[] = { + {"CHINON","CD-ROM CDS-431","H42"}, /* Locks up if polled for lun != 0 */ {"DENON","DRD-25X","V"}, /* A cdrom that locks up when probed at lun != 0 */ {"IMS", "CDD521/10","2.06"}, /* Locks-up when LUN>0 polled. */ {"MAXTOR","XT-3280","PR02"}, /* Locks-up when LUN>0 polled. */ diff -u --recursive --new-file v1.0.1/linux/drivers/scsi/scsi_ioctl.c linux/drivers/scsi/scsi_ioctl.c --- v1.0.1/linux/drivers/scsi/scsi_ioctl.c Wed Dec 1 14:44:16 1993 +++ linux/drivers/scsi/scsi_ioctl.c Wed Mar 16 19:12:10 1994 @@ -235,7 +235,7 @@ char scsi_cmd[12]; if ((cmd != 0 && dev->index > NR_SCSI_DEVICES)) - return -ENODEV; + return -ENXIO; switch (cmd) { case SCSI_IOCTL_GET_IDLUN: diff -u --recursive --new-file v1.0.1/linux/drivers/scsi/sd.c linux/drivers/scsi/sd.c --- v1.0.1/linux/drivers/scsi/sd.c Wed Dec 1 14:44:16 1993 +++ linux/drivers/scsi/sd.c Wed Mar 16 19:12:09 1994 @@ -59,7 +59,7 @@ target = DEVICE_NR(MINOR(inode->i_rdev)); if(target >= NR_SD || !rscsi_disks[target].device) - return -ENODEV; /* No such device */ + return -ENXIO; /* No such device */ /* Make sure that only one process can do a check_change_disk at one time. This is also used to lock out further access when the partition table is being re-read. */ diff -u --recursive --new-file v1.0.1/linux/drivers/scsi/sg.c linux/drivers/scsi/sg.c --- v1.0.1/linux/drivers/scsi/sg.c Wed Dec 1 14:44:16 1993 +++ linux/drivers/scsi/sg.c Wed Mar 16 19:12:10 1994 @@ -56,7 +56,7 @@ { int dev = MINOR(inode->i_rdev); if ((dev<0) || (dev>=NR_SG)) - return -ENODEV; + return -ENXIO switch(cmd_in) { case SG_SET_TIMEOUT: @@ -74,7 +74,7 @@ int dev=MINOR(inode->i_rdev); int flags=filp->f_flags; if (dev>=NR_SG) - return -ENODEV; + return -ENXIO; if (O_RDWR!=(flags & O_ACCMODE)) return -EACCES; if (flags & O_EXCL) diff -u --recursive --new-file v1.0.1/linux/drivers/scsi/sr.c linux/drivers/scsi/sr.c --- v1.0.1/linux/drivers/scsi/sr.c Fri Dec 17 08:20:30 1993 +++ linux/drivers/scsi/sr.c Wed Mar 16 19:12:09 1994 @@ -260,7 +260,7 @@ static int sr_open(struct inode * inode, struct file * filp) { if(MINOR(inode->i_rdev) >= NR_SR || - !scsi_CDs[MINOR(inode->i_rdev)].device) return -ENODEV; /* No such device */ + !scsi_CDs[MINOR(inode->i_rdev)].device) return -ENXIO; /* No such device */ check_disk_change(inode->i_rdev); diff -u --recursive --new-file v1.0.1/linux/drivers/scsi/sr_ioctl.c linux/drivers/scsi/sr_ioctl.c --- v1.0.1/linux/drivers/scsi/sr_ioctl.c Sat Jan 8 14:35:09 1994 +++ linux/drivers/scsi/sr_ioctl.c Wed Mar 16 19:12:10 1994 @@ -98,7 +98,7 @@ int result, target; target = MINOR(dev); - if (target >= NR_SR) return -ENODEV; + if (target >= NR_SR) return -ENXIO; switch (cmd) { diff -u --recursive --new-file v1.0.1/linux/drivers/scsi/st.c linux/drivers/scsi/st.c --- v1.0.1/linux/drivers/scsi/st.c Thu Dec 30 11:39:06 1993 +++ linux/drivers/scsi/st.c Wed Mar 16 19:12:09 1994 @@ -359,7 +359,7 @@ dev = MINOR(inode->i_rdev) & 127; if (dev >= NR_ST) - return (-ENODEV); + return (-ENXIO); STp = &(scsi_tapes[dev]); if (STp->in_use) { printk("st%d: Device already in use.\n", dev); diff -u --recursive --new-file v1.0.1/linux/include/linux/in.h linux/include/linux/in.h --- v1.0.1/linux/include/linux/in.h Thu Dec 30 13:25:45 1993 +++ linux/include/linux/in.h Fri Mar 18 10:30:26 1994 @@ -135,10 +135,10 @@ static __inline__ unsigned long int __constant_ntohl(unsigned long int x) { - return (((x & 0x000000ff) << 24) | - ((x & 0x0000ff00) << 8) | - ((x & 0x00ff0000) >> 8) | - ((x & 0xff000000) >> 24)); + return (((x & 0x000000ffU) << 24) | + ((x & 0x0000ff00U) << 8) | + ((x & 0x00ff0000U) >> 8) | + ((x & 0xff000000U) >> 24)); } static __inline__ unsigned short int @@ -164,19 +164,19 @@ #ifdef __OPTIMIZE__ # define ntohl(x) \ -(__builtin_constant_p((x)) ? \ +(__builtin_constant_p((long)(x)) ? \ __constant_ntohl((x)) : \ __ntohl((x))) # define ntohs(x) \ -(__builtin_constant_p((x)) ? \ +(__builtin_constant_p((short)(x)) ? \ __constant_ntohs((x)) : \ __ntohs((x))) # define htonl(x) \ -(__builtin_constant_p((x)) ? \ +(__builtin_constant_p((long)(x)) ? \ __constant_htonl((x)) : \ __htonl((x))) # define htons(x) \ -(__builtin_constant_p((x)) ? \ +(__builtin_constant_p((short)(x)) ? \ __constant_htons((x)) : \ __htons((x))) #endif diff -u --recursive --new-file v1.0.1/linux/include/linux/kernel.h linux/include/linux/kernel.h --- v1.0.1/linux/include/linux/kernel.h Tue Jan 25 11:35:03 1994 +++ linux/include/linux/kernel.h Fri Mar 18 10:06:57 1994 @@ -14,6 +14,8 @@ #define LONG_MAX ((long)(~0UL>>1)) #define ULONG_MAX (~0UL) +#define STACK_MAGIC 0xdeadbeef + #define KERN_EMERG "<0>" /* system is unusable */ #define KERN_ALERT "<1>" /* action must be taken immediately */ #define KERN_CRIT "<2>" /* critical conditions */ diff -u --recursive --new-file v1.0.1/linux/kernel/exit.c linux/kernel/exit.c --- v1.0.1/linux/kernel/exit.c Mon Jan 3 08:06:01 1994 +++ linux/kernel/exit.c Fri Mar 18 10:10:24 1994 @@ -89,6 +89,8 @@ if (task[i] == p) { task[i] = NULL; REMOVE_LINKS(p); + if (STACK_MAGIC != *(unsigned long *)p->kernel_stack_page) + printk(KERN_ALERT "release: %s kernel stack corruption. Aiee\n", p->comm); free_page(p->kernel_stack_page); free_page((long) p); return; @@ -395,9 +397,6 @@ } } - current->state = TASK_ZOMBIE; - current->exit_code = code; - current->rss = 0; /* * Check to see if any process groups have become orphaned * as a result of our exiting, and if they have any stopped @@ -456,6 +455,9 @@ disassociate_ctty(1); if (last_task_used_math == current) last_task_used_math = NULL; + current->state = TASK_ZOMBIE; + current->exit_code = code; + current->rss = 0; #ifdef DEBUG_PROC_TREE audit_ptree(); #endif diff -u --recursive --new-file v1.0.1/linux/kernel/fork.c linux/kernel/fork.c --- v1.0.1/linux/kernel/fork.c Fri Mar 4 14:11:01 1994 +++ linux/kernel/fork.c Fri Mar 18 10:15:28 1994 @@ -157,8 +157,9 @@ /* * set up new TSS and kernel stack */ - if (!(p->kernel_stack_page = __get_free_page(GFP_KERNEL))) + if (!(p->kernel_stack_page = get_free_page(GFP_KERNEL))) goto bad_fork_cleanup; + *(unsigned long *)p->kernel_stack_page = STACK_MAGIC; p->tss.es = KERNEL_DS; p->tss.cs = KERNEL_CS; p->tss.ss = KERNEL_DS; diff -u --recursive --new-file v1.0.1/linux/kernel/sched.c linux/kernel/sched.c --- v1.0.1/linux/kernel/sched.c Tue Feb 22 09:05:37 1994 +++ linux/kernel/sched.c Fri Mar 18 10:18:02 1994 @@ -85,7 +85,7 @@ extern int timer_interrupt(void); asmlinkage int system_call(void); -static unsigned long init_kernel_stack[1024]; +static unsigned long init_kernel_stack[1024] = { STACK_MAGIC, }; struct task_struct init_task = INIT_TASK; unsigned long volatile jiffies=0; @@ -95,7 +95,7 @@ struct task_struct * task[NR_TASKS] = {&init_task, }; -long user_stack [ PAGE_SIZE>>2 ] ; +long user_stack [ PAGE_SIZE>>2 ] = { STACK_MAGIC, }; struct { long * a; @@ -772,6 +772,7 @@ static void show_task(int nr,struct task_struct * p) { + int free; static char * stat_nam[] = { "R", "S", "D", "Z", "T", "W" }; printk("%-8s %3d ", p->comm, (p == current) ? -nr : nr); @@ -783,8 +784,11 @@ printk(" current "); else printk(" %08lX ", ((unsigned long *)p->tss.esp)[3]); - printk("%5lu %5d %6d ", - p->tss.esp - p->kernel_stack_page, p->pid, p->p_pptr->pid); + for (free = 1; free < 1024 ; free++) { + if (((unsigned long *)p->kernel_stack_page)[free]) + break; + } + printk("%5lu %5d %6d ", free << 2, p->pid, p->p_pptr->pid); if (p->p_cptr) printk("%5d ", p->p_cptr->pid); else diff -u --recursive --new-file v1.0.1/linux/kernel/traps.c linux/kernel/traps.c --- v1.0.1/linux/kernel/traps.c Mon Mar 14 11:30:56 1994 +++ linux/kernel/traps.c Fri Mar 18 10:12:02 1994 @@ -101,7 +101,10 @@ printk("ds: %04x es: %04x fs: %04x gs: %04x ss: %04x\n", regs->ds, regs->es, regs->fs, regs->gs, ss); store_TR(i); - printk("Pid: %d, process nr: %d (%s)\nStack: ", current->pid, 0xffff & i, current->comm); + if (STACK_MAGIC != *(unsigned long *)current->kernel_stack_page) + printk("Corrupted stack page\n"); + printk("Process %s (pid: %d, process nr: %d, stackpage=%08lx)\nStack: ", + current->comm, current->pid, 0xffff & i, current->kernel_stack_page); for(i=0;i<5;i++) printk("%08lx ", get_seg_long(ss,(i+(unsigned long *)esp))); printk("\nCode: "); diff -u --recursive --new-file v1.0.1/linux/mm/kmalloc.c linux/mm/kmalloc.c --- v1.0.1/linux/mm/kmalloc.c Fri Mar 18 10:21:33 1994 +++ linux/mm/kmalloc.c Wed Mar 16 19:28:07 1994 @@ -300,7 +300,6 @@ } size = p->bh_length; p->bh_flags = MF_FREE; /* As of now this block is officially free */ - save_flags(flags); cli (); p->bh_next = page->firstfree; diff -u --recursive --new-file v1.0.1/linux/net/inet/sock.c linux/net/inet/sock.c --- v1.0.1/linux/net/inet/sock.c Mon Mar 14 11:30:59 1994 +++ linux/net/inet/sock.c Thu Mar 17 15:44:36 1994 @@ -1194,8 +1194,11 @@ * We need to free it up because the tcp module creates * it's own when it accepts one. */ - if (newsock->data) kfree_s(newsock->data, sizeof(struct sock)); - newsock->data = NULL; + if (newsock->data) { + struct sock * sk = (struct sock *) newsock->data; + newsock->data = NULL; + kfree_s(sk, sizeof(struct sock)); + } if (sk1->prot->accept == NULL) return(-EOPNOTSUPP); diff -u --recursive --new-file v1.0.1/linux/net/unix/sock.c linux/net/unix/sock.c --- v1.0.1/linux/net/unix/sock.c Fri Mar 4 09:25:20 1994 +++ linux/net/unix/sock.c Thu Mar 17 10:01:26 1994 @@ -413,10 +413,13 @@ old_fs = get_fs(); set_fs(get_ds()); i = do_mknod(fname, S_IFSOCK | S_IRWXUGO, 0); - if (i == 0) i = open_namei(fname, 0, S_IFSOCK, &upd->inode, NULL); + if (i == -EEXIST) + i = -EADDRINUSE; + if (i == 0) + i = open_namei(fname, 0, S_IFSOCK, &upd->inode, NULL); set_fs(old_fs); if (i < 0) { - printk("UNIX: bind: can't open socket %s\n", fname); + dprintf(1, "UNIX: bind: can't open socket %s\n", fname); return(i); } upd->sockaddr_len = sockaddr_len; /* now its legal */