From owner-freebsd-current@FreeBSD.ORG Wed May 14 06:54:08 2014 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9F1FD9F8 for ; Wed, 14 May 2014 06:54:08 +0000 (UTC) Received: from stargate.chelsio.com (stargate.chelsio.com [67.207.112.58]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7F663203F for ; Wed, 14 May 2014 06:54:08 +0000 (UTC) Received: from nice.asicdesigners.com (nice.asicdesigners.com [10.192.160.7]) by stargate.chelsio.com (8.13.8/8.13.8) with ESMTP id s4E6s2p2021459 for ; Tue, 13 May 2014 23:54:02 -0700 Received: from NICE.asicdesigners.com ([fe80::51b2:ba95:9d72:babc]) by nice.asicdesigners.com ([fe80::51b2:ba95:9d72:babc%15]) with mapi id 14.02.0247.003; Tue, 13 May 2014 23:54:02 -0700 From: Sreenivasa Honnur To: "freebsd-current@freebsd.org" Subject: m_get_tag returns same tag address when called multiple times Thread-Topic: m_get_tag returns same tag address when called multiple times Thread-Index: AQHPb0FJyDeD16LXz0mopgzAm0Igdw== Date: Wed, 14 May 2014 06:54:01 +0000 Message-ID: References: <39CF6EA8C75D61takehara.mikihito@jp.panasonic.com> In-Reply-To: <39CF6EA8C75D61takehara.mikihito@jp.panasonic.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-cr-puzzleid: {97ADFAAA-5C33-44CC-835E-377C9850C09D} x-cr-hashedpuzzle: AvLp BRBX Bfo6 B75E DLa4 DdmT DfHt DiWf Fpsg FvV1 G4Nk G7gb IOcQ Iq1j JBAa KtXD; 1; ZgByAGUAZQBiAHMAZAAtAGMAdQByAHIAZQBuAHQAQABmAHIAZQBlAGIAcwBkAC4AbwByAGcA; Sosha1_v1; 7; {97ADFAAA-5C33-44CC-835E-377C9850C09D}; cwBoAG8AbgBuAHUAcgBAAGMAaABlAGwAcwBpAG8ALgBjAG8AbQA=; Wed, 14 May 2014 06:53:56 GMT; bQBfAGcAZQB0AF8AdABhAGcAIAByAGUAdAB1AHIAbgBzACAAcwBhAG0AZQAgAHQAYQBnACAAYQBkAGQAcgBlAHMAcwAgAHcAaABlAG4AIABjAGEAbABsAGUAZAAgAG0AdQBsAHQAaQBwAGwAZQAgAHQAaQBtAGUAcwA= x-originating-ip: [10.193.190.128] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 May 2014 06:54:08 -0000 Hi, In FreeBSd-11 Current i am seeing that m_tag_get() returns same tag address= for two subsequent calls, and m_tag_find() results in panic with below sta= ck trace. Anything wrong here? Fatal trap 9: general protection fault while in kernel mode cpuid =3D 4; apic id =3D 04 instruction pointer =3D 0x20:0xffffffff80959ff0 stack pointer =3D 0x28:0xfffffe01acfa09a0 frame pointer =3D 0x28:0xfffffe01acfa09d0 code segment =3D base 0x0, limit 0xfffff, type 0x1b =3D DPL 0, pres 1, long 1, def32 0, gran 1 processor eflags =3D interrupt enabled, resume, IOPL =3D 0 current process =3D 12 (irq277: t5nex0:0,5) [ thread pid 12 tid 100128 ] Stopped at m_tag_locate+0x40: cmpl %ebx,0xc(%rcx) Here is the calling sequence; 1. get_mbuf_mtag: m:0xfffff8005b3e4c00 mtag:0xfffff8002c47d180 2. get_mbuf_mtag: m:0xfffff8005b3e5000 mtag:0xfffff8002c47d180 3. find_mbuf_mtag(0xfffff8005b3e4c00) results in above trace. Note that the same code works fine in FBSD-9.1. struct my_mbuf_cb * get_mbuf_mtag(struct mbuf *m) { struct m_tag *mtag; mtag =3D m_tag_get(PACKET_TAG_PF, sizeof(struct my_mbuf_cb), M_NOWA= IT); if (mtag =3D=3D NULL) { os_log_info("Error allocating mtag\n",""); return (NULL); } bzero(mtag + 1, sizeof(struct my_mbuf_cb)); m_tag_prepend(m, mtag); =20 return ((struct my_mbuf_cb *)(mtag + 1)); } static struct my_mbuf_cb * find_mbuf_mtag(struct mbuf *m) { struct m_tag *mtag; if ((mtag =3D m_tag_find(m, PACKET_TAG_PF, NULL)) =3D=3D NULL) return (NULL); return ((struct my_mbuf_cb *)(mtag + 1)); } Thanks Sreenivas