Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp354664imm; Thu, 31 May 2018 01:26:19 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJTauHOufZnBEaXK9wEJ0DJ3y18lRUK4BwyHO4n2wIjuYSWR8THCrs9NsU6llaZ1KEJW4p0 X-Received: by 2002:a65:6355:: with SMTP id p21-v6mr353675pgv.293.1527755179639; Thu, 31 May 2018 01:26:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527755179; cv=none; d=google.com; s=arc-20160816; b=hGsSz6H3gvT3E2hAbjEbZxacILIAPrQ/2C2hoKvlEGUUIHI7lc5fPW/cSLTH7b8LHR NGAA5zJHhPeet5MWTb9iXAmOVDiTzgIJ2GU53gbkOljoeOB/AulifUPW8KQtdiWw1qxx KRXIy0F65v3r5QMnlYlfiRnSjv6C2nuL10UQmD/Dj/PpubFfs15Ou+EWTDdDLrBrGSQT iqs5BSTEJ1G62WJ5g3gWC4HhxZMRu9Rkrzik/rLsnjxIG0171jSBJ6ek8YqOEqkBaIH4 mc3kNhAMWLTtEvc5f66Xxe9yG3o+nDcBxIXOYIKiVRmsqA931aDbOTGecK5X6sQe4xks RdMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=uWEQfWB/8HnfxU1vhRHzGzrDq7ggzYEdKcDOnQHoShE=; b=LIqDdUZ+pmw+7DsJKohfl06pZGqHNslAcMtWl8nj5pdQXRG/C7x3Ux35nzKM78hiFX MDRvch3622vumuAxCIK5zwg+/I8F8IER1pkcr8fJHEwoe9EDHLL//L/2XLM/ntZ17jCB L08Yrs2nN4lqiQ97x1esGV3NTwRHJSbjcrcBeBQ0Iuq3A6S5xzbtKlqkg6QEIUwfz7Fy EoquyPyuNgqPIcRzDpC2qR8JUJlGUpiFXANsD4kmEDUNXnCWNLmqdLQZ0lWaIbVdTYJc gOxCkaPxo3wELtDOcXMqxG+XzJWw4g/+dM8zoZtd34gTk2eISOyv2Ag+SfW4yTVbSCk3 q3lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Rzqz3Xpx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v41-v6si36551761plg.451.2018.05.31.01.26.05; Thu, 31 May 2018 01:26:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Rzqz3Xpx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754058AbeEaIYg (ORCPT + 99 others); Thu, 31 May 2018 04:24:36 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:46575 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753957AbeEaIYc (ORCPT ); Thu, 31 May 2018 04:24:32 -0400 Received: by mail-wr0-f194.google.com with SMTP id v13-v6so20388127wrp.13 for ; Thu, 31 May 2018 01:24:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=uWEQfWB/8HnfxU1vhRHzGzrDq7ggzYEdKcDOnQHoShE=; b=Rzqz3XpxXTGOZ449xnkylQ+sQiuSMdkFZjzYWszOkztwarXt81BWahgYOF1+YdMDho lvoemYyDbqHfTysHdwdasAHU/dEE30jweoFeGb+RZPb7tksXZcSt1jsy81pko/EE7xjD ZgOIBJNeJ/pyh2C7X0R2Dt5V3yy73grCYUhcs= 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:user-agent; bh=uWEQfWB/8HnfxU1vhRHzGzrDq7ggzYEdKcDOnQHoShE=; b=DseSuMD1oRXnVcBq9NjiZSprwCazc+HhflzsH6jUZmpTWLnOlyOdbh5fTBlqfHvmW/ lG60T63XAJC7eKDfxAIVTpCwjK0UJR5eLmlTYe09OPkkhwh6j+O128d+LGJdHKTrk6ZW YyKUSnjumOo2ynlQnzO/SDjmkds9rEgSxWIYxPdQbe6kJex2908YVkk0hplkfQerXceD ypYq71WkepdylFRK5QO9qANqxoD0ogf27D6xcnRlLe4/5WfAKS9LjQTfIq/4a7SiOj0D EUEBnmkxLD70nlePMvsB5zguLqMBlQfvOyayZOYc4bnJ90cxSvwfJf/zQJ45z+4rwVDe 7bIA== X-Gm-Message-State: ALKqPwdbLpHF/7ymbYC7uQiQsZ2eolGoaQykVmVVzuL6VcGE4nMMLFZa DLz7lFG5tSeEY1oSudwOrALWuRGbYbU= X-Received: by 2002:adf:9441:: with SMTP id 59-v6mr887241wrq.274.1527755071206; Thu, 31 May 2018 01:24:31 -0700 (PDT) Received: from holly.lan (cpc141214-aztw34-2-0-cust773.18-1.cable.virginm.net. [86.9.19.6]) by smtp.gmail.com with ESMTPSA id h12-v6sm1074248wmc.7.2018.05.31.01.24.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 31 May 2018 01:24:30 -0700 (PDT) Date: Thu, 31 May 2018 09:24:28 +0100 From: Daniel Thompson To: Geert Uytterhoeven Cc: Nick Desaulniers , Arnd Bergmann , Jason Wessel , Randy Dunlap , Baolin Wang , "Eric W. Biederman" , kgdb-bugreport@lists.sourceforge.net, Linux Kernel Mailing List , ebiggers@google.com Subject: Re: [PATCH] kdb: prefer strlcpy to strncpy Message-ID: <20180531082428.c5z7cpdetdrhy5wd@holly.lan> References: <1527573427-16569-1-git-send-email-nick.desaulniers@gmail.com> <20180530143415.ksc6fb4zo6m7xb25@holly.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180512 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 30, 2018 at 10:47:13PM +0200, Geert Uytterhoeven wrote: > H Daniel, > > On Wed, May 30, 2018 at 4:34 PM, Daniel Thompson > wrote: > > On Tue, May 29, 2018 at 07:01:35PM -0700, Nick Desaulniers wrote: > >> On Tue, May 29, 2018 at 12:57 AM, Arnd Bergmann wrote: > >> > On Tue, May 29, 2018 at 7:57 AM, Nick Desaulniers > >> > wrote: > >> >> Fixes stringop-truncation and stringop-overflow warnings from gcc-8. > > >> Eric points out that this will leak kernel memory if size is less than > >> sizeof src. > > > > Don't quite understand what this means (there's no allocation here, how > > can there be a leak?) but the symbol completion certainly won't work if > > we truncate the copy here. > > Not leak an is memory leak, but leak as in information leak of uninitialized > data to userspace (if the buffer is ever copied to userspace). I see... I saw "leak", I saw "memory" and was perhaps too quick to link the two together. The underlying bug is a buffer overflow (so a good catch and I look forward to a v2) but, with or without Nick's change, I can't see a leak in either sense of the word in the code that Arnd was commenting on[1]. Daniel. [1] Clearly the undefined behaviour post-overflow *could* be a leak but I stopped analyzing after the overflow.