Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp369993rdb; Thu, 22 Feb 2024 06:24:38 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXvWchtWgJ21zZiab5vnT/jYNS0vahSeKrCL3S3ZzVincnm+4IVTUik7PQ6u8HEHeMj8UXfA1xZ9r3AVKNA18LFPWmsZKa4GQBWSlaltg== X-Google-Smtp-Source: AGHT+IFF9TKMMTbfwwQIwCXC/CMS7I/eOfNvTj1dkoc+U3CoMyH0Pr8TOVyBMhWxfiJhVxtfeEQ3 X-Received: by 2002:a05:6871:7a1:b0:21f:397c:bf52 with SMTP id o33-20020a05687107a100b0021f397cbf52mr6922449oap.45.1708611878546; Thu, 22 Feb 2024 06:24:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708611878; cv=pass; d=google.com; s=arc-20160816; b=RoR1gce+jRdSbkGUYaNsSZ5VTeN2vKcQM57TsFi3tRCOUvkwxk3NaQLDkyEkAZ+0kB qIHsrqBZw/ZwwAHHsCEAyYbcQ4xctjAQUDwwm4hn8NHY3a0ayaAoV/FJOLm5LpsplCDd eVYZTphmMey8w9xaJpqBMHd0nVYCTp+/Z8rfuyWUzLCFLYmD4Pecx07+4xG2qd0gBn9M jZY28W3wWbMBZfzJ2bj6UNPJC+uyzfy/AyZkEFcvtk4HKoJqKWmi1TKdPUdRQRuf5Epx c3rysNGTFCmLi5A3CMXWgU1Y3+QyRmkyawGS87x3KtyAn0QsNKlKNSXID66nsjaH21oK 9sBw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=VHaXxIxgBTJmgtue73WVl6b/Cy0dVFZjoWVjGUpCh3I=; fh=ZbLgVeSPJrlXGQuNrSv3UtCvsUSo2E89UvWwuk6GJKQ=; b=UYxnVL9e5FRp2+IN1eNTeSH3oTEmNF8SRN4DlduDRcjtNny8BGjYZ4tracwOEn8Zcl h1vd4+bFMFoJUozPmAfp1ijPhCqMcYAVM/+T4iS3AQ1Zx351DtD8RvveYTVaXavodzRG WvjU1qhbOUVXT0rVpwo4Uf5GI6VEYkfC3pMC/CNdTQFNkVipN/8vtWXgflBU3IPv15G1 rRlnMSwPKnEHNV1aHCXOabQfkp7cmwkT+FO4uCUd+1y54yku4+Swl0Po9Pw0OQHkI+No vX+u0iyBiLQAXBiWxiMDgopuHdkIw6bsEjfn64JCBQ6SPiMFxCnXf0C/CXhQWdlmmgz6 kKdg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=Tq6RPqfI; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linuxfoundation.org dmarc=pass fromdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-76697-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76697-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id dr14-20020a056a020fce00b005dc956b1631si10248458pgb.371.2024.02.22.06.24.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 06:24:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76697-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=Tq6RPqfI; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linuxfoundation.org dmarc=pass fromdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-76697-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76697-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 3A7B9287858 for ; Thu, 22 Feb 2024 14:24:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C60F21482E9; Thu, 22 Feb 2024 14:23:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Tq6RPqfI" Received: from mail-io1-f51.google.com (mail-io1-f51.google.com [209.85.166.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2BB3F4776E for ; Thu, 22 Feb 2024 14:23:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708611806; cv=none; b=Ac0brq61jxp6e/qSdisJ71jtFqNY9Fwd1Z1eUTqQICs8v542Exx9yLogxM6rgddxSAhPOd1uJCEM1GOsuCgYWmkNuSwd8TGcKn6qBato+hdnJAlX4qmMq61BBbAZv4eh4mRJComDw3tKq/8Y/MWUYLgYjRBbL/GwPm7moeT43+0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708611806; c=relaxed/simple; bh=Mp82jeP2ujByGkHzqK9TDgR5FlKS5q+5jbi8/ebGkm8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=aelTd8Hk9cOHkui7QuNLU/MkJajpMml/4It9xVGOHrHsm4MMgt6U+gjIqBRq4ZsDL5R/2PR/XNGDkQqs3iUnZoXuGRqpoSQgVRlYK14MGr63bucBuzGnkK3QfYXncYCDT2lehGTXxsB4gaNO1Nbskrmrt2GnNWISBGYAzXUc/ys= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org; spf=pass smtp.mailfrom=linuxfoundation.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Tq6RPqfI; arc=none smtp.client-ip=209.85.166.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linuxfoundation.org Received: by mail-io1-f51.google.com with SMTP id ca18e2360f4ac-7c00a2cbcf6so61710239f.1 for ; Thu, 22 Feb 2024 06:23:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1708611804; x=1709216604; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=VHaXxIxgBTJmgtue73WVl6b/Cy0dVFZjoWVjGUpCh3I=; b=Tq6RPqfIaQmh5ZS+wBv4yfNUt1zEHRHki6eMjLz9R2NHLK0U3S8TLpjW25w/TFXaL6 87ayYSQ9hg/ZEdUTueKu3Ji3YscQfR7j7B+DmUoKwbFheK1USW28nHEVIWSoS0kXTZei Y4bksQlbo9mCRcbLYTwWP60UkmU7/dP7UeWmo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708611804; x=1709216604; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VHaXxIxgBTJmgtue73WVl6b/Cy0dVFZjoWVjGUpCh3I=; b=vXa/Z5S80Tg9faScRRtqc+Xw47+BtbMfdIPY5xi2YCy19XLNzNHEjGQxjiCA0qZ+wp fIyx4DZM4s8+CvapOBKSPBLb2S3Q8Ehck92MR4ziiSM2kGnlVBMDhZuATiuJZOP/5wDN iZX5KjwyZhNjMIj3cfrINprABEoD3Kmcao32+KXbX1EKdPnruvgGde9ZPovA9zGBynRl Btvjz2qaxEpYGPFPc0o+bieGFGGn91Yu5lnMqhyN0/1+AuShpkaMwZlcgKe9IUx3Mhch I/ZJ2xv7RkUGJOKeylMde13mtNRtUTPysoWRVGxLWl/adQ3QmjwjnPeyxZrUNsYsAGno 7RNQ== X-Forwarded-Encrypted: i=1; AJvYcCX7yupGBZ56NtetFS9upZeSs/ob2psxYtSuPByI66ioJMeTzxiawmcvB5pjE5yh07YrRxLQ0n/sWeHIfT79wKRPIJDmbk9Q+Gg+RZrb X-Gm-Message-State: AOJu0Yz/02qjuyVYKw7Y31RnqfpuQMYTskHhDpw4Y4V4NHg5H8ZgPwxC BAo3mP5KXiHCR1YbHa0BEplS0pe6usSoC66/u0K0PdIa7GuSneXrS7aiX7LzNK8= X-Received: by 2002:a5e:970a:0:b0:7c4:9ed9:8e7c with SMTP id w10-20020a5e970a000000b007c49ed98e7cmr17459202ioj.0.1708611804205; Thu, 22 Feb 2024 06:23:24 -0800 (PST) Received: from [192.168.1.128] ([38.175.170.29]) by smtp.gmail.com with ESMTPSA id w14-20020a5ed60e000000b007c75a3c0184sm1834078iom.9.2024.02.22.06.23.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 22 Feb 2024 06:23:23 -0800 (PST) Message-ID: Date: Thu, 22 Feb 2024 07:23:21 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 0/9] kunit: Fix printf format specifier issues in KUnit assertions To: David Gow , Linus Torvalds , Guenter Roeck , Rae Moar , Matthew Auld , Arunpravin Paneer Selvam , =?UTF-8?Q?Christian_K=C3=B6nig?= , Kees Cook , =?UTF-8?Q?Ma=C3=ADra_Canal?= , Rodrigo Vivi , Matthew Brost , Willem de Bruijn , Florian Westphal , Cassio Neri , Javier Martinez Canillas , Arthur Grillo Cc: Brendan Higgins , Daniel Latypov , Stephen Boyd , David Airlie , Maxime Ripard , "David S . Miller" , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, intel-xe@lists.freedesktop.org, linux-rtc@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-hardening@vger.kernel.org, netdev@vger.kernel.org, Shuah Khan References: <20240221092728.1281499-1-davidgow@google.com> Content-Language: en-US From: Shuah Khan In-Reply-To: <20240221092728.1281499-1-davidgow@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2/21/24 02:27, David Gow wrote: > KUnit has several macros which accept a log message, which can contain > printf format specifiers. Some of these (the explicit log macros) > already use the __printf() gcc attribute to ensure the format specifiers > are valid, but those which could fail the test, and hence used > __kunit_do_failed_assertion() behind the scenes, did not. > > These include: > - KUNIT_EXPECT_*_MSG() > - KUNIT_ASSERT_*_MSG() > - KUNIT_FAIL() > > This series adds the __printf() attribute, and fixes all of the issues > uncovered. (Or, at least, all of those I could find with an x86_64 > allyesconfig, and the default KUnit config on a number of other > architectures. Please test!) > > The issues in question basically take the following forms: > - int / long / long long confusion: typically a type being updated, but > the format string not. > - Use of integer format specifiers (%d/%u/%li/etc) for types like size_t > or pointer differences (technically ptrdiff_t), which would only work > on some architectures. > - Use of integer format specifiers in combination with PTR_ERR(), where > %pe would make more sense. > - Use of empty messages which, whilst technically not incorrect, are not > useful and trigger a gcc warning. > > We'd like to get these (or equivalent) in for 6.9 if possible, so please > do take a look if possible. > > Thanks, > -- David > > Reported-by: Linus Torvalds > Closes: https://lore.kernel.org/linux-kselftest/CAHk-=wgJMOquDO5f8ShH1f4rzZwzApNVCw643m5-Yj+BfsFstA@mail.gmail.com/ > > Thank you for a quick response David. I will apply the series to kunit next for Linux 6.9 as soon as the reviews are complete. thanks, -- Shuah