From owner-svn-src-stable-11@freebsd.org Fri Nov 2 14:15:53 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 71D8110F85F7; Fri, 2 Nov 2018 14:15:53 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 190316CE23; Fri, 2 Nov 2018 14:15:53 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EFCC53F07; Fri, 2 Nov 2018 14:15:52 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wA2EFqOr046421; Fri, 2 Nov 2018 14:15:52 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wA2EFqmZ046419; Fri, 2 Nov 2018 14:15:52 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201811021415.wA2EFqmZ046419@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Fri, 2 Nov 2018 14:15:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r340054 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: bz X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 340054 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Nov 2018 14:15:53 -0000 Author: bz Date: Fri Nov 2 14:15:52 2018 New Revision: 340054 URL: https://svnweb.freebsd.org/changeset/base/340054 Log: MFC r339931,r339933 As a follow-up to r339930 and various reports implement logging in case we fail during module load because the pcpu or vnet module sections are full. We did return a proper error but not leaving any indication to the user as to what the actual problem was. PR: 228854 Modified: stable/11/sys/kern/link_elf.c stable/11/sys/kern/link_elf_obj.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/link_elf.c ============================================================================== --- stable/11/sys/kern/link_elf.c Fri Nov 2 14:13:31 2018 (r340053) +++ stable/11/sys/kern/link_elf.c Fri Nov 2 14:15:52 2018 (r340054) @@ -630,8 +630,12 @@ parse_dpcpu(elf_file_t ef) * all per-cpu storage from that. */ ef->pcpu_base = (Elf_Addr)(uintptr_t)dpcpu_alloc(size); - if (ef->pcpu_base == 0) + if (ef->pcpu_base == 0) { + printf("%s: pcpu module space is out of space; " + "cannot allocate %d for %s\n", + __func__, size, ef->lf.pathname); return (ENOSPC); + } memcpy((void *)ef->pcpu_base, (void *)ef->pcpu_start, size); dpcpu_copy((void *)ef->pcpu_base, size); elf_set_add(&set_pcpu_list, ef->pcpu_start, ef->pcpu_stop, @@ -663,8 +667,12 @@ parse_vnet(elf_file_t ef) * all per-vnet storage from that. */ ef->vnet_base = (Elf_Addr)(uintptr_t)vnet_data_alloc(size); - if (ef->vnet_base == 0) + if (ef->vnet_base == 0) { + printf("%s: vnet module space is out of space; " + "cannot allocate %d for %s\n", + __func__, size, ef->lf.pathname); return (ENOSPC); + } memcpy((void *)ef->vnet_base, (void *)ef->vnet_start, size); vnet_data_copy((void *)ef->vnet_base, size); elf_set_add(&set_vnet_list, ef->vnet_start, ef->vnet_stop, Modified: stable/11/sys/kern/link_elf_obj.c ============================================================================== --- stable/11/sys/kern/link_elf_obj.c Fri Nov 2 14:13:31 2018 (r340053) +++ stable/11/sys/kern/link_elf_obj.c Fri Nov 2 14:15:52 2018 (r340054) @@ -366,6 +366,11 @@ link_elf_link_preload(linker_class_t cls, const char * dpcpu = dpcpu_alloc(shdr[i].sh_size); if (dpcpu == NULL) { + printf("%s: pcpu module space is out " + "of space; cannot allocate %#jx " + "for %s\n", __func__, + (uintmax_t)shdr[i].sh_size, + filename); error = ENOSPC; goto out; } @@ -380,6 +385,11 @@ link_elf_link_preload(linker_class_t cls, const char * vnet_data = vnet_data_alloc(shdr[i].sh_size); if (vnet_data == NULL) { + printf("%s: vnet module space is out " + "of space; cannot allocate %#jx " + "for %s\n", __func__, + (uintmax_t)shdr[i].sh_size, + filename); error = ENOSPC; goto out; } @@ -840,14 +850,30 @@ link_elf_load_file(linker_class_t cls, const char *fil else ef->progtab[pb].name = "<>"; if (ef->progtab[pb].name != NULL && - !strcmp(ef->progtab[pb].name, DPCPU_SETNAME)) + !strcmp(ef->progtab[pb].name, DPCPU_SETNAME)) { ef->progtab[pb].addr = dpcpu_alloc(shdr[i].sh_size); + if (ef->progtab[pb].addr == NULL) { + printf("%s: pcpu module space is out " + "of space; cannot allocate %#jx " + "for %s\n", __func__, + (uintmax_t)shdr[i].sh_size, + filename); + } + } #ifdef VIMAGE else if (ef->progtab[pb].name != NULL && - !strcmp(ef->progtab[pb].name, VNET_SETNAME)) + !strcmp(ef->progtab[pb].name, VNET_SETNAME)) { ef->progtab[pb].addr = vnet_data_alloc(shdr[i].sh_size); + if (ef->progtab[pb].addr == NULL) { + printf("%s: vnet module space is out " + "of space; cannot allocate %#jx " + "for %s\n", __func__, + (uintmax_t)shdr[i].sh_size, + filename); + } + } #endif else ef->progtab[pb].addr =