linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [INFO] ratio of const vs dynamic usercopy
@ 2016-09-20  4:58 Kees Cook
  2016-09-20  5:48 ` kbuild test robot
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Kees Cook @ 2016-09-20  4:58 UTC (permalink / raw)
  To: Alexander Viro; +Cc: Linus Torvalds, Josh Poimboeuf, linux-kernel

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?

$ grep 'warning: call to' build.stderr | wc -l
1505
$ grep 'warning: call to' build.stderr | grep 'const usercopy' | wc -l
998
$ grep 'warning: call to' build.stderr | grep 'dynamic usercopy' | wc -l
507

Signed-off-by: Kees Cook <keescook@chromium.org>
---
 include/linux/thread_info.h | 8 +++++++-
 mm/usercopy.c               | 4 ++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
index 2b5b10eed74f..4cae922797e5 100644
--- a/include/linux/thread_info.h
+++ b/include/linux/thread_info.h
@@ -115,14 +115,20 @@ static inline int arch_within_stack_frames(const void * const stack,
 #endif
 
 #ifdef CONFIG_HARDENED_USERCOPY
-extern void __check_object_size(const void *ptr, unsigned long n,
+extern void __compiletime_warning("dynamic usercopy")
+__check_object_size(const void *ptr, unsigned long n,
 					bool to_user);
 
+extern void __compiletime_warning("builtin-const usercopy")
+__skip_check_object_size(void);
+
 static __always_inline void check_object_size(const void *ptr, unsigned long n,
 					      bool to_user)
 {
 	if (!__builtin_constant_p(n))
 		__check_object_size(ptr, n, to_user);
+	else
+		__skip_check_object_size();
 }
 #else
 static inline void check_object_size(const void *ptr, unsigned long n,
diff --git a/mm/usercopy.c b/mm/usercopy.c
index 089328f2b920..9969a06f5e25 100644
--- a/mm/usercopy.c
+++ b/mm/usercopy.c
@@ -275,3 +275,7 @@ report:
 	report_usercopy(ptr, n, to_user, err);
 }
 EXPORT_SYMBOL(__check_object_size);
+
+void __skip_check_object_size(void)
+{ }
+EXPORT_SYMBOL(__skip_check_object_size);
-- 
2.7.4


-- 
Kees Cook
Nexus Security

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [INFO] ratio of const vs dynamic usercopy
  2016-09-20  4:58 [INFO] ratio of const vs dynamic usercopy Kees Cook
@ 2016-09-20  5:48 ` kbuild test robot
  2016-09-20 23:17   ` Kees Cook
  2016-09-20 14:19 ` Josh Poimboeuf
  2016-09-21  5:36 ` kbuild test robot
  2 siblings, 1 reply; 9+ messages in thread
From: kbuild test robot @ 2016-09-20  5:48 UTC (permalink / raw)
  To: Kees Cook
  Cc: kbuild-all, Alexander Viro, Linus Torvalds, Josh Poimboeuf, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 6300 bytes --]

Hi Kees,

[auto build test WARNING on linus/master]
[also build test WARNING on v4.8-rc7 next-20160919]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
[Suggest to use git(>=2.9.0) format-patch --base=<commit> (or --base=auto for convenience) to record what (public, well-known) commit your patch series was built on]
[Check https://git-scm.com/docs/git-format-patch for more information]

url:    https://github.com/0day-ci/linux/commits/Kees-Cook/ratio-of-const-vs-dynamic-usercopy/20160920-130133
config: i386-randconfig-s0-09191616 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from arch/x86/include/asm/preempt.h:6:0,
                    from include/linux/preempt.h:59,
                    from include/linux/spinlock.h:50,
                    from include/linux/mm_types.h:8,
                    from include/linux/kmemcheck.h:4,
                    from include/linux/skbuff.h:18,
                    from include/linux/if_arp.h:26,
                    from net/ipx/af_ipx.c:33:
   In function 'check_object_size',
       inlined from 'copy_to_user' at arch/x86/include/asm/uaccess.h:742:3,
       inlined from 'ipx_getsockopt' at net/ipx/af_ipx.c:1316:2:
>> include/linux/thread_info.h:129:3: warning: call to '__check_object_size' declared with attribute warning: dynamic usercopy
      __check_object_size(ptr, n, to_user);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   In function 'check_object_size',
       inlined from 'copy_from_user' at arch/x86/include/asm/uaccess.h:722:3,
       inlined from 'ipxitf_ioctl' at net/ipx/af_ipx.c:1129:3,
       inlined from 'ipx_ioctl' at net/ipx/af_ipx.c:1872:6:
>> include/linux/thread_info.h:131:3: warning: call to '__skip_check_object_size' declared with attribute warning: builtin-const usercopy
      __skip_check_object_size();
      ^~~~~~~~~~~~~~~~~~~~~~~~~~
   In function 'check_object_size',
       inlined from 'copy_from_user' at arch/x86/include/asm/uaccess.h:722:3,
       inlined from 'ipxitf_ioctl' at net/ipx/af_ipx.c:1154:3,
       inlined from 'ipx_ioctl' at net/ipx/af_ipx.c:1872:6:
>> include/linux/thread_info.h:131:3: warning: call to '__skip_check_object_size' declared with attribute warning: builtin-const usercopy
      __skip_check_object_size();
      ^~~~~~~~~~~~~~~~~~~~~~~~~~
   In function 'check_object_size',
       inlined from 'copy_to_user' at arch/x86/include/asm/uaccess.h:742:3,
       inlined from 'ipxitf_ioctl' at net/ipx/af_ipx.c:1172:3,
       inlined from 'ipx_ioctl' at net/ipx/af_ipx.c:1872:6:
>> include/linux/thread_info.h:131:3: warning: call to '__skip_check_object_size' declared with attribute warning: builtin-const usercopy
      __skip_check_object_size();
      ^~~~~~~~~~~~~~~~~~~~~~~~~~
   In function 'check_object_size',
       inlined from 'copy_to_user' at arch/x86/include/asm/uaccess.h:742:3,
       inlined from 'ipxcfg_get_config_data' at net/ipx/af_ipx.c:105:9,
       inlined from 'ipx_ioctl' at net/ipx/af_ipx.c:1875:6:
>> include/linux/thread_info.h:131:3: warning: call to '__skip_check_object_size' declared with attribute warning: builtin-const usercopy
      __skip_check_object_size();
      ^~~~~~~~~~~~~~~~~~~~~~~~~~
--
   In file included from arch/x86/include/asm/preempt.h:6:0,
                    from include/linux/preempt.h:59,
                    from include/linux/spinlock.h:50,
                    from include/linux/mmzone.h:7,
                    from include/linux/gfp.h:5,
                    from include/linux/slab.h:14,
                    from net/ipx/ipx_route.c:12:
   In function 'check_object_size',
       inlined from 'copy_from_user' at arch/x86/include/asm/uaccess.h:722:3,
       inlined from 'ipxrtr_ioctl' at net/ipx/ipx_route.c:264:2:
>> include/linux/thread_info.h:131:3: warning: call to '__skip_check_object_size' declared with attribute warning: builtin-const usercopy
      __skip_check_object_size();
      ^~~~~~~~~~~~~~~~~~~~~~~~~~
--
   In file included from arch/x86/include/asm/preempt.h:6:0,
                    from include/linux/preempt.h:59,
                    from include/linux/spinlock.h:50,
                    from include/linux/seqlock.h:35,
                    from include/linux/time.h:5,
                    from include/uapi/linux/timex.h:56,
                    from include/linux/timex.h:56,
                    from include/linux/sched.h:19,
                    from include/linux/uaccess.h:4,
                    from security/keys/encrypted-keys/encrypted.c:17:
   In function 'check_object_size',
       inlined from 'copy_to_user' at arch/x86/include/asm/uaccess.h:742:3,
       inlined from 'encrypted_read' at security/keys/encrypted-keys/encrypted.c:961:2:
>> include/linux/thread_info.h:129:3: warning: call to '__check_object_size' declared with attribute warning: dynamic usercopy
      __check_object_size(ptr, n, to_user);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +/__check_object_size +129 include/linux/thread_info.h

2c4beea2 Kees Cook 2016-09-19  123  __skip_check_object_size(void);
2c4beea2 Kees Cook 2016-09-19  124  
a85d6b82 Kees Cook 2016-09-07  125  static __always_inline void check_object_size(const void *ptr, unsigned long n,
f5509cc1 Kees Cook 2016-06-07  126  					      bool to_user)
f5509cc1 Kees Cook 2016-06-07  127  {
81409e9e Kees Cook 2016-08-31  128  	if (!__builtin_constant_p(n))
f5509cc1 Kees Cook 2016-06-07 @129  		__check_object_size(ptr, n, to_user);
2c4beea2 Kees Cook 2016-09-19  130  	else
2c4beea2 Kees Cook 2016-09-19 @131  		__skip_check_object_size();
f5509cc1 Kees Cook 2016-06-07  132  }
f5509cc1 Kees Cook 2016-06-07  133  #else
f5509cc1 Kees Cook 2016-06-07  134  static inline void check_object_size(const void *ptr, unsigned long n,

:::::: The code at line 129 was first introduced by commit
:::::: f5509cc18daa7f82bcc553be70df2117c8eedc16 mm: Hardened usercopy

:::::: TO: Kees Cook <keescook@chromium.org>
:::::: CC: Kees Cook <keescook@chromium.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 23624 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [INFO] ratio of const vs dynamic usercopy
  2016-09-20  4:58 [INFO] ratio of const vs dynamic usercopy Kees Cook
  2016-09-20  5:48 ` kbuild test robot
@ 2016-09-20 14:19 ` Josh Poimboeuf
  2016-09-21  0:31   ` Kees Cook
  2016-09-21  5:36 ` kbuild test robot
  2 siblings, 1 reply; 9+ messages in thread
From: Josh Poimboeuf @ 2016-09-20 14:19 UTC (permalink / raw)
  To: Kees Cook; +Cc: Alexander Viro, Linus Torvalds, linux-kernel

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [INFO] ratio of const vs dynamic usercopy
  2016-09-20  5:48 ` kbuild test robot
@ 2016-09-20 23:17   ` Kees Cook
  2016-09-21  2:31     ` Fengguang Wu
  0 siblings, 1 reply; 9+ messages in thread
From: Kees Cook @ 2016-09-20 23:17 UTC (permalink / raw)
  To: kbuild test robot
  Cc: kbuild-all, Alexander Viro, Linus Torvalds, Josh Poimboeuf, LKML

On Mon, Sep 19, 2016 at 10:48 PM, kbuild test robot <lkp@intel.com> wrote:
> Hi Kees,
>
> [auto build test WARNING on linus/master]
> [also build test WARNING on v4.8-rc7 next-20160919]

Hah, and here I thought if I didn't mark it with "[PATCH]" 0-day would
skip it! ;)

Is there a way to mark "just FYI" patches that go to the list to get
skipped by 0-day?

-Kees

-- 
Kees Cook
Nexus Security

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [INFO] ratio of const vs dynamic usercopy
  2016-09-20 14:19 ` Josh Poimboeuf
@ 2016-09-21  0:31   ` Kees Cook
  2016-09-21  1:00     ` Linus Torvalds
  0 siblings, 1 reply; 9+ messages in thread
From: Kees Cook @ 2016-09-21  0:31 UTC (permalink / raw)
  To: Josh Poimboeuf; +Cc: Alexander Viro, Linus Torvalds, LKML

On Tue, Sep 20, 2016 at 7:19 AM, Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> 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

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 ...

Out of trace_stat/function* I get:

  Function                               Hit    Time            Avg
         s^2
  --------                               ---    ----            ---
         ---
  __check_object_size                7692563    593308.5 us     0.077
us        1104414 us
  __skip_check_object_size           3832439    254356.3 us     0.066
us        205958.2 us
  Function                               Hit    Time            Avg
         s^2
  --------                               ---    ----            ---
         ---
  __check_object_size                7474288    564353.9 us     0.075
us        1282606 us
  __skip_check_object_size           3809103    261658.7 us     0.068
us        192132.0 us
  Function                               Hit    Time            Avg
         s^2
  --------                               ---    ----            ---
         ---
  __check_object_size                7472437    573517.2 us     0.076
us        4566908 us
  __skip_check_object_size           3883037    251919.3 us     0.064
us        3780134 us
  Function                               Hit    Time            Avg
         s^2
  --------                               ---    ----            ---
         ---
  __check_object_size                7882525    581605.9 us     0.073
us        51814941 us
  __skip_check_object_size           4061014    277332.0 us     0.068
us        5237258 us

So, together:

30521813 dynamic calls and 15585593 const calls, or almost exactly 2
to 1 dynamic to const. (And the dynamic calls seem to add 0.00875us
average overhead vs const.)

-Kees

-- 
Kees Cook
Nexus Security

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [INFO] ratio of const vs dynamic usercopy
  2016-09-21  0:31   ` Kees Cook
@ 2016-09-21  1:00     ` Linus Torvalds
  0 siblings, 0 replies; 9+ messages in thread
From: Linus Torvalds @ 2016-09-21  1:00 UTC (permalink / raw)
  To: Kees Cook; +Cc: Josh Poimboeuf, Alexander Viro, LKML

On Tue, Sep 20, 2016 at 5:31 PM, Kees Cook <keescook@chromium.org> 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
lot.

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.

            Linus

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [INFO] ratio of const vs dynamic usercopy
  2016-09-20 23:17   ` Kees Cook
@ 2016-09-21  2:31     ` Fengguang Wu
  2016-09-21  2:41       ` Kees Cook
  0 siblings, 1 reply; 9+ messages in thread
From: Fengguang Wu @ 2016-09-21  2:31 UTC (permalink / raw)
  To: Kees Cook
  Cc: kbuild-all, Alexander Viro, Linus Torvalds, Josh Poimboeuf, LKML

Hi Kees,

On Tue, Sep 20, 2016 at 04:17:36PM -0700, Kees Cook wrote:
>On Mon, Sep 19, 2016 at 10:48 PM, kbuild test robot <lkp@intel.com> wrote:
>> Hi Kees,
>>
>> [auto build test WARNING on linus/master]
>> [also build test WARNING on v4.8-rc7 next-20160919]
>
>Hah, and here I thought if I didn't mark it with "[PATCH]" 0-day would
>skip it! ;)
>
>Is there a way to mark "just FYI" patches that go to the list to get
>skipped by 0-day?

The 0-day bot will auto skip emailed patches without "Signed-off-by: ". 
Will that be enough? I can also add the "[PATCH...]" detect.

Thanks,
Fengguang

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [INFO] ratio of const vs dynamic usercopy
  2016-09-21  2:31     ` Fengguang Wu
@ 2016-09-21  2:41       ` Kees Cook
  0 siblings, 0 replies; 9+ messages in thread
From: Kees Cook @ 2016-09-21  2:41 UTC (permalink / raw)
  To: Fengguang Wu
  Cc: kbuild-all, Alexander Viro, Linus Torvalds, Josh Poimboeuf, LKML

On Tue, Sep 20, 2016 at 7:31 PM, Fengguang Wu <lkp@intel.com> wrote:
> Hi Kees,
>
> On Tue, Sep 20, 2016 at 04:17:36PM -0700, Kees Cook wrote:
>>
>> On Mon, Sep 19, 2016 at 10:48 PM, kbuild test robot <lkp@intel.com> wrote:
>>>
>>> Hi Kees,
>>>
>>> [auto build test WARNING on linus/master]
>>> [also build test WARNING on v4.8-rc7 next-20160919]
>>
>>
>> Hah, and here I thought if I didn't mark it with "[PATCH]" 0-day would
>> skip it! ;)
>>
>> Is there a way to mark "just FYI" patches that go to the list to get
>> skipped by 0-day?
>
>
> The 0-day bot will auto skip emailed patches without "Signed-off-by: ". Will
> that be enough? I can also add the "[PATCH...]" detect.

Ah, perfect, I'll just leave out my S-o-B next time. Thanks!

-Kees

-- 
Kees Cook
Nexus Security

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [INFO] ratio of const vs dynamic usercopy
  2016-09-20  4:58 [INFO] ratio of const vs dynamic usercopy Kees Cook
  2016-09-20  5:48 ` kbuild test robot
  2016-09-20 14:19 ` Josh Poimboeuf
@ 2016-09-21  5:36 ` kbuild test robot
  2 siblings, 0 replies; 9+ messages in thread
From: kbuild test robot @ 2016-09-21  5:36 UTC (permalink / raw)
  To: Kees Cook
  Cc: kbuild-all, Alexander Viro, Linus Torvalds, Josh Poimboeuf, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 7440 bytes --]

Hi Kees,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.8-rc7 next-20160920]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
[Suggest to use git(>=2.9.0) format-patch --base=<commit> (or --base=auto for convenience) to record what (public, well-known) commit your patch series was built on]
[Check https://git-scm.com/docs/git-format-patch for more information]

url:    https://github.com/0day-ci/linux/commits/Kees-Cook/ratio-of-const-vs-dynamic-usercopy/20160920-130133
config: x86_64-randconfig-s2-09211158 (attached as .config)
compiler: gcc-4.4 (Debian 4.4.7-8) 4.4.7
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   cc1: warnings being treated as errors
   In file included from arch/x86/include/asm/preempt.h:6,
                    from include/linux/preempt.h:59,
                    from include/linux/spinlock.h:50,
                    from include/linux/seqlock.h:35,
                    from include/linux/time.h:5,
                    from include/linux/stat.h:18,
                    from include/linux/compat.h:12,
                    from drivers/gpu/drm/i915/i915_ioc32.c:32:
   In function 'copy_from_user',
       inlined from 'compat_i915_getparam' at drivers/gpu/drm/i915/i915_ioc32.c:54:
>> include/linux/thread_info.h:131: error: call to '__skip_check_object_size' declared with attribute warning: builtin-const usercopy
--
   cc1: warnings being treated as errors
   In file included from arch/x86/include/asm/preempt.h:6,
                    from include/linux/preempt.h:59,
                    from include/linux/spinlock.h:50,
                    from include/linux/wait.h:8,
                    from include/linux/fs.h:5,
                    from include/linux/seq_file.h:10,
                    from drivers/gpu/drm/i915/i915_debugfs.c:29:
   include/linux/thread_info.h: In function 'wm_latency_write':
>> include/linux/thread_info.h:129: error: call to '__check_object_size' declared with attribute warning: dynamic usercopy
   In function 'copy_to_user',
       inlined from 'i915_pipe_crc_read' at drivers/gpu/drm/i915/i915_debugfs.c:3641:
>> include/linux/thread_info.h:131: error: call to '__skip_check_object_size' declared with attribute warning: builtin-const usercopy
   include/linux/thread_info.h: In function 'display_crc_ctl_write':
>> include/linux/thread_info.h:129: error: call to '__check_object_size' declared with attribute warning: dynamic usercopy
   include/linux/thread_info.h: In function 'i915_displayport_test_active_write':
>> include/linux/thread_info.h:129: error: call to '__check_object_size' declared with attribute warning: dynamic usercopy
--
   cc1: warnings being treated as errors
   In file included from arch/x86/include/asm/preempt.h:6,
                    from include/linux/preempt.h:59,
                    from include/linux/spinlock.h:50,
                    from include/linux/rcupdate.h:38,
                    from include/linux/idr.h:18,
                    from include/linux/kernfs.h:14,
                    from include/linux/sysfs.h:15,
                    from include/linux/kobject.h:21,
                    from include/linux/cdev.h:4,
                    from include/drm/drmP.h:36,
                    from drivers/gpu/drm/i915/i915_gem_execbuffer.c:29:
   include/linux/thread_info.h: In function 'i915_gem_execbuffer_relocate_vma':
>> include/linux/thread_info.h:129: error: call to '__check_object_size' declared with attribute warning: dynamic usercopy
   In function 'copy_from_user',
       inlined from 'i915_gem_execbuffer_relocate_slow' at drivers/gpu/drm/i915/i915_gem_execbuffer.c:872:
>> include/linux/thread_info.h:129: error: call to '__check_object_size' declared with attribute warning: dynamic usercopy
   include/linux/thread_info.h: In function 'i915_gem_execbuffer_relocate_slow':
>> include/linux/thread_info.h:131: error: call to '__skip_check_object_size' declared with attribute warning: builtin-const usercopy
   In function 'copy_from_user',
       inlined from 'i915_gem_execbuffer2' at drivers/gpu/drm/i915/i915_gem_execbuffer.c:1776:
>> include/linux/thread_info.h:129: error: call to '__check_object_size' declared with attribute warning: dynamic usercopy
   include/linux/thread_info.h: In function 'i915_gem_execbuffer2':
>> include/linux/thread_info.h:131: error: call to '__skip_check_object_size' declared with attribute warning: builtin-const usercopy
   In function 'copy_from_user',
       inlined from 'i915_gem_execbuffer' at drivers/gpu/drm/i915/i915_gem_execbuffer.c:1688:
>> include/linux/thread_info.h:129: error: call to '__check_object_size' declared with attribute warning: dynamic usercopy
   include/linux/thread_info.h: In function 'i915_gem_execbuffer':
>> include/linux/thread_info.h:131: error: call to '__skip_check_object_size' declared with attribute warning: builtin-const usercopy
--
   cc1: warnings being treated as errors
   In file included from arch/x86/include/asm/preempt.h:6,
                    from include/linux/preempt.h:59,
                    from include/linux/spinlock.h:50,
                    from include/linux/rcupdate.h:38,
                    from include/linux/idr.h:18,
                    from include/linux/kernfs.h:14,
                    from include/linux/sysfs.h:15,
                    from include/linux/kobject.h:21,
                    from include/linux/cdev.h:4,
                    from include/drm/drmP.h:36,
                    from drivers/gpu/drm/i915/i915_gem.c:28:
   include/linux/thread_info.h: In function 'shmem_pread_fast':
>> include/linux/thread_info.h:129: error: call to '__check_object_size' declared with attribute warning: dynamic usercopy
   include/linux/thread_info.h: In function 'shmem_pwrite_slow':
>> include/linux/thread_info.h:129: error: call to '__check_object_size' declared with attribute warning: dynamic usercopy
>> include/linux/thread_info.h:129: error: call to '__check_object_size' declared with attribute warning: dynamic usercopy
   include/linux/thread_info.h: In function 'shmem_pread_slow':
>> include/linux/thread_info.h:129: error: call to '__check_object_size' declared with attribute warning: dynamic usercopy
>> include/linux/thread_info.h:129: error: call to '__check_object_size' declared with attribute warning: dynamic usercopy
   include/linux/thread_info.h: In function 'shmem_pwrite_fast':
>> include/linux/thread_info.h:129: error: call to '__check_object_size' declared with attribute warning: dynamic usercopy
   include/linux/thread_info.h: In function 'i915_gem_phys_pwrite':
>> include/linux/thread_info.h:129: error: call to '__check_object_size' declared with attribute warning: dynamic usercopy

vim +/__skip_check_object_size +131 include/linux/thread_info.h

   123	__skip_check_object_size(void);
   124	
   125	static __always_inline void check_object_size(const void *ptr, unsigned long n,
   126						      bool to_user)
   127	{
   128		if (!__builtin_constant_p(n))
 > 129			__check_object_size(ptr, n, to_user);
   130		else
 > 131			__skip_check_object_size();
   132	}
   133	#else
   134	static inline void check_object_size(const void *ptr, unsigned long n,

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 22606 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-09-21  5:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-20  4:58 [INFO] ratio of const vs dynamic usercopy Kees Cook
2016-09-20  5:48 ` kbuild test robot
2016-09-20 23:17   ` Kees Cook
2016-09-21  2:31     ` Fengguang Wu
2016-09-21  2:41       ` Kees Cook
2016-09-20 14:19 ` Josh Poimboeuf
2016-09-21  0:31   ` Kees Cook
2016-09-21  1:00     ` Linus Torvalds
2016-09-21  5:36 ` kbuild test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).