From netch@aleph.carrier.kiev.ua Tue Oct 5 09:01:24 1999 Return-Path: Received: from aleph.carrier.kiev.ua (aleph.carrier.kiev.ua [193.193.193.3]) by hub.freebsd.org (Postfix) with ESMTP id B91D315608 for ; Tue, 5 Oct 1999 09:01:12 -0700 (PDT) (envelope-from netch@aleph.carrier.kiev.ua) Received: (from netch@localhost) by aleph.carrier.kiev.ua (8.9.3-lucky-netch-pl10/8.9.3) id TAL07778; Tue, 5 Oct 1999 19:01:09 +0300 (EEST) (envelope-from netch) Message-Id: <199910051601.TAL07778@aleph.carrier.kiev.ua> Date: Tue, 5 Oct 1999 19:01:09 +0300 (EEST) From: netch@lucky.net (Valentin Nechayev) Sender: netch@aleph.carrier.kiev.ua Reply-To: netch@lucky.net To: FreeBSD-gnats-submit@freebsd.org Subject: bad conversions in kern_fork() X-Send-Pr-Version: 3.2 >Number: 14144 >Category: kern >Synopsis: bad conversions in kern_fork() >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: closed >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Oct 5 09:10:01 PDT 1999 >Closed-Date: Thu May 24 12:06:39 PDT 2001 >Last-Modified: Thu May 24 12:07:02 PDT 2001 >Originator: Valentin Nechayev >Release: FreeBSD 3.3-STABLE alpha >Organization: Lucky Net Ltd. >Environment: FreeBSD kernel sources ;) (3.3-stable) >Description: 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. >How-To-Repeat: >Fix: Change it to calculate difference of two pointers converted to caddr_t. >Release-Note: >Audit-Trail: From: netch@lucky.net To: freebsd-gnats-submit@freebsd.org, netch@lucky.net Cc: Subject: Re: bin/14144: bad conversions in kern_fork() Date: Tue, 5 Oct 1999 19:14:45 +0300 (EEST) Oops! Please change category to "kern" From: Dmitrij Tejblum To: netch@lucky.net Cc: FreeBSD-gnats-submit@FreeBSD.ORG Subject: Re: bin/14144: bad conversions in kern_fork() Date: Tue, 05 Oct 1999 20:27:08 +0400 > 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 State-Changed-By: kris State-Changed-When: Thu May 24 12:06:39 PDT 2001 State-Changed-Why: 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. ---------------------------- http://www.FreeBSD.org/cgi/query-pr.cgi?pr=14144 >Unformatted: