Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2447208imm; Sat, 16 Jun 2018 19:01:55 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKhEKz1osyIg6sADExGBk6Ozzyl+DXMlux+Sgnwmg5mNQkbUmqitdUnD5w6lG8O/rcLApWq X-Received: by 2002:a17:902:1007:: with SMTP id b7-v6mr8407073pla.88.1529200915019; Sat, 16 Jun 2018 19:01:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529200914; cv=none; d=google.com; s=arc-20160816; b=Zz8MiP60zDD0EcB22kPdIMZ/71pnSCSTiZD1anO4vp24Pzdjur2ZjQjICY6hGYhdoZ 45u49sq1APT4QRL7hGqSwe5egICh6/Shwb5IisNgFudnD3jjYY3tfGrt0BCCDNqmwyqf epR5echbokELlKtiVoep4k1JnH2xK/qOyd0Tar+iFXRl68yi1fhNLlQkZ/OwnRVgjU6/ Mq1HPYY3oMKa1pFiysrwmVBkSA2DfsN243wnjIYSv1fIQZ7UIqgZ/Q1RufUg+G1CqhNU BnADOSotrowdgLIuPxlQxwDj2J0Uq6AQ6fbZDhtVwLIV/88WI+3n6L0qqzSeSSdzywtG b62w== 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=nEu/iSteNkAMtQpngBIONZNFiPmqdnQM7MosSEs/KsA=; b=akqbUkC0zD94TAXpelwU2mah7uubcsdSX3M+7IhKG2iwZPAHa0feKAeVXgFzgCgdj3 3+hnvF2Clnyil+xdMsQoel7V9RW8JmXG9Zzqzg3XetxF3gTa/8YrGccxLk2u5HT6XwkD 7fzI9KVR/8EMm26DDbGuppuu2yjQ5Rk2QoR6n57/27LbOrYa+NNx+3ccWyKgiZd3zyB/ dVRpvvGtrh2ly7YiVfdP9ihorMDeiM+BkaSh86sPv9eC5eQF/RDBphsxAsHQJXqWrBHK FxNX0jHolXdqFefGszcFjKa7CfSqGV4xN8Fo8BiMP71Gec/ynEbZPqHhrvFkUmGyAs5k U09w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=kODSpXqa; 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 k23-v6si10646528pfi.177.2018.06.16.19.01.39; Sat, 16 Jun 2018 19:01:54 -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=kODSpXqa; 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 S933897AbeFQCBF (ORCPT + 99 others); Sat, 16 Jun 2018 22:01:05 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:58672 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933351AbeFQCA6 (ORCPT ); Sat, 16 Jun 2018 22:00:58 -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=nEu/iSteNkAMtQpngBIONZNFiPmqdnQM7MosSEs/KsA=; b=kODSpXqayiCTcEDvEYp/du24p sHIETX/XLFNJ2x1FtUmzvI+5AhfyICUN1P1iIrKcZZq4YS2bTVrtulRcevE++kOxNSgE9liMK3r6y B9W1fyERkDG3EG57hLYrOLC9W9mM/T7XuEPCz5XHayZU28oZAyZy7s45OyHux0Y21ru2/DpO/Jhnr g88/XZN1qYipFNG/U74ZdF/zfrUkcn4xC3+So1vXqrCuTT1sbApIxqGcXNvJG+Ue1lPgZGfVkkbGy kWfqitaQrO3YxVqhDCbghShp5VcdY/qCIG3Cux4b4pP7GOw9uWh5m4qlogtT4/tkCou/hCmpF0b8C J05KHhR/Q==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fUMzu-0001Ff-PB; Sun, 17 Jun 2018 02:00:54 +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 v14 02/74] radix tree test suite: Enable ubsan Date: Sat, 16 Jun 2018 18:59:40 -0700 Message-Id: <20180617020052.4759-3-willy@infradead.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180617020052.4759-1-willy@infradead.org> References: <20180617020052.4759-1-willy@infradead.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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