Patch for FreeBSD 4.5 to run ups

From: callum.gibson_at_db.com
Date: Wed Mar 27 2002 - 00:11:57 GMT

  • Next message: John Utz: "Re: Patch for FreeBSD 4.5 to run ups"
    Hi all,
    
    A followup on my previous post in late Feb regarding ups on FreeBSD 4.5...
    
    This is the patch you need to apply to a FreeBSD 4.5-RELEASE kernel for
    ups to work/compile correctly. You can either use ups compiled on a
    previous release (as I am doing) or recompile on 4.5 as this reportedly
    works now too. Patch kindly supplied by Bakul Shah and Julian Elischer.
    Some non-trivial work will need to be done on ups for it to work on
    the 5.X series systems as it (ups) uses a deprecated interface. Bakul
    has said he will try to work on this soon.
    
        C
    
    Callum Gibson                               callum.gibson_at_db.com
    Global Markets IT, Deutsche Bank, Australia       61 2 9258 1620
    ### The opinions in this message are mine and not Deutsche's ###
    
    Index: sys/ptrace.h
    ===================================================================
    RCS file: /home/ncvs/src/sys/sys/ptrace.h,v
    retrieving revision 1.10.2.1
    diff -u -r1.10.2.1 ptrace.h
    --- sys/ptrace.h	3 Oct 2001 06:55:43 -0000	1.10.2.1
    +++ sys/ptrace.h	1 Mar 2002 21:52:57 -0000
    @@ -40,7 +40,7 @@
     #define	PT_TRACE_ME	0	/* child declares it's being traced */
     #define	PT_READ_I	1	/* read word in child's I space */
     #define	PT_READ_D	2	/* read word in child's D space */
    -/* was	PT_READ_U	3	 * read word in child's user structure */
    +#define	PT_READ_U	3	/* read word in child's user structure */
     #define	PT_WRITE_I	4	/* write word in child's I space */
     #define	PT_WRITE_D	5	/* write word in child's D space */
     /* was	PT_WRITE_U	6	 * write word in child's user structure */
    Index: kern/sys_process.c
    ===================================================================
    RCS file: /home/ncvs/src/sys/kern/sys_process.c,v
    retrieving revision 1.51.2.3
    diff -u -r1.51.2.3 sys_process.c
    --- kern/sys_process.c	22 Jan 2002 17:22:59 -0000	1.51.2.3
    +++ kern/sys_process.c	1 Mar 2002 23:45:18 -0000
    @@ -257,6 +257,7 @@
     
     	case PT_READ_I:
     	case PT_READ_D:
    +	case PT_READ_U:
     	case PT_WRITE_I:
     	case PT_WRITE_D:
     	case PT_CONTINUE:
    @@ -413,6 +417,33 @@
     		}
     		return (error);
     
    +	case PT_READ_U:
    +                 if ((uintptr_t)uap->addr > UPAGES * PAGE_SIZE -
    +                    sizeof(int)) {
    +                         return EFAULT;
    +                 }
    +                 if ((uintptr_t)uap->addr & (sizeof(int) - 1)) {
    +                         return EFAULT;
    +                 }
    +                 if (ptrace_read_u_check(p,(vm_offset_t) uap->addr,
    +                                         sizeof(int))) {
    +                         return EFAULT;
    +                 }
    +                 error = 0;
    +                 PHOLD(p);       /* user had damn well better be incore!*/
    +                 if (p->p_flag & P_INMEM) {
    +                         p->p_addr->u_kproc.kp_proc = *p;
    +                         fill_eproc (p, &p->p_addr->u_kproc.kp_eproc);
    +                         curp->p_retval[0] = *(int *)
    +                             ((uintptr_t)p->p_addr +
    +                             (uintptr_t)uap->addr);
    +                 } else {
    +                         curp->p_retval[0] = 0;
    +                         error = EFAULT;
    +                 }
    +                 PRELE(p);
    +                 return error;
    +
     	case PT_KILL:
     		uap->data = SIGKILL;
     		goto sendsig;	/* in PT_CONTINUE above */
    


    This archive was generated by hypermail 2.1.4 : Thu May 23 2002 - 15:53:57 BST