[前][次][番号順一覧][スレッド一覧]

ruby-changes:53373

From: shyouhei <ko1@a...>
Date: Wed, 7 Nov 2018 13:09:10 +0900 (JST)
Subject: [ruby-changes:53373] shyouhei:r65589 (trunk): blacklist UBSAN's unsigned integer overflow

shyouhei	2018-11-07 13:09:05 +0900 (Wed, 07 Nov 2018)

  New Revision: 65589

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65589

  Log:
    blacklist UBSAN's unsigned integer overflow
    
    Integer overflow for unsigned types are fully defined in C. They
    are not always problematic (but not always OK).  These functions
    in this changeset intentionally utilizes that behaviour.
    Blacklist from UBSAN checks for better output.
    
    See also: https://travis-ci.org/ruby/ruby/jobs/451624829

  Modified files:
    trunk/random.c
    trunk/siphash.h
    trunk/st.c
Index: random.c
===================================================================
--- random.c	(revision 65588)
+++ random.c	(revision 65589)
@@ -112,6 +112,9 @@ struct MT { https://github.com/ruby/ruby/blob/trunk/random.c#L112
 #define genrand_initialized(mt) ((mt)->next != 0)
 #define uninit_genrand(mt) ((mt)->next = 0)
 
+NO_SANITIZE("unsigned-integer-overflow", static void init_genrand(struct MT *mt, unsigned int s));
+NO_SANITIZE("unsigned-integer-overflow", static void init_by_array(struct MT *mt, const uint32_t init_key[], int key_length));
+
 /* initializes state[N] with a seed */
 static void
 init_genrand(struct MT *mt, unsigned int s)
Index: siphash.h
===================================================================
--- siphash.h	(revision 65588)
+++ siphash.h	(revision 65589)
@@ -43,6 +43,6 @@ int sip_hash_digest_integer(sip_hash *h, https://github.com/ruby/ruby/blob/trunk/siphash.h#L43
 void sip_hash_free(sip_hash *h);
 void sip_hash_dump(sip_hash *h);
 
-uint64_t sip_hash13(const uint8_t key[16], const uint8_t *data, size_t len);
+NO_SANITIZE("unsigned-integer-overflow", uint64_t sip_hash13(const uint8_t key[16], const uint8_t *data, size_t len));
 
 #endif
Index: st.c
===================================================================
--- st.c	(revision 65588)
+++ st.c	(revision 65589)
@@ -1766,6 +1766,10 @@ st_values_check(st_table *tab, st_data_t https://github.com/ruby/ruby/blob/trunk/st.c#L1766
 #define C1 BIG_CONSTANT(0x87c37b91,0x114253d5);
 #define C2 BIG_CONSTANT(0x4cf5ad43,0x2745937f);
 #endif
+NO_SANITIZE("unsigned-integer-overflow", static inline st_index_t murmur_step(st_index_t h, st_index_t k));
+NO_SANITIZE("unsigned-integer-overflow", static inline st_index_t murmur_finish(st_index_t h));
+NO_SANITIZE("unsigned-integer-overflow", extern st_index_t st_hash(const void *ptr, size_t len, st_index_t h));
+
 static inline st_index_t
 murmur_step(st_index_t h, st_index_t k)
 {
@@ -2052,7 +2056,7 @@ st_locale_insensitive_strncasecmp(const https://github.com/ruby/ruby/blob/trunk/st.c#L2056
     return 0;
 }
 
-PUREFUNC(static st_index_t strcasehash(st_data_t));
+NO_SANITIZE("unsigned-integer-overflow", PUREFUNC(static st_index_t strcasehash(st_data_t)));
 static st_index_t
 strcasehash(st_data_t arg)
 {

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]