Re: [INFO] ratio of const vs dynamic usercopy

From: Linus Torvalds
Date: Tue Sep 20 2016 - 21:00:45 EST

On Tue, Sep 20, 2016 at 5:31 PM, Kees Cook <keescook@xxxxxxxxxxxx> wrote:
> trace-cmd seemed to break for me (lost one of the CPU buffers?), so I
> just did this manually:
> # echo __skip_check_object_size > set_ftrace_filter
> # echo __check_object_size >> set_ftrace_filter
> # echo 1 > function_profile_enabled
> ... build the kernel 5 times ...

I suspect other loads will give possibly radically different numbers.

I like the kernel build as a benchmark, but at the same time I have to
admit that it's fairly specific. It tends to do mostly some fairly
simple filesystem stuff.

It would be interesting to see what the most common direct callchains
for the object size check is, though. Maybe there's only one or two
really common cases (the page cache copies for read/write? I dunno)
Maybe if we special-case those, that cuts down on the dynamic cases a

And obviously the reason it would be good to make that size check as
uncommon as possible is that obviously once it's not a very common
case, that makes it much more valid to enable this all by default
and/or make more expensive checks.