From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Andrew Murray <andrew.murray@arm.com>,
Catalin.Marinas@arm.com, smatch@vger.kernel.org
Subject: Re: [RFC PATCH 3/7] arm64: add check for comparison against tagged address
Date: Thu, 5 Dec 2019 18:24:00 +0100 [thread overview]
Message-ID: <20191205172400.5q2a5s44ntgqputo@ltop.local> (raw)
In-Reply-To: <20191205142842.GP1787@kadam>
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
next prev parent reply other threads:[~2019-12-05 17:24 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-07 15:35 [RFC PATCH 0/7] Tagged Pointer Detection Andrew Murray
2019-10-07 15:35 ` [RFC PATCH 1/7] build: Add '-lm' build flag Andrew Murray
2019-10-07 15:35 ` [RFC PATCH 2/7] smdb.py: remove undocumented test command Andrew Murray
2019-10-07 15:35 ` [RFC PATCH 3/7] arm64: add check for comparison against tagged address Andrew Murray
2019-10-07 15:49 ` Andrew Murray
2019-12-04 15:41 ` Andrew Murray
2019-12-05 13:27 ` Dan Carpenter
2019-12-05 14:28 ` Dan Carpenter
2019-12-05 14:35 ` Dan Carpenter
2019-12-05 17:21 ` Luc Van Oostenryck
2019-12-05 17:24 ` Luc Van Oostenryck [this message]
2019-10-07 15:35 ` [RFC PATCH 4/7] smdb.py: add find_tagged and parse_warns_tagged commands Andrew Murray
2019-10-07 15:52 ` Andrew Murray
2019-10-07 15:35 ` [RFC PATCH 5/7] kernel_user_data: track parameter __untagged annotations Andrew Murray
2019-10-07 15:55 ` Andrew Murray
2019-12-05 15:04 ` Dan Carpenter
2019-10-08 8:24 ` Dan Carpenter
2019-10-08 8:41 ` Andrew Murray
2019-10-07 15:35 ` [RFC PATCH 6/7] smdb.py: filter out __untagged from find_tagged results Andrew Murray
2019-10-07 15:35 ` [RFC PATCH 7/7] Documentation: add guide for tagged addresses Andrew Murray
2019-10-08 8:58 ` [RFC PATCH 0/7] Tagged Pointer Detection Dan Carpenter
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=20191205172400.5q2a5s44ntgqputo@ltop.local \
--to=luc.vanoostenryck@gmail.com \
--cc=Catalin.Marinas@arm.com \
--cc=andrew.murray@arm.com \
--cc=dan.carpenter@oracle.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 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 read-only IMAP folder(s) and NNTP newsgroup(s).