From owner-freebsd-bugs Thu Jul 18 16:20: 9 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 17B7737B400 for ; Thu, 18 Jul 2002 16:20:03 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 680ED43E67 for ; Thu, 18 Jul 2002 16:20:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g6INK2JU092768 for ; Thu, 18 Jul 2002 16:20:02 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g6INK2Ua092767; Thu, 18 Jul 2002 16:20:02 -0700 (PDT) Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5533B37B401 for ; Thu, 18 Jul 2002 16:15:33 -0700 (PDT) Received: from www.freebsd.org (www.FreeBSD.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id DB80E43E58 for ; Thu, 18 Jul 2002 16:15:32 -0700 (PDT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.12.4/8.12.4) with ESMTP id g6INFWOT050725 for ; Thu, 18 Jul 2002 16:15:32 -0700 (PDT) (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.12.4/8.12.4/Submit) id g6INFWB8050724; Thu, 18 Jul 2002 16:15:32 -0700 (PDT) Message-Id: <200207182315.g6INFWB8050724@www.freebsd.org> Date: Thu, 18 Jul 2002 16:15:32 -0700 (PDT) From: Bill Baumann To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: kern/40745: Inconsistency between net/if.c and struct arpcom alignment in awi, lnc, pdq, and ray ethernet drivers Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 40745 >Category: kern >Synopsis: Inconsistency between net/if.c and struct arpcom alignment in awi, lnc, pdq, and ray ethernet drivers >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Jul 18 16:20:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Bill Baumann >Release: 5.0-CURRENT >Organization: Isilon >Environment: >Description: In net/if.c in a couple of places, the ethernet address is needed. This is stored in the arpcom structure. A couple lines of code in if.c require struct arpcom be at the very begining of device softc structures. Nearly all drivers observe this. However, several do not. net/if.c routines if_findindex() and if_setlladdr() gain access to the ethernet address via the following expression: ((struct arpcom *)ifp->if_softc)->ac_enaddr The above code assumes that the if_softc pointer is equivalent to an struct arpcom pointer. The awi, ray, lnc and pdq drivers have other fields at the beginning of their softc structures. Attempts to set the ethernet address of these devices should cause corruption. >How-To-Repeat: >Fix: Two possible changes -- Change if.c to use the following instead: ((struct arpcom *)ifp)->ac_enaddr Or change the arpcom structure alignment in all four drivers. In a discussion on freebsd-net@FreeBSD.ORG, the consensus was that arpcom should be at the beginning of softc. Apparently, page 77 of Stevens' TCP/IP Illustrated Volume 2 documents this. >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message