From mboxrd@z Thu Jan 1 00:00:00 1970 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 BE5D1C8303C for ; Mon, 7 Jul 2025 15:12:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6347F8D0003; Mon, 7 Jul 2025 11:12:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 60C278D0002; Mon, 7 Jul 2025 11:12:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 549888D0003; Mon, 7 Jul 2025 11:12:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 454028D0002 for ; Mon, 7 Jul 2025 11:12:06 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id EFEF6B69E9 for ; Mon, 7 Jul 2025 15:12:05 +0000 (UTC) X-FDA: 83637809010.21.B609126 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) by imf26.hostedemail.com (Postfix) with ESMTP id EAC72140011 for ; Mon, 7 Jul 2025 15:12:03 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=suse.com header.s=google header.b=Irdcg3nV; spf=pass (imf26.hostedemail.com: domain of mhocko@suse.com designates 209.85.128.49 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=suse.com header.s=google header.b=Irdcg3nV; spf=pass (imf26.hostedemail.com: domain of mhocko@suse.com designates 209.85.128.49 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1751901124; a=rsa-sha256; cv=none; b=deli1ajTh97mPPoCtC4RnyTMeWwFRKfCBaaUIwp54U0RUEmeIaVSnI7LefNGUbVzPLW3Mn gVMvmzH0jKfrLNrht58wVL5/lJrcw00hxV5e1022BcQiQ1f97j2nnKKNHUrhstc1egHi67 j8wYYq6XNMhtVngi5DcEuVwwy7SWNa8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1751901124; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=2BUkMO3y8xtFeb8SJ1RGkSZs/uXuWNfET6KZvqytQMs=; b=0Kb9fFDxsGndpLYKjfcYpTmq08kSChA/Jae+UPmvsufXA0HtaFN45zQDXWAUJ0zIA1x3jF dyaF047qEJPix1NMCWfwcaPCVfaOLusfiGFavgrJukEAbw0xhqwgTlu/R2LPRFe2287yE5 2hTLiukfq/NhLTVr6SoOM6A9u5Dz86Y= Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-453749af004so15792195e9.1 for ; Mon, 07 Jul 2025 08:12:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1751901122; x=1752505922; darn=kvack.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=2BUkMO3y8xtFeb8SJ1RGkSZs/uXuWNfET6KZvqytQMs=; b=Irdcg3nVhOTJVWfjt06NWre1qOCTq9KvN6cMhPC/BzcOIQ9KQ8Oh0PEFzwM5dAbd6e 7emzixtF3r1AWSiTSB91oo+UEvbapw4bAB/lZybjkOmeAe8372r4Q5GrqGvxR3hTj+Ig G050Fh5F2d7zTtER4X7XAItvLboe2uvNPHFgCj6OVE5bHwD1uIkPlORkSCVx4ZfEF4nT MfiHHmEjZMsmsmISAV0FYVuPL9Q5OhL5S6pjRLr4RDhLfMlaco7HTBkxQRNFcXoDZPev 8US8RJgO0Mym+OtPYULEKa/45193x16LI1G79kn664+aN/QMl9RW5dyKilnn0FNWRnLw ADpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751901122; x=1752505922; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=2BUkMO3y8xtFeb8SJ1RGkSZs/uXuWNfET6KZvqytQMs=; b=HP7nhZPPqtu/WX6hry36wYdJqNt9d+fEbkAveflrX1YmiNBOxeCUz24j1elWEvDyPa Xq4BoaoQl/To863HWCuLolX2D9Vlxrv6KETlc8+1A0ZSs/yjfHHzDIakoUWM4b5MTTEa 48vWMeIbaNxiUGJWp6T3lFSEEEQ85tJCDrJ3/Xr8S83p+6TorgKmyr6NkrPoxSlOTSuf pSE+2sjCMc1kdSTo5PqoiO5Mjc52nsoUrj7FgwTUQi+QiCG260xS+6XVA3HunxMZwQu2 K6tyESC6xERQBhid5KOs2NxYQAVJRY0TWHdmv6cYw1yu/RT3tjc82IXPiO6Fyxd5wOl0 DA4w== X-Forwarded-Encrypted: i=1; AJvYcCV7DReYok0y6n6yYbarFbOSTDR3OLKLWJHfswgGRxLhkZ8ctp9gfWZYqmJhaQxUTe8WUL6trN0Y7g==@kvack.org X-Gm-Message-State: AOJu0YxPsFHBEHagxxkGr9g0juNH043zN3Cjh/twmtm2tIu2Mz/MBNjH AP7YS+v2Fa7VSU8QoN5Vp/afsoCnzru2nOP/kyQ+8GWJOgOHM5EenqdMQF8PC337i7E= X-Gm-Gg: ASbGnctSytex2g5paV0z+KaTnVKYqqS9u0HJL+lPib2+hZdIP+7dFhr4Ec6cbgGUHT/ pzuw4CwyRyJ9YjCRyYQjc6oKbFjONKvbp20oRSFwBywB6aNYUm2jSjAxTsMNNph9cS7LPhe62+8 c+++O22C/vmG+KDaptJgRJ+pjV1h+0ilVkYU1Lib7Prm4Kz2hraTEgSyop3h8shmeRi3IXezI8C SWwpWUBwycLg7NsgYvlbtz0wyGTXrdtcu9ulE5xqi46QfRUWCeXCVybp7SCyUw/rZ9/yJnIh7Ge c0dxmiB/3HpQDa0j5lx2nryaBjCMux+OiVSV6nqsSGKId9Ked0g2DOjZrgNnz5Xeqw5ihU2ptc1 flXPofEh1og== X-Google-Smtp-Source: AGHT+IGTL2Vc6Di2p94FuWpCeMPiGD75E2MydcU0kqogh98a2+K2G9jAxgIXZ2qejZWbrw8R0qpTdg== X-Received: by 2002:a05:600c:4745:b0:453:d3d:d9fd with SMTP id 5b1f17b1804b1-454bc5c4004mr77773035e9.12.1751901122277; Mon, 07 Jul 2025 08:12:02 -0700 (PDT) Received: from localhost (109-81-17-167.rct.o2.cz. [109.81.17.167]) by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-3b47030bd58sm10720459f8f.18.2025.07.07.08.12.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Jul 2025 08:12:01 -0700 (PDT) Date: Mon, 7 Jul 2025 17:12:00 +0200 From: Michal Hocko To: Alejandro Colomar Cc: Marco Elver , linux-mm@kvack.org, linux-hardening@vger.kernel.org, Kees Cook , Christopher Bazley , shadow <~hallyn/shadow@lists.sr.ht>, linux-kernel@vger.kernel.org, Andrew Morton , kasan-dev@googlegroups.com, Dmitry Vyukov , Alexander Potapenko , Christoph Lameter , David Rientjes , Vlastimil Babka , Roman Gushchin , Harry Yoo , Andrew Clayton , Jann Horn , Linus Torvalds Subject: Re: [RFC v3 5/7] mm: Fix benign off-by-one bugs Message-ID: References: <740755c1a888ae27de3f127c27bf925a91e9b264.1751862634.git.alx@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam01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ZidZ7njCRiLf izVtRVLs 2vq5VGb+ba+HoePMokktcT1NZvHOx3rqsROog+0LrQi+XM1oda94eHKToshEqJarMNsiPhPgeJO0nGg71lEV2R2wlxN//GVkniKR+q7KovVT7jlbLKW6PhfDGcRQFNsTTbDkMcVcKL6OJo02rsDziOdAczjLz9Y2/0Ngswjgp4qklkZezSWoD+EbIfHiuz4AcXTNIh3NRZb1KP5tEWGWKB3x9b5T8dxtaYgaUWPPznaAEnQqG+Vq6pfTBb6Hum0t6d0ou3mXssDG/wgdTfD0eY+P2DbyWyyX9QGzfirbNoNdvLZcQ0659w6q1hEaCEyFZxQ8d7RIT8Cff9qZoKThRbc/+oOPxLjRWvYcGMkIVZ5WJwgZU4TwPRMoaVNaG9Hq6hU0NNzdGRmK9Oo3ZtnxQAe77IMr+wLu1EEds 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: List-Subscribe: List-Unsubscribe: On Mon 07-07-25 16:42:43, Alejandro Colomar wrote: > Hi Michal, > > On Mon, Jul 07, 2025 at 09:53:31AM +0200, Michal Hocko wrote: > > On Mon 07-07-25 09:46:12, Marco Elver wrote: > > > On Mon, 7 Jul 2025 at 07:06, Alejandro Colomar wrote: > > > > > > > > We were wasting a byte due to an off-by-one bug. s[c]nprintf() > > > > doesn't write more than $2 bytes including the null byte, so trying to > > > > pass 'size-1' there is wasting one byte. Now that we use seprintf(), > > > > the situation isn't different: seprintf() will stop writing *before* > > > > 'end' --that is, at most the terminating null byte will be written at > > > > 'end-1'--. > > > > > > > > Fixes: bc8fbc5f305a (2021-02-26; "kfence: add test suite") > > > > Fixes: 8ed691b02ade (2022-10-03; "kmsan: add tests for KMSAN") > > > > > > Not sure about the Fixes - this means it's likely going to be > > > backported to stable kernels, which is not appropriate. There's no > > > functional problem, and these are tests only, so not worth the churn. > > > > As long as there is no actual bug fixed then I believe those Fixes tags > > are more confusing than actually helpful. And that applies to other > > patches in this series as well. > > For the dead code, I can remove the fixes tags, and even the changes > themselves, since there are good reasons to keep the dead code > (consistency, and avoiding a future programmer forgetting to add it back > when adding a subsequent seprintf() call). > > For the fixes to UB, do you prefer the Fixes tags to be removed too? Are any of those UB a real or just theoretical problems? To be more precise I do not question to have those plugged but is there any evidence that older kernels would need those as well other than just in case? -- Michal Hocko SUSE Labs