public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Maxim Ostapenko <m.ostapenko@partner.samsung.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
	Kostya Serebryany <kcc@google.com>,
	Dmitry Vyukov <dvyukov@google.com>,
	Marek Polacek <polacek@redhat.com>,
	Yury Gribov <y.gribov@samsung.com>,
	Slava Garbuzov <v.garbuzov@samsung.com>,
	Vyacheslav Barinov <v.barinov@samsung.com>
Subject: Re: [PATCH 7/7] Libsanitizer merge from upstream r249633.
Date: Wed, 14 Oct 2015 10:52:00 -0000	[thread overview]
Message-ID: <561E33C0.7030109@partner.samsung.com> (raw)
In-Reply-To: <20151014074825.GT478@tucnak.redhat.com>

On 14/10/15 10:48, Jakub Jelinek wrote:
> On Tue, Oct 13, 2015 at 02:22:36PM +0300, Maxim Ostapenko wrote:
>> This is the final patch. Force libsanitizer to use an old ABI for ubsan
>> float cast data descriptors, because for some exprs (e.g. that type of
>> tcc_declaration) we can't get the right location for now. I'm not sure about
>> this, perhaps it should be fixed in GCC somehow.
> I don't like this (neither the heuristics on the libubsan, it wouldn't be a
> big deal to add a new library entrypoint).
> If because of the heuristics you need to ensure that the SourceLocation is
> always known, then either you check in ubsan.c whether expand_location
> gives you NULL xloc.file and in that case use old style float cast overflow
> (without location) - i.e. pass 0, NULL, otherwise you use new style, i.e.
> pass 1, &loc.  Or arrange through some special option to emit something like
> { "<unknown>", 0, 0 } instead of { NULL, 0, 0 } for the float cast case.
> And, regardless of this, any progress in making sure we have fewer cases
> with UNKNOWN_LOCATION on this will not hurt.  I think at this point I'd
> prefer the first choice, i.e. using old style for locations without
> filename, and new style otherwise.
>
>> 2015-10-13  Maxim Ostapenko  <m.ostapenko@partner.samsung.com>
>>
>> 	* ubsan/ubsan_handlers.cc (looksLikeFloatCastOverflowDataV1): Always
>> 	return true for now.
>>
>> Index: libsanitizer/ubsan/ubsan_handlers.cc
>> ===================================================================
>> --- libsanitizer/ubsan/ubsan_handlers.cc	(revision 250059)
>> +++ libsanitizer/ubsan/ubsan_handlers.cc	(working copy)
>> @@ -307,6 +307,9 @@
>>   }
>>   
>>   static bool looksLikeFloatCastOverflowDataV1(void *Data) {
>> +  // (TODO): propagate SourceLocation into DataDescriptor and use this
>> +  // heuristic than.
>> +  return true;
>>     // First field is either a pointer to filename or a pointer to a
>>     // TypeDescriptor.
>>     u8 *FilenameOrTypeDescriptor;
>
> 	Jakub
>

Ok, got it. The first solution would require changes in libsanitizer 
because heuristic doesn't work for GCC, so perhaps new UBSan entry point 
should go upstream, right? Or this may be implemented as local patch for 
GCC?

BTW, I actually saw UNKNOWN_LOCATION for this expr:

volatile double var;  // this is tcc_decaration, so we have 
UNKNOWN_LOCATION for it.

I wonder if we need emit __ubsan_handle_float_cast_overflow here at all.

  reply	other threads:[~2015-10-14 10:52 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-13 11:14 [PATCH 0/7] " Maxim Ostapenko
2015-10-13 11:16 ` [PATCH 2/7] " Maxim Ostapenko
2015-10-14  7:30   ` Jakub Jelinek
2015-10-15 10:34     ` Maxim Ostapenko
2015-10-19  7:28       ` Jakub Jelinek
2015-10-14  7:49   ` Yury Gribov
2015-10-13 11:18 ` [PATCH 4/7] " Maxim Ostapenko
2015-10-14  7:31   ` Jakub Jelinek
2015-10-13 11:18 ` [PATCH 3/7] " Maxim Ostapenko
2015-10-14  7:31   ` Jakub Jelinek
2015-10-13 11:20 ` [PATCH 5/7] " Maxim Ostapenko
2015-10-14  7:37   ` Jakub Jelinek
2015-10-14 16:23     ` Maxim Ostapenko
2015-10-13 11:21 ` [PATCH 6/7] " Maxim Ostapenko
2015-10-14  7:38   ` Jakub Jelinek
2015-10-13 11:22 ` [PATCH 7/7] " Maxim Ostapenko
2015-10-14  7:48   ` Jakub Jelinek
2015-10-14 10:52     ` Maxim Ostapenko [this message]
2015-10-14 11:06       ` Jakub Jelinek
2015-10-14 12:02         ` Maxim Ostapenko
2015-10-14 12:12           ` Jakub Jelinek
2015-10-16 11:34             ` Maxim Ostapenko
2015-10-19  7:22               ` Jakub Jelinek
     [not found] ` <561CE7BA.5070805@partner.samsung.com>
2015-10-13 16:54   ` [PATCH 1/7] " Maxim Ostapenko
2015-10-14  7:54     ` Jakub Jelinek
2015-10-14  9:34       ` Maxim Ostapenko
2015-10-14  9:46         ` Yury Gribov
2015-10-14 16:25         ` Maxim Ostapenko
2015-10-14 18:03       ` Adhemerval Zanella
2015-10-14 18:22         ` Evgenii Stepanov
2015-10-14 18:38           ` Renato Golin
2015-10-14 19:00             ` Andrew Pinski
2015-10-14 19:15               ` Renato Golin
2015-10-14 19:17                 ` Andrew Pinski
2015-10-15  7:55                   ` Ramana Radhakrishnan
2015-10-15  7:29                 ` Yury Gribov
2015-10-15  8:42                   ` Renato Golin
2015-10-15  9:21                     ` pinskia
2015-10-15  9:44                       ` Renato Golin
2015-10-16 13:50             ` Renato Golin
2015-10-16 14:06               ` Maxim Ostapenko
2015-10-16 14:12                 ` Renato Golin
2015-10-13 17:03 ` [PATCH 0/7] " Andrew Pinski

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=561E33C0.7030109@partner.samsung.com \
    --to=m.ostapenko@partner.samsung.com \
    --cc=dvyukov@google.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=kcc@google.com \
    --cc=polacek@redhat.com \
    --cc=v.barinov@samsung.com \
    --cc=v.garbuzov@samsung.com \
    --cc=y.gribov@samsung.com \
    /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).