Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1556210

Re: [Cocci] [RFC] coccicheck: add a test for repeat memory fetches

From Vaishali Thakkar <vaishali.thakkar@oracle.com>
Newsgroups linux.kernel
Subject Re: [Cocci] [RFC] coccicheck: add a test for repeat memory fetches
Date 2017-01-11 06:30 +0100
Message-ID <sYjDX-2Is-7@gated-at.bofh.it> (permalink)
References (2 earlier) <sYahk-5iL-15@gated-at.bofh.it> <sYar0-5m6-29@gated-at.bofh.it> <sYaU1-5Ln-1@gated-at.bofh.it> <sYbZL-6ng-15@gated-at.bofh.it> <sYeEh-88l-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wednesday 11 January 2017 05:34 AM, Kees Cook wrote:
> On Tue, Jan 10, 2017 at 1:14 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
>> OK, I have the impression that what you are looking for is the following,
>> that currently does not seem to work well. Still maybe it gives an idea.
>>
>> The basic pattern is the following sequence:
>>
>> 1. copy_from_user
>> 2. test on a field of the copied value
>> 3. another copy_from_user
>> 4. a use of the same field as tested in step 2 from the structure obtained
>> by the second copy_from_user or a function call with the structure as an
>> argument
>
> This looks pretty good!
>
>> In the case where the second copy_from_user stores the result in a
>> pointer, then a return with no reference of the tested field is also a
>> concern, unless, the pointer was already kfreed.
>
> I think sequence "2" above missing just looking at a direct value,
> like if instead of a field it was a u32. Also, should binop include
> "=="?
>
> And we need to add back in get_user() too... hmmm

May be having a separate script for get_user would be a good idea. 
get_user needs few more tests than copy_from_user. Also, for the both 
cases we can later add multi-function handling rules. And for the 
get_user, may be combinational usage rule as well.

> -Kees
>

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC] coccicheck: add a test for repeat memory fetches Kees Cook <keescook@chromium.org> - 2017-01-10 00:20 +0100
  Re: [RFC] coccicheck: add a test for repeat memory fetches Julia Lawall <julia.lawall@lip6.fr> - 2017-01-10 07:10 +0100
    Re: [RFC] coccicheck: add a test for repeat memory fetches Pengfei Wang <wpengfeinudt@gmail.com> - 2017-01-10 09:00 +0100
      Re: [RFC] coccicheck: add a test for repeat memory fetches Julia Lawall <julia.lawall@lip6.fr> - 2017-01-10 09:10 +0100
        Re: [RFC] coccicheck: add a test for repeat memory fetches Vaishali Thakkar <vthakkar1994@gmail.com> - 2017-01-10 09:20 +0100
  Re: [RFC] coccicheck: add a test for repeat memory fetches Julia Lawall <julia.lawall@lip6.fr> - 2017-01-10 19:40 +0100
    Re: [RFC] coccicheck: add a test for repeat memory fetches Kees Cook <keescook@chromium.org> - 2017-01-10 20:30 +0100
    Re: [RFC] coccicheck: add a test for repeat memory fetches Kees Cook <keescook@chromium.org> - 2017-01-10 20:30 +0100
      Re: [RFC] coccicheck: add a test for repeat memory fetches Julia Lawall <julia.lawall@lip6.fr> - 2017-01-10 20:40 +0100
        Re: [RFC] coccicheck: add a test for repeat memory fetches Kees Cook <keescook@chromium.org> - 2017-01-10 21:10 +0100
          Re: [RFC] coccicheck: add a test for repeat memory fetches Julia Lawall <julia.lawall@lip6.fr> - 2017-01-10 22:20 +0100
            Re: [RFC] coccicheck: add a test for repeat memory fetches Kees Cook <keescook@chromium.org> - 2017-01-11 01:10 +0100
              Re: [Cocci] [RFC] coccicheck: add a test for repeat memory fetches Vaishali Thakkar <vaishali.thakkar@oracle.com> - 2017-01-11 06:30 +0100
              Re: [RFC] coccicheck: add a test for repeat memory fetches Julia Lawall <julia.lawall@lip6.fr> - 2017-01-11 06:50 +0100

csiph-web