Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3980105pxf; Tue, 16 Mar 2021 02:40:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjKsJchkgTBro8eefQbDqTUFRbkcY0bNPNiriFHJ953rQhe3VSpBIJVv98PCbXCaHeC8NU X-Received: by 2002:aa7:c4d1:: with SMTP id p17mr35238361edr.387.1615887629106; Tue, 16 Mar 2021 02:40:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615887629; cv=none; d=google.com; s=arc-20160816; b=JP0mIXd9foq+YG72DwZW+zvAsz8GE4k6wrQ84ifWNiqujnmDSAc6dW8nQ8M4A8V/mV K+4yHVu/YAdjZH3EnvzI5AZr1JLB5J5voACGxIiMZvT64JkU3aBWd0N6KzwwmKtQx+fm bcwF8ERJDOm8kxtrbLso6mZn9LexJHOuNJS6KmHnLa7mYlpaf14pVBXf+pMHaFAizCIz qnQ5s2HlB5tQMTO1Xpxl6DbwUCKoyIMq9V6ij0RsgWpBAQIWYXvk7IqgPsX1rGNWs7rT h0oHtbTx6JQh8JenAowxUxsUwYum+j9lRy1LEp6xdXWjG6oSwbunG3lx6yJp3Rw3cV6V I6xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=dakvnM85NLOgwPHhk/GAs2gr3/rtNx7+zqP36xIqwGw=; b=Z4xVJ1ZujizyHXGBWFKXlVKJwSj4iKXRnrjJX+D+sABqKcccnV+CRvizcXV6S3fP3J 78R8AyOFkUx+/xyWDsUX4m/2R5vdFRjXjLKlSG9ULQ6+Xj2Makh9w89n9Kkw1YzFVO9z So3S2EbX0vWpDjRxwgOBPFctaVpft0dJZyITWQg2gv0Om4DVDj44Cf1+KWqOA4nRnAMT IgXGIXdaQ0AIs6E1pamy9ZUihwOdJ9RjbWbuCcZKeSxY7wLzIVdOmldcnm6bf+1pyfVk z6jVSMnNV1esK6Ki5OyNvPh7ESVCIKldFg4G9hT7zSRzD0HsBalti7op0Kx1MuAUnwaq 4yLA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n21si13703245edv.569.2021.03.16.02.40.07; Tue, 16 Mar 2021 02:40:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234916AbhCPIcu (ORCPT + 99 others); Tue, 16 Mar 2021 04:32:50 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:49887 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234888AbhCPIcm (ORCPT ); Tue, 16 Mar 2021 04:32:42 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 4F063n3w10z9v02D; Tue, 16 Mar 2021 09:32:37 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id l5wHRkQBPkSS; Tue, 16 Mar 2021 09:32:37 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4F063n0rlPz9v02C; Tue, 16 Mar 2021 09:32:37 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id E4E128B789; Tue, 16 Mar 2021 09:32:37 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id jhvqrq-uzdBC; Tue, 16 Mar 2021 09:32:37 +0100 (CET) Received: from [192.168.4.90] (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 3ADBD8B782; Tue, 16 Mar 2021 09:32:37 +0100 (CET) Subject: Re: [PATCH mm] kfence: fix printk format for ptrdiff_t To: Alexander Potapenko , Marco Elver , Segher Boessenkool Cc: Andrew Morton , Dmitriy Vyukov , Andrey Konovalov , Jann Horn , LKML , Linux Memory Management List , kasan-dev References: <20210303121157.3430807-1-elver@google.com> From: Christophe Leroy Message-ID: Date: Tue, 16 Mar 2021 09:32:32 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org +segher Le 03/03/2021 à 13:27, Alexander Potapenko a écrit : > On Wed, Mar 3, 2021 at 1:12 PM Marco Elver wrote: >> >> Use %td for ptrdiff_t. >> >> Link: https://lkml.kernel.org/r/3abbe4c9-16ad-c168-a90f-087978ccd8f7@csgroup.eu >> Reported-by: Christophe Leroy >> Signed-off-by: Marco Elver > Reviewed-by: Alexander Potapenko > Still a problem. I don't understand, gcc bug ? The offending argument is 'const ptrdiff_t object_index' We have: arch/powerpc/include/uapi/asm/posix_types.h:typedef long __kernel_ptrdiff_t; include/linux/types.h:typedef __kernel_ptrdiff_t ptrdiff_t; And get: CC mm/kfence/report.o In file included from ./include/linux/printk.h:7, from ./include/linux/kernel.h:16, from mm/kfence/report.c:10: mm/kfence/report.c: In function 'kfence_report_error': ./include/linux/kern_levels.h:5:18: warning: format '%td' expects argument of type 'ptrdiff_t', but argument 6 has type 'long int' [-Wformat=] 5 | #define KERN_SOH "\001" /* ASCII Start Of Header */ | ^~~~~~ ./include/linux/kern_levels.h:11:18: note: in expansion of macro 'KERN_SOH' 11 | #define KERN_ERR KERN_SOH "3" /* error conditions */ | ^~~~~~~~ ./include/linux/printk.h:343:9: note: in expansion of macro 'KERN_ERR' 343 | printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) | ^~~~~~~~ mm/kfence/report.c:213:3: note: in expansion of macro 'pr_err' 213 | pr_err("Out-of-bounds %s at 0x%p (%luB %s of kfence-#%td):\n", | ^~~~~~ ./include/linux/kern_levels.h:5:18: warning: format '%td' expects argument of type 'ptrdiff_t', but argument 4 has type 'long int' [-Wformat=] 5 | #define KERN_SOH "\001" /* ASCII Start Of Header */ | ^~~~~~ ./include/linux/kern_levels.h:11:18: note: in expansion of macro 'KERN_SOH' 11 | #define KERN_ERR KERN_SOH "3" /* error conditions */ | ^~~~~~~~ ./include/linux/printk.h:343:9: note: in expansion of macro 'KERN_ERR' 343 | printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) | ^~~~~~~~ mm/kfence/report.c:222:3: note: in expansion of macro 'pr_err' 222 | pr_err("Use-after-free %s at 0x%p (in kfence-#%td):\n", | ^~~~~~ ./include/linux/kern_levels.h:5:18: warning: format '%td' expects argument of type 'ptrdiff_t', but argument 2 has type 'long int' [-Wformat=] 5 | #define KERN_SOH "\001" /* ASCII Start Of Header */ | ^~~~~~ ./include/linux/kern_levels.h:24:19: note: in expansion of macro 'KERN_SOH' 24 | #define KERN_CONT KERN_SOH "c" | ^~~~~~~~ ./include/linux/printk.h:385:9: note: in expansion of macro 'KERN_CONT' 385 | printk(KERN_CONT fmt, ##__VA_ARGS__) | ^~~~~~~~~ mm/kfence/report.c:229:3: note: in expansion of macro 'pr_cont' 229 | pr_cont(" (in kfence-#%td):\n", object_index); | ^~~~~~~ ./include/linux/kern_levels.h:5:18: warning: format '%td' expects argument of type 'ptrdiff_t', but argument 3 has type 'long int' [-Wformat=] 5 | #define KERN_SOH "\001" /* ASCII Start Of Header */ | ^~~~~~ ./include/linux/kern_levels.h:11:18: note: in expansion of macro 'KERN_SOH' 11 | #define KERN_ERR KERN_SOH "3" /* error conditions */ | ^~~~~~~~ ./include/linux/printk.h:343:9: note: in expansion of macro 'KERN_ERR' 343 | printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) | ^~~~~~~~ mm/kfence/report.c:239:3: note: in expansion of macro 'pr_err' 239 | pr_err("Invalid free of 0x%p (in kfence-#%td):\n", (void *)address, | ^~~~~~ Christophe