From nobody Fri Mar 29 19:32:40 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4V5rCX23Cmz5FYp6; Fri, 29 Mar 2024 19:32:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4V5rCX1ZZNz44ck; Fri, 29 Mar 2024 19:32:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1711740760; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Yh1/I7lN6jPBYzSoD+dSvskje0iBKgU5V4Wv0cZdBNk=; b=KpgRgYl5NvpEiBfNxRX3o551ZRYfa5Nxuz2iUOsMLJ25F2316xbc7N5uhL03Dl1aazhwR/ FHjWrwnh3tLW7PqWE/ytw4dO24Q75KvKv0J9g2N8TzT4wxmaX7NTebrrSznjLp4rMJCwq4 qIkrKd15ZIJpyRgaI3xrVXM/fyeOjcXxu/PgECzKgNgYECoeRpk6Wgao6Rj16BXNIkzZGh uNHQFfh5ULlr2m5pb91SRNgEH1zXjgzTMtab2LY/10mYStnQjD5xqNTGEOpO+cjRqO1caL fsfbGpBMm7jn8rGRGvcaiLk9ns1Jk7RFA6p22s24gEt7mag2ryRc0h/HYmVGWQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1711740760; a=rsa-sha256; cv=none; b=eVBgkB5Hl2QMK6h16iv1ZBVedGg776VhbDJnYdFd631x8ZP8NyWseCwyc3MI4+I7dqISLQ yK1tagLWEXaw40PngfkW/Pbxt64/FQ3Jazb9jkft+/NiQ9xf1dkzwfZvgiLnU88BDHrH5i OuAfFjXKItvNJj2YMmphcg6X6gNdegShwcEql8Ud0sJDdSH3YmQiCpiYeO0CuQU1ih4h81 oHUq8zKI1COFUXq7/UoNkuD1YqydpN+2FipqVjTbELHw7NaZDX63TleWj/wpdSdr0+thOz JViVWUVBSg2zsDgMcOAyJGck75/TX1wbAVjFfT6OaxKvyMuj9lksQhEg+4U6HQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1711740760; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Yh1/I7lN6jPBYzSoD+dSvskje0iBKgU5V4Wv0cZdBNk=; b=tkWPJoRdXleba0OF3AopE5OMkywJYU2/weWMvS2w8gdmLzv9to3JV/32UEGj5sRU0ojgk/ ryOXK1lbl+Y0UZTVa2P0UlGLjG5ltu+A1axZiuB21BFhkwxdrFdN+ZOp1dFqMe1eI7x9SH Tqy5kmd01lugYlno0y+0SAcLHAcF4Euh1zG6BstoBp8Y1HrSd/VARKLSYvpjzkMU5WZd6I fK7GPkyzEnuaan0sFp/T8Yfg1E5sa3J5gijuYfo5TY7USAw4C8jloj6Jctv3SFwbbdVsZn 8G5MSbo1L/zM7jbrF/e0xLARBcRXnySvBtzNfOLQyWtJpPhieiI9fVfraPSgqg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4V5rCX1BHMzMvB; Fri, 29 Mar 2024 19:32:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 42TJWel2020052; Fri, 29 Mar 2024 19:32:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 42TJWeOi020049; Fri, 29 Mar 2024 19:32:40 GMT (envelope-from git) Date: Fri, 29 Mar 2024 19:32:40 GMT Message-Id: <202403291932.42TJWeOi020049@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bojan =?utf-8?Q?Novkovi=C4=87?= Subject: git: bdc903460be4 - main - kern_ctf.c: Don't print out warning messages unconditionally List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bnovkov X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bdc903460be4b6a729c1b7cde55963730c68cec4 Auto-Submitted: auto-generated The branch main has been updated by bnovkov: URL: https://cgit.FreeBSD.org/src/commit/?id=bdc903460be4b6a729c1b7cde55963730c68cec4 commit bdc903460be4b6a729c1b7cde55963730c68cec4 Author: Bojan Novković AuthorDate: 2024-03-29 19:17:19 +0000 Commit: Bojan Novković CommitDate: 2024-03-29 19:32:18 +0000 kern_ctf.c: Don't print out warning messages unconditionally The kernel CTF loading routines print various warnings when attempting to load CTF data from an ELF file. After the changes in c21bc6f3c242 those warnings are unnecessarily printed for each kernel module that was compiled without CTF data. The kernel linker already uses the bootverbose flag to conditionally print CTF loading errors. This patch alters kern_ctf.c routines to do the same. Reported by: Alexander@leidinger.net Approved by: markj (mentor) Fixes: c21bc6f3c242 ("ddb: Add CTF-based pretty printing") --- sys/kern/kern_ctf.c | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/sys/kern/kern_ctf.c b/sys/kern/kern_ctf.c index b525c274f9e0..1087406ff82e 100644 --- a/sys/kern/kern_ctf.c +++ b/sys/kern/kern_ctf.c @@ -144,9 +144,12 @@ link_elf_ctf_get(linker_file_t lf, linker_ctf_t *lc) * .SUNW_ctf section containing the CTF data. */ if (hdr->e_shstrndx == 0 || shdr[hdr->e_shstrndx].sh_type != SHT_STRTAB) { - printf("%s(%d): module %s e_shstrndx is %d, sh_type is %d\n", - __func__, __LINE__, lf->pathname, hdr->e_shstrndx, - shdr[hdr->e_shstrndx].sh_type); + if (bootverbose) { + printf( + "%s(%d): module %s e_shstrndx is %d, sh_type is %d\n", + __func__, __LINE__, lf->pathname, hdr->e_shstrndx, + shdr[hdr->e_shstrndx].sh_type); + } error = EFTYPE; goto out; } @@ -167,8 +170,10 @@ link_elf_ctf_get(linker_file_t lf, linker_ctf_t *lc) /* Check if the CTF section wasn't found. */ if (i >= hdr->e_shnum) { - printf("%s(%d): module %s has no .SUNW_ctf section\n", - __func__, __LINE__, lf->pathname); + if (bootverbose) { + printf("%s(%d): module %s has no .SUNW_ctf section\n", + __func__, __LINE__, lf->pathname); + } error = EFTYPE; goto out; } @@ -181,17 +186,21 @@ link_elf_ctf_get(linker_file_t lf, linker_ctf_t *lc) /* Check the CTF magic number. */ if (cth.cth_magic != CTF_MAGIC) { - printf("%s(%d): module %s has invalid format\n", - __func__, __LINE__, lf->pathname); + if (bootverbose) { + printf("%s(%d): module %s has invalid format\n", + __func__, __LINE__, lf->pathname); + } error = EFTYPE; goto out; } if (cth.cth_version != CTF_VERSION_2 && cth.cth_version != CTF_VERSION_3) { - printf( - "%s(%d): module %s CTF format has unsupported version %d\n", - __func__, __LINE__, lf->pathname, cth.cth_version); + if (bootverbose) { + printf( + "%s(%d): module %s CTF format has unsupported version %d\n", + __func__, __LINE__, lf->pathname, cth.cth_version); + } error = EFTYPE; goto out; } @@ -250,8 +259,10 @@ link_elf_ctf_get(linker_file_t lf, linker_ctf_t *lc) ret = uncompress(ctftab + sizeof(cth), &destlen, raw + sizeof(cth), shdr[i].sh_size - sizeof(cth)); if (ret != Z_OK) { - printf("%s(%d): zlib uncompress returned %d\n", - __func__, __LINE__, ret); + if (bootverbose) { + printf("%s(%d): zlib uncompress returned %d\n", + __func__, __LINE__, ret); + } error = EIO; goto out; }