Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2543385pxa; Mon, 17 Aug 2020 12:17:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz43F0KdnHW90txDfSWKyh5VP8Fdsw8e7vkPECuE6fHs/uYy7eJqk6wSqCSGITy85fV1a+W X-Received: by 2002:a17:906:13d8:: with SMTP id g24mr16330342ejc.317.1597691857103; Mon, 17 Aug 2020 12:17:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597691857; cv=none; d=google.com; s=arc-20160816; b=mdK+C2D9ypPXk/P+aFZLcww5YNlAgHe84D/XOlCQaUrXNieumxLoJIT3JEHZsO8XNv fE68tQoEuFt8yr6WM8lcuErpQDSHjxztfW3chV//e+BrjaDhrfrjJATJ+Q+REtkcXMyy BVMNGYB4JVscC1kCzMYjniN7gjNnNE9iTiujI/PZU5n7n87AslXk3QWISU0rhpBrep0E ydFUyfZMaZ5/pfj4ELDkDwixoJVgXn4PywiOrLXq0D4Zv48N25E72Is6FBdQwdXWsZop q8XXQEEKwrFwJYYQAZCKnD9PFxArbxhLLGoi7NfII0U7WML7SKUTQEFQYGCAtBw2ZDZ7 Q2yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=tmBgqfU+29UH3A8gIAUsMUZvU1W2cHudzSZ0yYhvH2g=; b=QLwMYWcl38JaraMzdvxtmOS0FMmrn7beyOxrdpn7gMo7X72EiOAtTvPuTcPIjY18JS 0H6epcFF3sYRDXGnhHpZGH+37aU7zg3lb8TT++8s6ct9BISQe7JLgURxiqvP6ppj4oT+ f20xG6ukrapka/oeIW29+otTp9WGO7B1sngXIhOPFfTwJz1Y7y3afiKqEHeDtbvcJvxy q07NG7nzvEofaVDUGvSJSPFKzN02vAl1ODmy8yC4gb3U3n9AGuxlE8/O5n+g09335/Mn RN318ohriq/UAd02YTSuUVIpNxgFmMrq50t9b4mLZGmFdv6Piwd1JfvrLNz72M5q15H3 AOgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=aX4E0LFg; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g19si4381007ejw.96.2020.08.17.12.17.14; Mon, 17 Aug 2020 12:17:37 -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=@chromium.org header.s=google header.b=aX4E0LFg; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731912AbgHQTPj (ORCPT + 99 others); Mon, 17 Aug 2020 15:15:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730416AbgHQTP0 (ORCPT ); Mon, 17 Aug 2020 15:15:26 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B71B3C061342 for ; Mon, 17 Aug 2020 12:15:24 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id mw10so8116174pjb.2 for ; Mon, 17 Aug 2020 12:15:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=tmBgqfU+29UH3A8gIAUsMUZvU1W2cHudzSZ0yYhvH2g=; b=aX4E0LFgDJUJNb9coXJEVWiFmcjetcbxAVRPFlHU+DPwMWC+xVxGVFwkAMuaLx8U84 po7x1kjGihO1o2YsEEtX4D5mdlIDO5HlKqYEVeRBXBKxpG/GAuuxSuPH95iP77RlnFmG LfNgJRnCT9dWldE3WzaTTcQFgdaUSAl3IuBpM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=tmBgqfU+29UH3A8gIAUsMUZvU1W2cHudzSZ0yYhvH2g=; b=pk9ZIDCdw/v5Kzy05VstXSafj+W34caKSmFubK9xxUOq5ThNuaiGdVGMSP74XN3dmQ xWMDMjBTlAI1Y67jbN0dvt98U6k8yfdjvnnwJon9zL2Fff3GQ7i0ICVTus3B+Kl1UWNn oLqjZLY78iTJEUDYmZcYLckYDk8slojjGRhjZdhMW2SzV5W07W/IBSlFHA5cfHT27XHM MGiIYLYKs9usfq+UgyeJOlm4i4IIU/CBZkLCPZr6aeNGK9WMz7N/vxbCG5OOxT/yQCeU Buhcl6CXkf8BGLnRJTiat8TenMIteOJyO6sn4kRnfEXcUGr0Lr48vW6A7nppr08vpd7S jm+g== X-Gm-Message-State: AOAM531z4bCPxy38IBeKbfllOey6FNJYE4X2ZlsfFJ0jSb/In5b3joWP 5sKuZUjpqPI4DcQXHQ1UkkH6UA== X-Received: by 2002:a17:902:7293:: with SMTP id d19mr12778333pll.303.1597691724086; Mon, 17 Aug 2020 12:15:24 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id q5sm18109334pgv.1.2020.08.17.12.15.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2020 12:15:21 -0700 (PDT) Date: Mon, 17 Aug 2020 12:15:20 -0700 From: Kees Cook To: Nick Desaulniers Cc: Sami Tolvanen , Arvind Sankar , Sedat Dilek , Fangrui Song , Joe Perches , Andrew Morton , =?iso-8859-1?Q?D=E1vid_Bolvansk=FD?= , Eli Friedman , "# 3.4.x" , Vishal Verma , Dan Williams , Andy Shevchenko , "Joel Fernandes (Google)" , Daniel Axtens , Ingo Molnar , Yury Norov , Alexandru Ardelean , LKML , clang-built-linux , Rasmus Villemoes , Nathan Chancellor Subject: Re: [PATCH v2] lib/string.c: implement stpcpy Message-ID: <202008171213.CBCFF5D67@keescook> References: <457a91183581509abfa00575d0392be543acbe07.camel@perches.com> <20200816001917.4krsnrik7hxxfqfm@google.com> <20200816150217.GA1306483@rani.riverdale.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 17, 2020 at 11:36:49AM -0700, Nick Desaulniers wrote: > That said, this libcall optimization/transformation (sprintf->stpcpy) > does look useful to me. Kees, do you have thoughts on me providing > the implementation without exposing it in a header vs using > -fno-builtin-stpcpy? (I would need to add the missing EXPORT_SYMBOL, > as pointed out by 0day bot and on the github thread). I don't care > either way; I'd just like your input before sending a V+1. Maybe > better to just not implement it and never implement it? I think I would ultimately prefer -fno-builtin-stpcpy, but for now, sure, an implementation without a header (and a biiig comment above it detailing why and a reference to the bug) would be fine by me. -- Kees Cook