Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp653812pxb; Thu, 26 Aug 2021 11:11:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy53WGhcinzDjuojIzDeJH2BlKWmpOYpf028WGURb9hKDujpDUtRjtqGQOXSwfRcPYGQRjk X-Received: by 2002:a02:cca8:: with SMTP id t8mr4592542jap.51.1630001502273; Thu, 26 Aug 2021 11:11:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630001502; cv=none; d=google.com; s=arc-20160816; b=lahqsqPIAUhtXUFuP/czlJ65m3J/o6Aq+qpbb5g6y++R+SGCvn6GGYx8aUTQFW68XJ xTESHwcKjss/ET26zb8R4VLH1GzDDsUJBlkvf9BQVy9ATtigLpnKb5GLrwAIiguKzqlW VgwwZCkk5Cq6feKPAw6Xv238XUXJcgvTEhYW01zUtx6jQajZTQC5Kdap1/a5wpM0Wnky JGmEW4JyQAxzdrWET8N5fUCYgU80hHF3TvXQ15sTZASGa5E/1lZOKSbixTUYJs/udsWi NVzZc2dEEyDurk1pk+pYdVuoo7ylwd1uQdmgRhhwEeyIxUFRvhEFe5Fr1XO3sS5oNcfq FR0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=sdk8oq9F9d0RnEa7dfHJHGoL0Z5yyU5Y/fEoZ2o9vEs=; b=rOvjvI9vZeRi3BY0X9YMa7S8cyff0M0DO3YBYRufAnD+zGOpuFgQzJnQ1QSyftyOaE 4fKre7JVgqhcZqdnYi7dE1AirhpMDS7DedsZDMN83ayKyi9GRrndlRG86eSrInNmSNYo /A0v/g3AckXUpbNDt8aRO1xRLuO0Pgs6F7XHrFEPbBPaCcxsAJP+1MDM2+o5fS/QgppH Q3OhXaU1VBOM0SRoi/JlbpXLXR5mjiA2fpdcyY9CGf1od0bKyzO6xUNMO/vZVSqyTfE1 QhX4mgSEBbR4XAgOhFVsfD9RJ8xcO/6J3m3tjDHJHs9efZ76/fzr8cPlmRHMdi4fNKbC iuKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=oFaf1OcB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v16si3639313jal.55.2021.08.26.11.11.29; Thu, 26 Aug 2021 11:11:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=oFaf1OcB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229733AbhHZSJu (ORCPT + 99 others); Thu, 26 Aug 2021 14:09:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243259AbhHZSJs (ORCPT ); Thu, 26 Aug 2021 14:09:48 -0400 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C094C0613C1 for ; Thu, 26 Aug 2021 11:09:01 -0700 (PDT) Received: by mail-lj1-x22a.google.com with SMTP id p15so6728713ljn.3 for ; Thu, 26 Aug 2021 11:09:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=sdk8oq9F9d0RnEa7dfHJHGoL0Z5yyU5Y/fEoZ2o9vEs=; b=oFaf1OcBV6BFwvxWMUemdMKSedBA9yLmq2eCG+ad7OwqaD0DiP62OtgHqbIW+StaVP VddT4aGeBBKdcB+6YQiOVT6GNI7ARrjOkBRKmAU2/fCGYmPqB7KBFkirU1o2quzVOqyD dFYM2M7vmIQanPHyRne5WCpOOnba+vaLR25yr2+x1D2q0IbH1jUFCvTT7LGPdrSqehFb KtY+S9RhbII4vMAKnm/Gb63bmnkY8PaCXXIrrHLFrr0+f/JzC/phq3kYrUtwJL/wngqf oRGQAzTOeaUoQJtayoEQ4qAuMwS+HkFfmja7WeOMv0YCv2M+JwqoUVHe62GEZLzsyhHd hJfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=sdk8oq9F9d0RnEa7dfHJHGoL0Z5yyU5Y/fEoZ2o9vEs=; b=oXo6Lo1BfSROAEI2jxUfJQqckVXot/cOA9/EPaWemnRnZ8o0PIHP5XtotdDxiqVRoc orMdSPkmqa4goQGTbEBP0iAKQ7RBljmxyVFSH6tPYg4gxHxDa1bfHEbv3T1StC/4yuuQ f0HZVo5IM/zP988p2C9lHkLKgq50AqVgAeaZVCZFHKWzVCYZmAlBcqUN169o464FBlwc hhx5GiBbmPBGjAbUZjZ+OHYGnwIJZvoHmV6N5QNbBjFeOquOQP1jkqpP6Qdi1Ak0Rrl3 /ZTkXLEaKYaMCzi+UarnHi8EJcyONxKMN19NRkRmhodYTDNIG6iypf+Tsx9ja5Bu6VTs OJSQ== X-Gm-Message-State: AOAM532VruD6B9W9lKofsgBAptYQkrzAA4T5k3KrXy1ZbFBUAyTb0FlZ cICQCpDKprXbM4iOGW4eWRVRTJ9e3XZG8ZXh9CEDwQ== X-Received: by 2002:a2e:a788:: with SMTP id c8mr4240939ljf.116.1630001338932; Thu, 26 Aug 2021 11:08:58 -0700 (PDT) MIME-Version: 1.0 References: <20210822075122.864511-1-keescook@chromium.org> <20210822075122.864511-15-keescook@chromium.org> <202108251942.26FC1B8E7@keescook> In-Reply-To: <202108251942.26FC1B8E7@keescook> From: Nick Desaulniers Date: Thu, 26 Aug 2021 11:08:47 -0700 Message-ID: Subject: Re: [PATCH for-next 14/25] lib/string: Move helper functions out of string.c To: Kees Cook Cc: linux-kernel@vger.kernel.org, Andy Shevchenko , Rasmus Villemoes , Daniel Micay , Francis Laniel , Bart Van Assche , David Gow , linux-mm@kvack.org, clang-built-linux@googlegroups.com, linux-hardening@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 25, 2021 at 7:47 PM Kees Cook wrote: > > On Wed, Aug 25, 2021 at 02:48:30PM -0700, Nick Desaulniers wrote: > > are memset16, memset32, and memset64 worth moving as well? Also, > > memscan(), check_bytes(), memchr_inv()? > > All of these are implementations, so they should stay put. All of the functions being moved here are definitions. So what's the difference between moving the definitions of functions like strrreplace, fortify_panic, etc., but not memscan(), check_bytes(), memchr_inv(), etc? ie. it looks to me like a few more functions can or should be moved as well. If the point of this patch is to "move all the helper functions into string_helpers.c so that they gain the fortification coverage they had been missing" then it looks like you missed a few. I don't think the compiler will recognize those non-libc identifiers for any fortification related transforms (unlike memcpy and friends which are left in place). -- Thanks, ~Nick Desaulniers