Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp1225598rdb; Fri, 19 Jan 2024 11:58:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IE0BWQFGvEEmaiTAC593iflrwHD2kUcxY5TXFOZ92qkFj6RegPNLNOwBqEjfC9oPIQBj4Pl X-Received: by 2002:a05:6358:52cc:b0:172:e227:bfd9 with SMTP id z12-20020a05635852cc00b00172e227bfd9mr296313rwz.42.1705694325709; Fri, 19 Jan 2024 11:58:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705694325; cv=pass; d=google.com; s=arc-20160816; b=pK2/mrUa6fJVQnZq7HpMPatbwWqs7oxXKQlkxi7w1/C1wxB/7jgo/8UPswFXDN34q7 E+G6exweQAQtcS7eBZG8/ZtBC7rlisjCI/Z9qX8eKTsfJZEvXksSMllx5FJ3t/gnc2Nx 8vt7q1HKPEOTZCar1Qeb/THX5izEnSvoq11fJ3DKNj2c11RA225DwKRHFyq5wpwaA/Gy Z15q1228TRXm74Qv6kyj8Sp+DjwKRGMdwxRcHilO3Mef3a8ZPooVBYDMHk4YhfYx9p4W KeBBacaULppArtCew+UGrBj3DlclwEefbc9oUcuybTH/EJ3ZaWgMK1I+ikb1E/7OlJjY 3Qtw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=C2LfwYsyKiY2dEzfHpNnaI1FNPWRf8Tkgz7+9RYGVco=; fh=Xe5TIVrCLk1sSKngD5d3UI74BUSBKV3nRoP08n+XjzE=; b=aW7BoaAhus2glcjFZkq/ur2qQxN8sxrSXF6U/NeT6FhdyoilrS4oUNdq8BsPefSAG8 iYTs7lwdcFOZUwa9D15wJw7sA9SUTXJdy2OMAhBClyONreT7WiEX9Kt5rfaQYKX45wPQ Xph6I2I465g7pzrVHBwtQCt1jLMy+nxguu+/Kr9Ai8hxhlmh5+cGkhwr9T3vwRoPAytg wRSb2tVlRaNfVN2mZ2Gb6LEPw62cNlF+ARN+ulsDnNv9KnEKoFAYb0UNETtjmgnjawk9 Yme2O/axQUXmL2TBZs/+7OJTm94ml0VwLao/XyzEwrE9UmFua60y8SqgVo2EX2AgQZ54 34+A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=fD8vZtdK; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-31527-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31527-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.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 bq9-20020a056a02044900b005ce045f6056si3970870pgb.860.2024.01.19.11.58.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 11:58:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-31527-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=@chromium.org header.s=google header.b=fD8vZtdK; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-31527-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31527-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.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 47E9C286FA0 for ; Fri, 19 Jan 2024 19:58:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 606C956478; Fri, 19 Jan 2024 19:58:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="fD8vZtdK" Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) (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 7145B55E4A for ; Fri, 19 Jan 2024 19:58:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705694318; cv=none; b=O9q0hzSa1q0mHlGxKJ9fsV9cFwLV4QZzRVai667Ptbwh2gyV7SpVMKAXlt9HpqwyBrTzp9CYY5Z4VEgfpnsQVgEOjheytMhMPuEIGsVRufx/4Mi2BnrG6giQDCr4Q+TTm+gdXD/IAt6Iw/K/UxkBWdJLnlV9L15aMLFufG44FwU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705694318; c=relaxed/simple; bh=sThutFEPey5kn1vfPaO+vlKXcAo3DAOcgLqEvPMy/Yo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jZ13bJ7YvraqCbQ6vrIveFnbeZwhBzeEtw84paRUbSxnQge/BAEj2w9iiLIp2fantXnMzga/T8msIEk7wsvjZe1qymXUWCQvFMJhNQv8t+5M6VKna93KQF6GMa0ydB/1HV9fgdpJwwGHbJnFfPqdo9i4r0FjY4VPQsIvDbQz1WQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=fD8vZtdK; arc=none smtp.client-ip=209.85.210.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-6dbbcb1aff8so837975b3a.3 for ; Fri, 19 Jan 2024 11:58:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1705694316; x=1706299116; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=C2LfwYsyKiY2dEzfHpNnaI1FNPWRf8Tkgz7+9RYGVco=; b=fD8vZtdKgPd/0l8vPCY9s3YMnHwivIPi6pgfnbxzvoLgqrXTE/gG+agMxexYr3lpX5 sWB4PxeV0nTdl/0FqyE2UuX0Wn9udVw/J6vAWudq/6S5Az8NzAfuU3X8i1ndYMlnvMdi onmdzoxFxgWp5qfL5+j1rcqhxa+d0vI5D4+O8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705694316; x=1706299116; h=in-reply-to:content-transfer-encoding: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=C2LfwYsyKiY2dEzfHpNnaI1FNPWRf8Tkgz7+9RYGVco=; b=Svwv4xmBstxFR7hul8iH/4FgQq7YNj11ATi6C5a59DibVbPeMPfSG9UaX2OCOHCyIY 2jDzlYbaFNFXctKQDA3X9Wz+Jg29THOCEb26uotbAMxMAHHRapuASj6VmvhV8Kwlqpg9 LCJzHLxZaGB+QTegoN7Acut0yeLM1OsstpqzoV7A6Q7Xhs1NtOvAv3jxPl8eUEU/hAjl AccTzs7GKppWnZnLU0UbICAlekR/79uxqDMaJqABO8U4C62a6r/6v9O4tA9VaCpRY7Hq a2dZ5ZOZVGpjmRmA491lVvMTjjbXLlC6zjMsjcCJRS9+rUVrjhrwm23PWQP/UGT5YGlN bjcw== X-Gm-Message-State: AOJu0YxGNtUD793Eok8E+D3Vqpmv0QkqKTt7HX6ksEkJThDJgbnYbC+E vaLY1T2p1DOmTJXaH/pr6n/CuXeHtBrmdWRez2wxcC6W/yZMQSOyKw6sYrmfPg== X-Received: by 2002:a05:6a20:da82:b0:19a:8556:8caa with SMTP id iy2-20020a056a20da8200b0019a85568caamr486992pzb.13.1705694315821; Fri, 19 Jan 2024 11:58:35 -0800 (PST) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id sm16-20020a17090b2e5000b0028dd3ac24a6sm4561644pjb.9.2024.01.19.11.58.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 11:58:35 -0800 (PST) Date: Fri, 19 Jan 2024 11:58:34 -0800 From: Kees Cook To: Andy Shevchenko Cc: Andy Shevchenko , Azeem Shaikh , Andrew Morton , Andy Whitcroft , Joe Perches , Dwaipayan Ray , Lukas Bulwahn , linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] string: Remove strlcpy() Message-ID: <202401191141.F6902E74D@keescook> References: <20240118223301.work.079-kees@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Fri, Jan 19, 2024 at 06:05:19PM +0200, Andy Shevchenko wrote: > On Fri, Jan 19, 2024 at 12:33 AM Kees Cook wrote: > > > > With all the users of strlcpy() removed[1] from the kernel, remove the > > API, self-tests, and other references. Leave mentions in Documentation > > (about its deprecation), and in checkpatch.pl (to help migrate host-only > > tools/ usage). Long live strscpy(). > > ... > > > * Copies at most dstsize - 1 bytes into the destination buffer. > > - * Unlike strlcpy the destination buffer is always padded out. > > + * Unlike strscpy the destination buffer is always padded out. > > While at it, please use the strscpy() form to refer to the function. Oh, with the trailing "()"? Sure! Good call. -Kees > Reviewed-by: Andy Shevchenko Thanks! -Kees -- Kees Cook