From patchwork Mon Jun 11 14:05:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 10457849 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 65DC060467 for ; Mon, 11 Jun 2018 14:06:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 565A928451 for ; Mon, 11 Jun 2018 14:06:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4AFEA2846F; Mon, 11 Jun 2018 14:06:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E897528451 for ; Mon, 11 Jun 2018 14:06:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AB3316B0269; Mon, 11 Jun 2018 10:06:46 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 948006B0010; Mon, 11 Jun 2018 10:06:46 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 54D6F6B0005; Mon, 11 Jun 2018 10:06:46 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl0-f69.google.com (mail-pl0-f69.google.com [209.85.160.69]) by kanga.kvack.org (Postfix) with ESMTP id CFD8E6B0008 for ; Mon, 11 Jun 2018 10:06:45 -0400 (EDT) Received: by mail-pl0-f69.google.com with SMTP id bf1-v6so12217528plb.2 for ; Mon, 11 Jun 2018 07:06:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references; bh=X1L/lNU3X/ge1Nfw3qLsCs8ltR97g23r4GAfLRjj7Uc=; b=Lgwtrgtmncgz/qvaz4k6Ce6NBe1lgdn3M1FXRWcPUTKfDmA9ZdaDezQ5rgfwnk0eVJ QzWtPGgoZhnMr1Sp/eMZ4dcVe5hU2/bOMJWXDUWth43v7jC6stTLiROMYT+hVNNwh12F 20ThF4gb6zo+Wbq3O5PC3wKzIwtDGlWxtWD3hPVRYdkUZnfVyzV0KUWtO7mHiatENCWk VlQKTTsyhH0z5dRtksyvaZvB0McJU9Etb1smheXca+0HDPNYyKNevUrC6AYiz3FWzBzx NipKTJUd1FWe1hpk4oe8uFWvX2cC5ONxqqPWxRWQDGLInTvhvxKTVZPnau6mdZO5YokD E/AQ== X-Gm-Message-State: APt69E2KLnib6hrXFOIVIAFj+O118lnzBgNZ3xcEVUUTS79OM63VEBcT MyPoXVB7u2WBRavVixxnH4jZX7D7XyXKE9mRVPxMZkcKfvKGkNeGD91Jy5yCbzuJIKRWn8lVkXw XbN4aoZtwT97avZ3CyGvtA7xFliTcrBjL2t2aXP6qx9XcIY2H3Rb/76mYl6/rbSbfCg== X-Received: by 2002:a63:7b51:: with SMTP id k17-v6mr14945493pgn.55.1528726005509; Mon, 11 Jun 2018 07:06:45 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIuJPNetFFALp2t6TXh3dsjmcuRd4BYQ98gqiYH8PvIQwjgnmAFSL+g/wzJf2oOFcO1+IzO X-Received: by 2002:a63:7b51:: with SMTP id k17-v6mr14945410pgn.55.1528726004026; Mon, 11 Jun 2018 07:06:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528726003; cv=none; d=google.com; s=arc-20160816; b=n6zuyZFqEjdXBaWeUbLSaBmfvFQo023kgc586be3owaqGQ1jU3Nu7Va/0wzvSfiv9P xDXkhN4HhAWmPreyeWelWJqKtnTpl0uqtk5OqKGynzdmf1gnBENC3e4XQuaIut1nyUov CPV1Ni1EbogAG118W8wSfU7rV3E978COh9wSBJzHwXreTqL4/mpQsHOVenW1jHw8gc2w 0USQYHdORMtHTO56BXGdKW0shtp6RQb5fnpIso9Z7wwXid8ljxocrG7Zb+I5pAl/4nO6 jL7NISfUYbeGBF2OE4qmYlv0FSELKJHUCPdVsJwwjQoFJv5Ti95JkyHYoOEOVItYd4Ky eY4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=X1L/lNU3X/ge1Nfw3qLsCs8ltR97g23r4GAfLRjj7Uc=; b=lnyK7/0AK+I1L9V/3Jt2am8H5im26LzHp397xxKuxkXXgljweM78o8OjJ7PWSTEkuV n0jWresHhBgfhoq9eEa5RGFEgP7wBZndAI8cjbB8UHmNChxhLQIqFLEudx5kkkU4fzDG cJX2u7D6svL9/ZL5un9F3fcnUbSZaI+zTZjVXGWUrFaso2ZbT7BxBzYa16UkyxGSWfYx nNo/hSWuAiVWm2HJi3HGnHdiwiJ6oKast/GPUZRUKx7DTHU6cguls8awWPz6RUY4gR+4 vnzpCYJsbMgLWc9lxn/zeDJDBtnmKRf3tf1D1KkcgV2K2uxcIccmaYkxVZWuDAN28ND0 cl3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=i9+vRjZA; spf=pass (google.com: best guess record for domain of willy@infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=willy@infradead.org Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id l68-v6si21495870pgl.84.2018.06.11.07.06.43 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jun 2018 07:06:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of willy@infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=i9+vRjZA; spf=pass (google.com: best guess record for domain of willy@infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=willy@infradead.org 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> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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)