From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Tq6RPqfI" 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-Google-Smtp-Source: AGHT+IFae9GfHftZi8zK41FezlChjHIL0jhjWV8Bs/s6McEy9uQqRVDUnPsC8m/z1HG2Wc+9hRWIVA== 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