All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Andrew Murray <andrew.murray@arm.com>
Cc: smatch@vger.kernel.org
Subject: Re: Detecting user data on base types
Date: Thu, 6 Jun 2019 12:40:04 +0300	[thread overview]
Message-ID: <20190606094004.GX24680@kadam> (raw)
In-Reply-To: <20190605082926.GB23647@e119886-lin.cambridge.arm.com>

On Wed, Jun 05, 2019 at 09:29:26AM +0100, Andrew Murray wrote:
> On Thu, May 30, 2019 at 08:46:42PM +0300, Dan Carpenter wrote:

> > Then I use the smatch_data/db/smdb.py script to figure out the warnings.
> > I should add an option so that it only shows callers which pass user
> > data.  Each call site has a unique caller ID.
> 
> Thanks - I hadn't looked at that script, but looks very useful.
> 
> By the way with the following hunk you can, for a given function, which call sites
> pass user data.
> 
> @@ -614,6 +642,7 @@ elif sys.argv[1] == "call_info":
>      print_caller_info(filename, func)
>  elif sys.argv[1] == "user_data":
>      func = sys.argv[2]
> +    filename = sys.argv[3]
>      print_caller_info(filename, func, "USER_DATA")
>  elif sys.argv[1] == "param_value":
>      func = sys.argv[2]
> 

Could you send me a normal patch with a Signed-off-by and I will apply
it?  Otherwise I can handle it if you want.


> The database doesn't know that when do_mlock calls apply_vma_lock_flags the first argument of
> apply_vma_lock_flags is the first argument of do_mlock. There is no data source associated and
> our tracing of params stops early. Do you have any clue why this may be?

It's because the start variable gets modified in do_mlock():

mm/mlock.c
   671  static __must_check int do_mlock(unsigned long start, size_t len, vm_flags_t flags)
                                         ^^^^^^^^^^^^^^^^^^^

   672  {
   673          unsigned long locked;
   674          unsigned long lock_limit;
   675          int error = -ENOMEM;
   676  
   677          if (!can_do_mlock())
   678                  return -EPERM;
   679  
   680          len = PAGE_ALIGN(len + (offset_in_page(start)));
   681          start &= PAGE_MASK;
                ^^^^^^^^^^^^^^^^^^
Modified here.

I could change this behavior if you wanted.  I'd record the source and
add an "[m]" or something to say that it had been modified in that
function...  I'm tempted to change the "p 0" to "$0" but I would leave
the "r function" format the same for now.

regards,
dan carpenter

  parent reply	other threads:[~2019-06-06  9:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-29 18:47 Detecting user data on base types Andrew Murray
2019-05-29 19:49 ` Dan Carpenter
2019-05-30  9:03   ` Andrew Murray
2019-05-30 17:46     ` Dan Carpenter
2019-06-05  8:29       ` Andrew Murray
2019-06-05 11:47         ` Andrew Murray
2019-06-05 12:28           ` Andrew Murray
2019-06-06 10:15             ` Dan Carpenter
2019-06-13 10:41               ` Andrew Murray
2019-06-06  9:40         ` Dan Carpenter [this message]
2019-06-13  9:15           ` Andrew Murray
2019-06-06 14:39         ` Dan Carpenter
2019-06-13 10:40           ` Andrew Murray

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190606094004.GX24680@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=andrew.murray@arm.com \
    --cc=smatch@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.