Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1235757lqm; Thu, 2 May 2024 08:47:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWmoAbDyonk2cPtJZMvHK72XHSMGcq5ZMDtN3BKybc3NMrwLG4+eBzG+NoKEIQ6x/6csHbw3iPbOTpoIWX+8rqzGwQX1seUN1+GcfvutQ== X-Google-Smtp-Source: AGHT+IEgxZs4QbHkbUafdI37KGXGL3cU3Zd8R6bwd3RxYX60APs3idcvDPVhBhG4KG0+ELFPC1wC X-Received: by 2002:a17:90b:1295:b0:2a5:df97:b with SMTP id fw21-20020a17090b129500b002a5df97000bmr147187pjb.18.1714664870077; Thu, 02 May 2024 08:47:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714664870; cv=pass; d=google.com; s=arc-20160816; b=B5lLsqKBFoJ8YY9MqibzDqpht/mX5DFGndod+7MTx/Y5PFuMGQvHB6Y8JNJHj00Qcw guzCrchooNt/XG2BaBN2/PnS5eqQbXk+LZiEMhWl6E8FlAcoUwmsOmhWezXOYSI2+T8m txSmrpTSZLG9FezaH1/vyG+B8z4xyElDxgLlh4EvSsVYyezZxtu1P7U12v6qdR5D589h VgX9cgXPA2xO+VioQN1NrS0sTVpLAX7wlR4EDDRHI4nmK88rDZu4CRtaNL1LGGcUHqVc JxwBhyPNjo42mjV3kc9nUchy2fbCaP226IBx7e+OIOTHyHmbcEeLRoXqSQj1Kk4j3H48 9urQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=organization: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; bh=boVBcOY4LX0Rpxnrts40Yf7o4cuv1aRVel4SGECafZ0=; fh=JHssr3M0sYBxuYZ7gx0hKyI15Ia59I7lmiGioVeE84o=; b=Sx340vlj0h6ZpnxfXW+hGHcMVFRXq32g1GgThRWQcBMeKkD4NG+B0Vk9q5PEdxfDHj 5ToMO0EMcWKIeuNeclGa53VvosKTsKfjbeReIra+Sgcmrtms2l9IThfzQ9wIFvGb175T 52s3N0d2iYVGthEOsw5CAXo+t1JM07buXtVp+zRgZ/3WelWE54oUK/K8cCQKtxw2SsmQ E7Y150NehxilCR74uDnie7INZnVAsfO47E8MfBA6KEQgkOPfMrfunG2IGsPgf/et+103 rS0INxAMR6XNWhKjaIwYY6Alobj7KwbV0oC0IiAvrDQkO19JMNSQhOS4ET7vXt/anShZ qaMw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-166655-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166655-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id cp14-20020a17090afb8e00b002b283cd5b02si186414pjb.108.2024.05.02.08.47.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 08:47:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-166655-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-166655-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166655-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 8BEC5B21CE1 for ; Thu, 2 May 2024 15:38:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 59C7615B54F; Thu, 2 May 2024 15:38:52 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7469A15381F; Thu, 2 May 2024 15:38:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714664331; cv=none; b=k8ydzM+7vwHeOIhy626jTl2AZaQz25MlRHUE0zuBqG8tgxMKL4SmJTfHcm7r6iyMQWcAzoCW+0YeA3J1CnBO3+ve0+i1HUuMCCi4Lp8HDm3DSDScWqe5LwQ+/tOGV13WKUrdcKmGY4b4J1why3R8FeoZvb+X4LtoVXF2s4xbmjA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714664331; c=relaxed/simple; bh=19JNsRFEKUX4aIFSbQgj18sRdjQzRL6sHrU6+0i+8y8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XXzyTxPziWlniXZWiJbMsEzym3ctyjlQuDOtXTOdh/3P22UGX1Nh8m3RZC8FwVv6hvKf9RZjTTj3ASmR3DkOOxHSJoMZQB/3wX84B2k+NQ4rp8oVBNa2Lf739VOUfJVokalQFMizVN1AdeCG0SrGx3UH9qibcas97N6mZ/yBm9E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com; spf=fail smtp.mailfrom=gmail.com; arc=none smtp.client-ip=192.198.163.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=gmail.com X-CSE-ConnectionGUID: rkPEPQY7Tw6bHi1I5fkD9A== X-CSE-MsgGUID: MStDGcttTDyjS32/h0OrLQ== X-IronPort-AV: E=McAfee;i="6600,9927,11062"; a="14247058" X-IronPort-AV: E=Sophos;i="6.07,247,1708416000"; d="scan'208";a="14247058" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 May 2024 08:38:50 -0700 X-CSE-ConnectionGUID: QvFjUOimSR+HemaZ6JTTjQ== X-CSE-MsgGUID: iObttkVIQhOkVK/mU7eD0Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,247,1708416000"; d="scan'208";a="50356399" Received: from smile.fi.intel.com ([10.237.72.54]) by fmviesa002.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 May 2024 08:38:48 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.97) (envelope-from ) id 1s2YWD-00000003MgT-3p93; Thu, 02 May 2024 18:38:45 +0300 Date: Thu, 2 May 2024 18:38:45 +0300 From: Andy Shevchenko To: Kees Cook Cc: "Hsin-Yu.Chen" , 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: References: <20240502141359.89567-1-harry021633@gmail.com> <202405020809.C8973634BF@keescook> 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: <202405020809.C8973634BF@keescook> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo On Thu, May 02, 2024 at 08:10:32AM -0700, Kees Cook wrote: > 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. Right, we have a word-at-a-time.h or alike for this things. -- With Best Regards, Andy Shevchenko