From owner-svn-src-stable-8@FreeBSD.ORG Fri Jun 18 16:14:38 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A10F106566C; Fri, 18 Jun 2010 16:14:38 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 189008FC0C; Fri, 18 Jun 2010 16:14:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5IGEbUd006844; Fri, 18 Jun 2010 16:14:37 GMT (envelope-from kan@svn.freebsd.org) Received: (from kan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5IGEbCx006842; Fri, 18 Jun 2010 16:14:37 GMT (envelope-from kan@svn.freebsd.org) Message-Id: <201006181614.o5IGEbCx006842@svn.freebsd.org> From: Alexander Kabaev Date: Fri, 18 Jun 2010 16:14:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209306 - stable/8/cddl/contrib/opensolaris/tools/ctf/cvt X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Jun 2010 16:14:38 -0000 Author: kan Date: Fri Jun 18 16:14:37 2010 New Revision: 209306 URL: http://svn.freebsd.org/changeset/base/209306 Log: MFC r207578: Do not encode more than CTF_MAX_VLEN(1023) enum members. CTF can not represent enums with more than CTF_MAX_VLEN members, but ctfconvert will happily ignore that limitation and create CTF section no other tool can interpret. This change is different from similar change from upstream, which just returns an error if big enum is encountered. Doing that means that every FreeBSD kernel with compiled in hwpmc will have no useable CTF information due to pmc_event enum having 1236+ members. Modified: stable/8/cddl/contrib/opensolaris/tools/ctf/cvt/ctf.c Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/tools/ctf/cvt/ctf.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/tools/ctf/cvt/ctf.c Fri Jun 18 16:07:24 2010 (r209305) +++ stable/8/cddl/contrib/opensolaris/tools/ctf/cvt/ctf.c Fri Jun 18 16:14:37 2010 (r209306) @@ -355,14 +355,21 @@ write_type(void *arg1, void *arg2) for (i = 0, ep = tp->t_emem; ep != NULL; ep = ep->el_next) i++; /* count up enum members */ + if (i > CTF_MAX_VLEN) { + warning("enum %s has too many values: %d > %d\n", + tdesc_name(tp), i, CTF_MAX_VLEN); + i = CTF_MAX_VLEN; + } + ctt.ctt_info = CTF_TYPE_INFO(CTF_K_ENUM, isroot, i); write_sized_type_rec(b, &ctt, tp->t_size); - for (ep = tp->t_emem; ep != NULL; ep = ep->el_next) { + for (ep = tp->t_emem; ep != NULL && i > 0; ep = ep->el_next) { offset = strtab_insert(&b->ctb_strtab, ep->el_name); cte.cte_name = CTF_TYPE_NAME(CTF_STRTAB_0, offset); cte.cte_value = ep->el_number; ctf_buf_write(b, &cte, sizeof (cte)); + i--; } break;