From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754740AbcITOTF (ORCPT ); Tue, 20 Sep 2016 10:19:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39122 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751540AbcITOTE (ORCPT ); Tue, 20 Sep 2016 10:19:04 -0400 Date: Tue, 20 Sep 2016 09:19:03 -0500 From: Josh Poimboeuf To: Kees Cook Cc: Alexander Viro , Linus Torvalds , linux-kernel@vger.kernel.org Subject: Re: [INFO] ratio of const vs dynamic usercopy Message-ID: <20160920141902.qgz7efgdzanpqsys@treble> References: <20160920045839.GA139098@beast> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20160920045839.GA139098@beast> User-Agent: Mutt/1.6.0.1 (2016-04-01) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 20 Sep 2016 14:19:04 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 19, 2016 at 09:58:39PM -0700, Kees Cook wrote: > Hi, > > Al had asked me a couple weeks back what the ratio of const vs dynamic > usercopying was. With Josh's cleanup and my fix-up to only call the > hardened usercopy when non-const, I can actually gather these statistics > on a build. It's a bit of a hack (see attached patch that should not go > into the tree), but with my not-very-defconfig, it's rougly 2 to 1 const > vs dynamic. However, this doesn't take into account the frequency at > _runtime_, which maybe could be discovered via perf comparing copy*user() > calls to __check_object_size() calls, but I didn't try that. Does someone > have perf setup to check this? Maybe do something like this with your patch? trace-cmd record -p function -l __check_object_size -l __skip_check_object_size [command you want to benchmark] trace-cmd report -- Josh