Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1213248lqm; Thu, 2 May 2024 08:14:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVpwxOydS4wzCNJJ6NizZsy3qpowun8fzUxeLX8jRFFL7h3skhjTh8Hal5HllFCNDGpbX1s8lMd+CQ6foOzGarlv4g45+R6UffKqg8oWA== X-Google-Smtp-Source: AGHT+IHHmBbRrIKj/+IMtgZMy2uXf78piqdkwnSOSgLaMmuWfzQEko0Cdl7xxuJmTd4DR6AUHu/p X-Received: by 2002:a17:903:22cf:b0:1eb:4a72:91ff with SMTP id y15-20020a17090322cf00b001eb4a7291ffmr3099420plg.49.1714662865795; Thu, 02 May 2024 08:14:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714662865; cv=pass; d=google.com; s=arc-20160816; b=0am0am82JJgaGfGl0ehur8ybfVt7JjgDLOKoLxuL5jK5wEd12Gyf6XvmpJrVz5EOCs R8m9ZaXxnDJsDwjMn4UVMD7pkGwLQ91RZQSYrGzLdiscfHDSWEZsICvg3sr9KuwclJrf PH7uj4/SPHszUm+qlwe6wJEL/ledrQnwdoQrjgzwabp+QpDuBCB6hrTF9Gw6HDgg8y2C LL+4VAnuG76QEizhK46fE0Z0NVQmddpVtJTjmXe6F6uWjC+IKD3icI6oGrgNEeIGEtrN MdHBaRXSaAg+svt+51gjRMLthIY8G9uTWBwOTKIgtE75QWtu29SsLelJ2/REbIon8BOw 2Dag== 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=xXVdsaSQZG3q3BjeEnlUXi15uZTx4OzcFDhBo6L16Js=; fh=aUmqWdlATQLVWX6A6rxbRHcTHwP0Voeq6i9iH04LCuY=; b=HkAdYBGApHvtZovO1j8efTQOotO2+foEv9cT4sorzowBy8gq/nYmskHGhbECkyk3w4 prLUx1hWtXVsvxzto9YGgLj+Iv7ZhjJcBP4S7fF2mianDAyNpoxgmG5psyFu6JI68zCC ikof8iPkue8CXbVcSDvVULh2aM3CruIlONnaxjLp2d9RGf1RiOx4H7v1q4RK+uNlbmPV uL/h52CkWOqOIho8Qd6XVcWNSByKOlQVySQ3QSXbaQTKw0J1DVY/l7cO31x/X8YnDfgM FyRid4eVXy2vsphnAbhhK0p/9KFVdRfVbX6ogLff+WVyob4WehIgEob5GrQCmxyYkj1J x4XA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=h2Eqjfjz; 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-166616-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166616-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. [139.178.88.99]) by mx.google.com with ESMTPS id ju8-20020a170903428800b001debbbba48dsi1120700plb.197.2024.05.02.08.14.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 08:14:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-166616-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=h2Eqjfjz; 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-166616-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166616-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 0FD9E288903 for ; Thu, 2 May 2024 15:10:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F3B8D158A11; Thu, 2 May 2024 15:10:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="h2Eqjfjz" 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 E140215686F for ; Thu, 2 May 2024 15:10:33 +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=1714662635; cv=none; b=Je7hOf5MHZzL136uha0fFgMLgBsihputW2Ux5y26RNYVbhFiXt7xQDBZcBA0nO2JhG9KwG8tOT1QpEYlHQPA7GZvfeC/DlxPAEmuqOFJDlEtDb5o7qT0ZFAooDfqtVaSEAL6PUYDcsq1PoDTuIyYUSPDYO2P2snQ9+WPU3s4rsU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714662635; c=relaxed/simple; bh=Syf2VkK9OhG0FGm9QolyXfqpQVipkFzlmRdO+Bf9ENk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=kea0a3YBspJaYYpNf3TYpfNaR8oGfb5J0rAGuUzbn0turJRuhBYGK6JQeJv0et6Jrwr/K8mfAacWv18v1ishN4YI4CSD9ArNTvjpQEhl3BL79CFgqeoT8avhUdZpE0tKaC3QKMsHmeu0vtWFn2dbKXdoonu9VChLwnzX3no1v80= 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=h2Eqjfjz; 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-6f4472561f1so182688b3a.0 for ; Thu, 02 May 2024 08:10:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714662633; x=1715267433; 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=xXVdsaSQZG3q3BjeEnlUXi15uZTx4OzcFDhBo6L16Js=; b=h2EqjfjzYM3XOGhILe6haVIG3Yi6d6XW1bPfW9ScggCVjhapfmiIYyQmgB3c82WuHT Clsa8rm5TZ7A94hMlTBzdXIT/nrV4ehH9omp7EAvXBlNgNIr/71Rm9DZDK90DtH/fFji w2ExWKQW4tTfC83C/XBY0DVR5p24sWm4TsiOM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714662633; x=1715267433; 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=xXVdsaSQZG3q3BjeEnlUXi15uZTx4OzcFDhBo6L16Js=; b=od5tGy+xkQyRFtDFe5BD38scvG2M5f+Oc1tJh4wCmT31ZxZhF9aB3N+UEae8FarZgV ejuJwkpVzqmUtGUiVOlUfDkDfXlroj7dVb2FgTJ7bj7xkTH1Y1shr/TdTVomuSSFljRV cQ9bHBxZ0fKBl6CqvLbfON7Nj4SciZC2Bi+zyulLTi80BREUdM/Gfm0hDTv3U+aaUXVw LcHGOUDWlZQ9dCS9ux5CZ6n+VOl6Jw2g2PYE6P+7V51wZHXAuhqVSJjJ/TJ5sPjWYE82 6cj5pYq4l2U3svkqBYXfAPoRrN2ASnJPqHYu2Pb7YgGaPv1Jv0GqLyOfq0WA2eW89y76 hlhQ== X-Forwarded-Encrypted: i=1; AJvYcCXmlIoSr6cYFMCMHV2HvfS0rIXB363oinscPpQ7ZYpGZzUfWuSYsOYhUr/UXKfCAJycgsqIwAoLtXrR/fIPQRRxaI2Dzn3czKaiemGW X-Gm-Message-State: AOJu0Yz1aSW31jC3Z6SQNa6ogMyXJdCWwpNBpImODH4v+D7CrqmJbhjr X9NVprX1TaGuXPQpCd+kXl6cGkXZHzpnNIiLAUb5SKfzaz5uhLg6YDvu2bCIiw== X-Received: by 2002:a05:6a00:4646:b0:6e7:29dd:84db with SMTP id kp6-20020a056a00464600b006e729dd84dbmr3422934pfb.31.1714662633150; Thu, 02 May 2024 08:10:33 -0700 (PDT) Received: from www.outflux.net ([198.0.35.241]) by smtp.gmail.com with ESMTPSA id y63-20020a633242000000b005f806498270sm1340442pgy.9.2024.05.02.08.10.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 08:10:32 -0700 (PDT) Date: Thu, 2 May 2024 08:10:32 -0700 From: Kees Cook To: Andy Shevchenko Cc: "Hsin-Yu.Chen" , andy@kernel.org, akpm@linux-foundation.org, linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] string: improve strlen performance Message-ID: <202405020809.C8973634BF@keescook> References: <20240502141359.89567-1-harry021633@gmail.com> 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 Thu, May 02, 2024 at 06:03:04PM +0300, Andy Shevchenko wrote: > On Thu, May 2, 2024 at 5:59 PM Andy Shevchenko > wrote: > > On Thu, May 2, 2024 at 5:14 PM Hsin-Yu.Chen wrote: > > And on top of that, check what this code will do on the architectures > that do not support unaligned access. If everything is fine, mention > this in the commit message. Btw, your commit message needs > elaboration, e.g., pointing to the test case (which is absent in this > patch, I assume it's already in the kernel?) and step-by-step > instructions on how you got the mentioned results with details of the > hardware you used for that. I might be worth looking at the implementation of strscpy(), which is doing similar multi-byte steps and handles unaligned access. -- Kees Cook