| Summary: | bad conversions in kern_fork() | ||
|---|---|---|---|
| Product: | Base System | Reporter: | Valentin Nechayev <netch> |
| Component: | kern | Assignee: | freebsd-bugs (Nobody) <bugs> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | 3.3-STABLE | ||
| Hardware: | Any | ||
| OS: | Any | ||
Oops! Please change category to "kern" > bcopy(&p1->p_procsig->ps_begincopy, &p2->p_procsig->ps_begincopy,
> (unsigned)&p1->p_procsig->ps_endcopy -
> (unsigned)&p1->p_procsig->ps_begincopy);
It is fixed in -current. I would not bother to fix it (and some similar
things) in -stable.
Dima
State Changed From-To: open->closed Fixed on 1999/04/24: ---------------------------- revision 1.59 date: 1999/04/24 11:25:01; author: dt; state: Exp; lines: +3 -3 Use pointer arithmetic to do pointer arithmetic. ---------------------------- |
kern_fork.c, since line 357: === cut here === MALLOC (p2->p_procsig, struct procsig *, sizeof(struct procsig), M_SUBPROC, M_WAITOK); bcopy(&p1->p_procsig->ps_begincopy, &p2->p_procsig->ps_begincopy, (unsigned)&p1->p_procsig->ps_endcopy - (unsigned)&p1->p_procsig->ps_begincopy); p2->p_procsig->ps_refcnt = 1; === end cut === This piece of code converts two pointers to integer values and then calculates difference of the values to calculate difference between pointers. It is ugly hack but it works on i386; but on alpha sizeof(int)==4, size of pointer is 8, and conversion loses bits. I cannot understand is this losing significant but in case of really huge memory it shall be. Fix: Change it to calculate difference of two pointers converted to caddr_t.