Powered by Linux
Re: [RFC PATCH 3/7] arm64: add check for comparison against tagged address — Semantic Matching Tool

Re: [RFC PATCH 3/7] arm64: add check for comparison against tagged address

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 05, 2019 at 05:28:42PM +0300, Dan Carpenter wrote:
> On Thu, Dec 05, 2019 at 04:27:03PM +0300, Dan Carpenter wrote:
> > > We hardcode symbols of interest that we consider to be untagged addresses. This
> > > provides good coverage but isn't very flexible. A better approach would be to
> > > annotate the kernel with address space tags, such as is the case for __user,
> > > __percpu, etc. Thus variables, struct members and function parameters could be
> > > annotated to indicate that they contain untagged addresses. Unfortunately:
> > > 
> > >  - At present it's not possible to determine a struct member's address space
> > >    from Smatch
> > 
> > I'm not sure how to get the address space for anything not just struct
> > members.  :(  I will investigate.
> 
> I was using the wrong attribute in my testing.  In the kernel __user is
> 
> #define __user         __attribute__((noderef, address_space(1)))
> 
> Just get_type() should work:
> 
>         arg = get_argument_from_call_expr(expr->args, 0);
>         if (!arg)
>                 return;
>         type = get_type(arg);
>         if (!type || !type->ctype.as)
>                 return;
>         sm_msg("%s: expr = '%s' address space = %s", __func__, expr_to_str(expr), type->ctype.as->name);

Ideally, this should use show_as() to display the address space.

-- Luc



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux