From patchwork Wed Sep 27 13:29:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg Ungerer X-Patchwork-Id: 13400807 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91145E810DA for ; Wed, 27 Sep 2023 13:29:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2980C8D0051; Wed, 27 Sep 2023 09:29:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2202D8D0002; Wed, 27 Sep 2023 09:29:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0CBCE8D0051; Wed, 27 Sep 2023 09:29:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id ED48B8D0002 for ; Wed, 27 Sep 2023 09:29:57 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id C78A9C016C for ; Wed, 27 Sep 2023 13:29:57 +0000 (UTC) X-FDA: 81282460434.13.95A8231 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf08.hostedemail.com (Postfix) with ESMTP id 79F34160004 for ; Wed, 27 Sep 2023 13:29:55 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=efQ5Qou8; spf=pass (imf08.hostedemail.com: domain of gerg@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=gerg@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695821396; a=rsa-sha256; cv=none; b=yDK5hg+dQ4SdtiTLUOkt1/mzaDzOFXawwMJkF8wdwQknVLRfxrSffy5Hq/ToPLSyQp5JVW uv66RwngyZgg2QRI6iGoSLtvvMuVdNkC1rvQorx2iHQGzPQ+N7qmGj5qUOH1bcKO0IQZmk VMA4xCwTwL0mgO4yixxJqNQotN/qVeI= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=efQ5Qou8; spf=pass (imf08.hostedemail.com: domain of gerg@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=gerg@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695821396; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=cvShlGfm3UA3t2OHVkHEYHsiPN6k32WqXADHgzEWyW4=; b=BJQ+HDuWuUvbESD/lVImUTl2qP5WZDOrsjTMTm159zrbkjiAiKpe8hZ6wUAKR9ddkWWGEr vIsgO27FISHWx5t1H3QUBNZtVNXb6ywpbSgsFsauVPrL4F3UDVoZTngHBfCM9ewHKp9miG u407ELFK2bsj3ATzK4blP01HldBP55Q= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id DEABFCE1872; Wed, 27 Sep 2023 13:29:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DE94C433C7; Wed, 27 Sep 2023 13:29:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695821389; bh=HP0v40iSx8Vr8h/BjmerjsuwLjXNU/N7N3nzZW+WetY=; h=From:To:Cc:Subject:Date:From; b=efQ5Qou8ufF+JGMgMJavR2QSr4mopBd2oEsorbMTk3whH2K6Q3uv/3pXPVQFTn/ob qR+YiThAyNRbuwS98TNG/xzxml1jOpxBOsVFGhhX7rtenixlPJKcZsRNOjbmnShWMs m6O1/IvK7TIu2bSF3WnUkhCyojXYmQt2ASPlXRfsfVkpzDh7cZy/AIK7Xbp6DYEAuS SNGC+Ilnzo3x5xTNYmEcMWz4nzygVpDFmVX1ednK673veM50QScCU6FsVYmT592ORQ gyGibnwc6goWufL/kBuGGuawKWmj+/QCDQqba8m8F+3PHB1MG4lRSCcFQ87ecFRWN5 Q1L8QYAcMmFBg== From: Greg Ungerer To: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: palmer@rivosinc.com, keescook@chromium.org, ebiederm@xmission.com, brauner@kernel.org, viro@zeniv.linux.org.uk, Greg Ungerer Subject: [PATCH] binfmt_elf_fdpic: clean up debug warnings Date: Wed, 27 Sep 2023 23:29:33 +1000 Message-Id: <20230927132933.3290734-1-gerg@kernel.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 79F34160004 X-Stat-Signature: g4fqgk1nbrj6bfo9r8dcxshou1xxf4mh X-Rspam-User: X-HE-Tag: 1695821395-617242 X-HE-Meta: U2FsdGVkX19eF0tZxkwRy8T61ymlNgFBYCNz6pB4+51sLggiZYtCrWHVbzbsLm34hUbHeuDsZRd/FDLL4PAYTERo9Gts3PKNmI7tMLGxIcrEsrFeJ5qNdu3XaO0jchsLCMXq8z+QhPEkMEENgjEX6GD5WjC6a+j2LmNGER+UfAi3RZt5IF+Z9MQPWizoT6f+9jMYGgZ+jZZvXMAeC1XOi1GjHESAbXsC6IWMy+CpAcP2trvhUaXfVs2v2yXjn7Z/F0jtROEu79JHmVEg2nME2fA5bJW65HaOc6XhWWQRtbBa8Oweqfex8D6RHLYlhqg6evIrayzIp20v+E+lLyEEdqmbiDW4xJZQUdNPd2Pxwv6XAdq8+itXmijt3Qa1gqcnnieeo7olgr6NNjcv167EN7IuKRK1uRATkOjTP7SURnhHkJdfK+7yZ7CL+NDsSp4flCNFGiouPeNbbkj+sSUGW1Eb5833cROW6PsoXhBboS55AGTSQo1DOiccLLzKCxgprPN1u0m3ggNm5CKgT2X5MXpFpvGf53HcD1Eu9DJVzvB5+a/etl/QNSG4uiGNhQl9ZyOHD38lhFQ2YHnyYGICq73LC+pENacPGEZpiwRY+UhpehoLU/kvTKzP6kNS2qWCr4NwnNkKZCIItKKtmEOiXmwcxvZF76S+uvF1dh3Go38/3mIKG1ZwBaTHa33BKDycplkeEKNkSHpegcmBdQLoX+crU4fIvhf1rKkMsDEp/NkbkcHn7xN4zhE/Nv/P7oh+hKrgRCvOOVao9JyvViQ1uyfmxHfXwu98DPh1eTrR0+i94Un3Fl05ZI8MZI9AYr/vkOxwmBnb+XHeUbFhXXkoZwIJfnOpZMl3tQz34y/T6OMeuU2pJuRph6t5HGhDXEOG4OcJp9HlMOViUN37+qDItlJngT4PCuCwu58l1pJQLMPaSU0YgvXcR+ExQf1UBkMpXjud6d40fJxHeMdZFlM mz7xPbTz Bm5FdTeNzSLna6PS3UkC1eR3ptihHH5s4dObSR1m2nZ+bONTP1pk6r7IRLHXtSkPUcqNRmAycFwyFMtPwytvnjc/VBAUZCK6qrx6VpoXJQuDjsGUZJa70nghcu08oQ6KcsmoAdsQWUKde+8zmR7KLfgTEtJcAp4E0mlqYBgt6M3lbOxjW1eNxXmYXPn5WgOkD8nZpi8INqihE0dfIcvZc3EMTL0qPm40ctWCX4mdCco3DXhaDNFRQKDvEV+cJpzNqTu/Sz7rCDIwfejsFYvWYU6HXnttCzK/WO2dYw1woCFcQwmk= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The binfmt_elf_fdpic loader has some debug trace that can be enabled at build time. The recent 64-bit additions cause some warnings if that debug is enabled, such as: fs/binfmt_elf_fdpic.c: In function ‘elf_fdpic_map_file’: fs/binfmt_elf_fdpic.c:46:33: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘Elf64_Addr’ {aka ‘long long unsigned int’} [-Wformat=] 46 | #define kdebug(fmt, ...) printk("FDPIC "fmt"\n" ,##__VA_ARGS__ ) | ^~~~~~~~ ./include/linux/printk.h:427:25: note: in definition of macro ‘printk_index_wrap’ 427 | _p_func(_fmt, ##__VA_ARGS__); \ | ^~~~ Cast values to the largest possible type (which is equivilent to unsigned long long in this case) and use appropriate format specifiers to match. Fixes: b922bf04d2c1 ("binfmt_elf_fdpic: support 64-bit systems") Signed-off-by: Greg Ungerer --- fs/binfmt_elf_fdpic.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c index 43b2a2851ba3..97c3e8551aac 100644 --- a/fs/binfmt_elf_fdpic.c +++ b/fs/binfmt_elf_fdpic.c @@ -900,10 +900,12 @@ static int elf_fdpic_map_file(struct elf_fdpic_params *params, kdebug("- DYNAMIC[]: %lx", params->dynamic_addr); seg = loadmap->segs; for (loop = 0; loop < loadmap->nsegs; loop++, seg++) - kdebug("- LOAD[%d] : %08x-%08x [va=%x ms=%x]", + kdebug("- LOAD[%d] : %08llx-%08llx [va=%llx ms=%llx]", loop, - seg->addr, seg->addr + seg->p_memsz - 1, - seg->p_vaddr, seg->p_memsz); + (unsigned long long) seg->addr, + (unsigned long long) seg->addr + seg->p_memsz - 1, + (unsigned long long) seg->p_vaddr, + (unsigned long long) seg->p_memsz); return 0; @@ -1082,9 +1084,10 @@ static int elf_fdpic_map_file_by_direct_mmap(struct elf_fdpic_params *params, maddr = vm_mmap(file, maddr, phdr->p_memsz + disp, prot, flags, phdr->p_offset - disp); - kdebug("mmap[%d] sz=%lx pr=%x fl=%x of=%lx --> %08lx", - loop, phdr->p_memsz + disp, prot, flags, - phdr->p_offset - disp, maddr); + kdebug("mmap[%d] sz=%llx pr=%x fl=%x of=%llx --> %08lx", + loop, (unsigned long long) phdr->p_memsz + disp, + prot, flags, (unsigned long long) phdr->p_offset - disp, + maddr); if (IS_ERR_VALUE(maddr)) return (int) maddr; @@ -1146,8 +1149,9 @@ static int elf_fdpic_map_file_by_direct_mmap(struct elf_fdpic_params *params, #else if (excess > 0) { - kdebug("clear[%d] ad=%lx sz=%lx", - loop, maddr + phdr->p_filesz, excess); + kdebug("clear[%d] ad=%llx sz=%lx", loop, + (unsigned long long) maddr + phdr->p_filesz, + excess); if (clear_user((void *) maddr + phdr->p_filesz, excess)) return -EFAULT; }