Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4107842imm; Mon, 11 Jun 2018 07:08:29 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIJXfsxnhtZFMTeuZQegzLrLk4Niq00Abpm/tXMHCvjER0NO0bZMEvZVTgAITXKl4/yigFO X-Received: by 2002:a17:902:543:: with SMTP id 61-v6mr18858161plf.47.1528726109800; Mon, 11 Jun 2018 07:08:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528726109; cv=none; d=google.com; s=arc-20160816; b=LB278GDGfjCh/0d5kjA6FequJnANBZvhDLchyueh+yaOZGzQSTLwg5+uVN07Hy14uv +Aq+DI7yCWfHKYoDFozkJ6eDhjUidP3HxJndUld9+pguAiO771D9MJU4IzoDkBBwF4vi iRcktlF2/X7Ucx2igJ4cflyDI5Cvqhz6nFyihCpAnmBb3FSmbjLylOnwesVBpFz3FZIy T7NUraFjRKs+dR4gNErWlAuWtKRwJf3NjohrO2JjiWjU987V80Fig0ye3ew8BaTjDikR 4HxIMmmSaU9m2SZV6o238EYkrCY/Emya9DX+GqfMQEwQcoN6BUf2hg2L8SykhpqjdM7T TKxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=X1L/lNU3X/ge1Nfw3qLsCs8ltR97g23r4GAfLRjj7Uc=; b=Cm9EjdgQhXjG5R256vthmz6MfVFDC6fcSgralH016PrQahAut2KmrhUOV4gpCcaMOv vrX+fema3KrZ7rUgWnn8PI72ClXKGy8YmIWBxnC8e+KmnWrn5kQfyPSJfKKJyqz43wOs qBylu4HOXpBe87bF8LWLdOdBEz2R5UrRFivQA0Fm2N0cbO3wKUNVt8O0goTMYltPi2/7 /q23d3byYRcCIQcRN6VCr570wV1A+DJCCawpe2+SsaXli9Y22Yz6gMYxSHG6lPt6kRZa /b4JkWg4ARBLEpGLoaLlzA90QBWwFvKGSpJjVEBYmsLTLaPNKl0nHwDC6FdPPp73LVdH QJEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=i9+vRjZA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m2-v6si50900025pgs.349.2018.06.11.07.08.14; Mon, 11 Jun 2018 07:08:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=i9+vRjZA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933483AbeFKOGr (ORCPT + 99 others); Mon, 11 Jun 2018 10:06:47 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:44866 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933223AbeFKOGn (ORCPT ); Mon, 11 Jun 2018 10:06:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=X1L/lNU3X/ge1Nfw3qLsCs8ltR97g23r4GAfLRjj7Uc=; b=i9+vRjZAnFxqSPtOjBtrGY51p 8rDNxb6SrjlvZW0HgswAPhmPaoJpe8tmxyss5lQzSnpCrTxaN6uw4zFGzIrHOC4dN/mPtIIRsoVUX zx230RSsAxMbIW1KKWAtL2UXwE74DPcUY4XdZNiAy5SMIF1j4jnfG3bMJF87DcMz9r5VVSm6bkUJO Neb8EkhttGqUHd+2rpC9upuSosw5ovGWujxmfN85Q2c/MbTKGeGLfKajzxrFo0hUVKLJ3IAfTHMTx u2MwJMaGvjw/vWvJ9EvW4VDKNauBDBki/vVF8SoFBTzuDQTa9xyekrcIjj5KCgDCo9nwzLO/pj1qS 9zIcXX4XQ==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fSNSy-0004Xf-Vd; Mon, 11 Jun 2018 14:06:40 +0000 From: Matthew Wilcox To: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Matthew Wilcox , Jan Kara , Jeff Layton , Lukas Czerner , Ross Zwisler , Christoph Hellwig , Goldwyn Rodrigues , Nicholas Piggin , Ryusuke Konishi , linux-nilfs@vger.kernel.org, Jaegeuk Kim , Chao Yu , linux-f2fs-devel@lists.sourceforge.net Subject: [PATCH v13 01/72] radix tree test suite: Enable ubsan Date: Mon, 11 Jun 2018 07:05:28 -0700 Message-Id: <20180611140639.17215-2-willy@infradead.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180611140639.17215-1-willy@infradead.org> References: <20180611140639.17215-1-willy@infradead.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Matthew Wilcox Add support for the undefined behaviour sanitizer and fix the bugs that ubsan pointed out. Nothing major, and all in the test suite, not the code. Signed-off-by: Matthew Wilcox --- tools/testing/radix-tree/Makefile | 5 +++-- tools/testing/radix-tree/main.c | 20 +++++++++++--------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/tools/testing/radix-tree/Makefile b/tools/testing/radix-tree/Makefile index db66f8a0d4be..da030a65d6d6 100644 --- a/tools/testing/radix-tree/Makefile +++ b/tools/testing/radix-tree/Makefile @@ -1,7 +1,8 @@ # SPDX-License-Identifier: GPL-2.0 -CFLAGS += -I. -I../../include -g -O2 -Wall -D_LGPL_SOURCE -fsanitize=address -LDFLAGS += -fsanitize=address +CFLAGS += -I. -I../../include -g -Og -Wall -D_LGPL_SOURCE -fsanitize=address \ + -fsanitize=undefined +LDFLAGS += -fsanitize=address -fsanitize=undefined LDLIBS+= -lpthread -lurcu TARGETS = main idr-test multiorder CORE_OFILES := radix-tree.o idr.o linux.o test.o find_bit.o diff --git a/tools/testing/radix-tree/main.c b/tools/testing/radix-tree/main.c index 257f3f8aacaa..584a8732f5ce 100644 --- a/tools/testing/radix-tree/main.c +++ b/tools/testing/radix-tree/main.c @@ -27,20 +27,22 @@ void __gang_check(unsigned long middle, long down, long up, int chunk, int hop) item_check_present(&tree, middle + idx); item_check_absent(&tree, middle + up); - item_gang_check_present(&tree, middle - down, - up + down, chunk, hop); - item_full_scan(&tree, middle - down, down + up, chunk); + if (chunk > 0) { + item_gang_check_present(&tree, middle - down, up + down, + chunk, hop); + item_full_scan(&tree, middle - down, down + up, chunk); + } item_kill_tree(&tree); } void gang_check(void) { - __gang_check(1 << 30, 128, 128, 35, 2); - __gang_check(1 << 31, 128, 128, 32, 32); - __gang_check(1 << 31, 128, 128, 32, 100); - __gang_check(1 << 31, 128, 128, 17, 7); - __gang_check(0xffff0000, 0, 65536, 17, 7); - __gang_check(0xfffffffe, 1, 1, 17, 7); + __gang_check(1UL << 30, 128, 128, 35, 2); + __gang_check(1UL << 31, 128, 128, 32, 32); + __gang_check(1UL << 31, 128, 128, 32, 100); + __gang_check(1UL << 31, 128, 128, 17, 7); + __gang_check(0xffff0000UL, 0, 65536, 17, 7); + __gang_check(0xfffffffeUL, 1, 1, 17, 7); } void __big_gang_check(void) -- 2.17.1