Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp676208pxk; Wed, 2 Sep 2020 11:47:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvFXn1xpYbAL9VtyGI3MQT+guNaCPrfTjAwsS6s68daztMI5CTwCeVWecHk0mdFD1d/vk1 X-Received: by 2002:a17:906:1d08:: with SMTP id n8mr1481246ejh.236.1599072462346; Wed, 02 Sep 2020 11:47:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599072462; cv=none; d=google.com; s=arc-20160816; b=xNSwgysSmRdhcbEdFTFdYJprMd30UdyxojCBKxmXzap4jGUqJWSvd6UBT/iOLqOu4t 9Bo6m1kAigjEu7anuF8f11nxVJHOBopMiOjce/OV+aYIyrdZECmHE/+C/tj8sKsvhnG3 GvhB1AuaXG9wQQk/ffJMwXaILMWcM5xFzAQ6b13qHS8OUdxZYia2irxYPSh9f3BBrOM/ UWQpf+d9mV5XjGzAg5mXaHLgjoMJCiBCe9qofi0arsP3xYOKROWfssPyL8JCCmv5nnRD y2tWCmNAI5q6VNkJT1FJhBkkTsGy4ZE3RnY1ZXf6Fr8GxU40VOk1FrZKTG0GXDjhLBLs bHiw== 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=KxXqTyf3tVsTPfe47pSnvKPx7s/mlU5LH54HM+zOSuA=; b=KBHHQtwDiT5WW69zDDZzznrxm+QYB/P5dlLLqwBt4P7JB6Q7odGGVgeL4iN6enmwRn hVSwL82EwvCjCf160UVflaDKl41WhXQPWffcXnfnGL5pHenV7jslaRKhNHf+a9dWT/Ik pCpPxnH2k4WFB0smIl0PH0KcVEVOohCkKBWDXA/c52I1EaPPtkU8YAg1VwLljSpo8rLy nLUIOS8yJ4cRiYiQMABuKSyDOpbItsbLUStzWUPXHXXOEZA2aSfsGjaYTP7n53IdVFAf UnJG27JcnmM//cSTFWATvcrOCS/pcYYzvq5EoyQ1ySLQq+dm2nS+O9i/nUQeZuk4K9sX zxgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0t8EmjCo; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j12si268530ejy.198.2020.09.02.11.47.19; Wed, 02 Sep 2020 11:47: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=@kernel.org header.s=default header.b=0t8EmjCo; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727968AbgIBSoy (ORCPT + 99 others); Wed, 2 Sep 2020 14:44:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:49310 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727894AbgIBSox (ORCPT ); Wed, 2 Sep 2020 14:44:53 -0400 Received: from localhost (unknown [213.57.247.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BE8722083B; Wed, 2 Sep 2020 18:44:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599072293; bh=JGk7LSAU5LH/dw5N8RtShtpaM2nsX5tomgXsw1xzhz8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=0t8EmjCocLj/y/w/pyEuLpfdjthKFB5AmS4vj6xjX92yI7Sxg7Rc7ujVrjwx7hVBb Mt2UlXTqg3x5ffhTDTf4lbEvOYYGwp3rg/CqW8CKucZqobgAIh21xxtKaQ7sjJvAal c8UgCHHDkVsW6cmEnrv+e/y5IJTcteHaRhEZqujU= Date: Wed, 2 Sep 2020 21:44:49 +0300 From: Leon Romanovsky To: Linus Torvalds Cc: Peter Oberparleiter , Linux Kernel Mailing List , Colin Ian King , Andrew Morton Subject: Re: [PATCH rdma-next 1/4] gcov: Open-code kmemdup() to work correctly with kernel and user space pointers Message-ID: <20200902184449.GN59010@unreal> References: <20200902085513.748149-1-leon@kernel.org> <20200902085513.748149-2-leon@kernel.org> <20200902174600.GK59010@unreal> 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 Wed, Sep 02, 2020 at 11:27:14AM -0700, Linus Torvalds wrote: > On Wed, Sep 2, 2020 at 10:46 AM Leon Romanovsky wrote: > > > > Definitely my explanation is wrong, but it was my interpretation of > > "BUG: KASAN: global-out-of-bounds in kmemdup+0x43/0x70" line. I saw > > that the failure was in memcpy() inside of kmemdup(), so I changed > > from memcpy to be copy_from_user() and it solved the KASAN warning. > > But the actual patch attached to that explanation *doesn't* use > copy_from_user(). > > So your "changed from memcpy to be copy_from_user() solved the KASAN > warning" explanation makes even less sense. Because that's not at all > what the patch does. I already don't remember why, but copy_from_user() caused to second flow of gcov_info_dup() through gcov_event() to generate another set of warnings. As a summary, I have a workaround, but I don't know why it works and not proud about it. Thanks > > Linus