From owner-svn-src-head@freebsd.org Wed Jul 20 18:11:54 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F20AB9F5D8; Wed, 20 Jul 2016 18:11:54 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-f178.google.com (mail-io0-f178.google.com [209.85.223.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 325421950; Wed, 20 Jul 2016 18:11:53 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-f178.google.com with SMTP id q83so54998472iod.1; Wed, 20 Jul 2016 11:11:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=sU+LeyheEcOYmnzSBWt+/6sMX6XFxPl3Wu41sTGesps=; b=eDq2Nx2/FGY4+7C8+doBLixjok4gLbM9ZkbOkAxI37pJ5SYwsjKHHOT8MtxEEOAOgB tJ/wIHHmDPyuZptdmYufRNW1ykJAowUU3mbra2yI/lahDOAsTGWuRlh3ctAW16+0yVqC pncS4jhBEkVJGWGhTN0GyF6hzxcaZWwOHn/t5QhZqhWJM0uSA/bMTIDpRQtCGofGCCFK E18Aqowu2JG/Kd7TWl91ZR3CKPzUOrJsQfy3by8a8LZBDUz47z/BU1JxJ7xGTMl0o9TJ sro1PGv1IalnBa5UkzlZfiLvalQz++cy2DoneF4h1I2PhexIM+fa3G1fh4RaWYFwBT7R p+Cg== X-Gm-Message-State: ALyK8tLeMoOmjPQcK3aMCOxlilTV9q8S8jMNLC7cI0JMVOSWCZVO+Rf7hkiZkTib+XsIwA== X-Received: by 10.107.166.135 with SMTP id p129mr45468463ioe.121.1469038312697; Wed, 20 Jul 2016 11:11:52 -0700 (PDT) Received: from mail-it0-f52.google.com (mail-it0-f52.google.com. [209.85.214.52]) by smtp.gmail.com with ESMTPSA id c40sm1941329iod.6.2016.07.20.11.11.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Jul 2016 11:11:52 -0700 (PDT) Received: by mail-it0-f52.google.com with SMTP id j124so57996485ith.1; Wed, 20 Jul 2016 11:11:52 -0700 (PDT) X-Received: by 10.36.212.132 with SMTP id x126mr46373814itg.34.1469038312181; Wed, 20 Jul 2016 11:11:52 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.36.233.67 with HTTP; Wed, 20 Jul 2016 11:11:51 -0700 (PDT) In-Reply-To: <7d98bc0deeedc54964b62911276c41cc@thebighonker.lerctr.org> References: <201607201659.u6KGxaNs010929@repo.freebsd.org> <7d98bc0deeedc54964b62911276c41cc@thebighonker.lerctr.org> From: Conrad Meyer Date: Wed, 20 Jul 2016 11:11:51 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r303099 - head/sys/kern To: Larry Rosenman Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, owner-svn-src-all@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jul 2016 18:11:54 -0000 Mea culpa. Thanks for the report. Fixed in r303105. Best, Conrad On Wed, Jul 20, 2016 at 10:32 AM, Larry Rosenman wrote: > This broke my build: > --- imgact_elf32.o --- > In file included from /usr/src/sys/kern/imgact_elf32.c:31: > /usr/src/sys/kern/imgact_elf.c:1663:8: error: format specifies type 'size_t' > (aka 'unsigned long') but the argument has type 'Elf32_Off' (aka 'unsigned > int') [-Werror,-Wformat] > ehdr->e_shoff, hdrsize - sizeof(Elf_Shdr))); > ^~~~~~~~~~~~~ > /usr/src/sys/sys/systm.h:86:17: note: expanded from macro 'KASSERT' > kassert_panic msg; \ > ^~~ > > > > > On 2016-07-20 11:59, Conrad E. Meyer wrote: >> >> Author: cem >> Date: Wed Jul 20 16:59:36 2016 >> New Revision: 303099 >> URL: https://svnweb.freebsd.org/changeset/base/303099 >> >> Log: >> Extend ELF coredump to support more than 65535 segments >> >> The ELF e_phnum field is only 16 bits wide. To support more than >> 65535 segments >> (program headers), Sun's "Linker and Libraries Guide" table 7-7 (or >> 12-7, >> depending on document version) prescribes a special first section header >> where >> sh_info represents the real number of program headers. >> >> Test code to follow, when it is ready. >> >> Reference: http://docs.oracle.com/cd/E18752_01/pdf/817-1984.pdf >> >> Reviewed by: emaste, markj >> Sponsored by: EMC / Isilon Storage Division >> Differential Revision: https://reviews.freebsd.org/D7255 >> >> Modified: >> head/sys/kern/imgact_elf.c >> >> Modified: head/sys/kern/imgact_elf.c >> >> ============================================================================== >> --- head/sys/kern/imgact_elf.c Wed Jul 20 16:48:25 2016 (r303098) >> +++ head/sys/kern/imgact_elf.c Wed Jul 20 16:59:36 2016 (r303099) >> @@ -1323,6 +1323,8 @@ __elfN(coredump)(struct thread *td, stru >> * Collect info about the core file header area. >> */ >> hdrsize = sizeof(Elf_Ehdr) + sizeof(Elf_Phdr) * (1 + >> seginfo.count); >> + if (seginfo.count + 1 >= PN_XNUM) >> + hdrsize += sizeof(Elf_Shdr); >> __elfN(prepare_notes)(td, ¬elst, ¬esz); >> coresize = round_page(hdrsize + notesz) + seginfo.size; >> >> @@ -1618,10 +1620,10 @@ __elfN(puthdr)(struct thread *td, void * >> { >> Elf_Ehdr *ehdr; >> Elf_Phdr *phdr; >> + Elf_Shdr *shdr; >> struct phdr_closure phc; >> >> ehdr = (Elf_Ehdr *)hdr; >> - phdr = (Elf_Phdr *)((char *)hdr + sizeof(Elf_Ehdr)); >> >> ehdr->e_ident[EI_MAG0] = ELFMAG0; >> ehdr->e_ident[EI_MAG1] = ELFMAG1; >> @@ -1645,14 +1647,43 @@ __elfN(puthdr)(struct thread *td, void * >> ehdr->e_flags = 0; >> ehdr->e_ehsize = sizeof(Elf_Ehdr); >> ehdr->e_phentsize = sizeof(Elf_Phdr); >> - ehdr->e_phnum = numsegs + 1; >> ehdr->e_shentsize = sizeof(Elf_Shdr); >> - ehdr->e_shnum = 0; >> ehdr->e_shstrndx = SHN_UNDEF; >> + if (numsegs + 1 < PN_XNUM) { >> + ehdr->e_phnum = numsegs + 1; >> + ehdr->e_shnum = 0; >> + } else { >> + ehdr->e_phnum = PN_XNUM; >> + ehdr->e_shnum = 1; >> + >> + ehdr->e_shoff = ehdr->e_phoff + >> + (numsegs + 1) * ehdr->e_phentsize; >> + KASSERT(ehdr->e_shoff == hdrsize - sizeof(Elf_Shdr), >> + ("e_shoff: %zu, hdrsize - shdr: %zu", >> + ehdr->e_shoff, hdrsize - sizeof(Elf_Shdr))); >> + >> + shdr = (Elf_Shdr *)((char *)hdr + ehdr->e_shoff); >> + memset(shdr, 0, sizeof(*shdr)); >> + /* >> + * A special first section is used to hold large segment >> and >> + * section counts. This was proposed by Sun Microsystems >> in >> + * Solaris and has been adopted by Linux; the standard ELF >> + * tools are already familiar with the technique. >> + * >> + * See table 7-7 of the Solaris "Linker and Libraries >> Guide" >> + * (or 12-7 depending on the version of the document) for >> more >> + * details. >> + */ >> + shdr->sh_type = SHT_NULL; >> + shdr->sh_size = ehdr->e_shnum; >> + shdr->sh_link = ehdr->e_shstrndx; >> + shdr->sh_info = numsegs + 1; >> + } >> >> /* >> * Fill in the program header entries. >> */ >> + phdr = (Elf_Phdr *)((char *)hdr + ehdr->e_phoff); >> >> /* The note segement. */ >> phdr->p_type = PT_NOTE; >> _______________________________________________ >> svn-src-all@freebsd.org mailing list >> https://lists.freebsd.org/mailman/listinfo/svn-src-all >> To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" > > > -- > Larry Rosenman http://www.lerctr.org/~ler > Phone: +1 214-642-9640 E-Mail: ler@lerctr.org > US Mail: 17716 Limpia Crk, Round Rock, TX 78664-7281