Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2256026imm; Thu, 2 Aug 2018 08:36:50 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeLtO5JRjwNqNRLIxre1P3g48Kyn1xSzsLySRvWlnEcS5C880fV0GWM3mIVGi6F0Pq8CqJn X-Received: by 2002:a17:902:1a2:: with SMTP id b31-v6mr2749530plb.279.1533224210132; Thu, 02 Aug 2018 08:36:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533224210; cv=none; d=google.com; s=arc-20160816; b=E+XpArzkGkLDBQGsTz6HaDZVKmrobw6hU3eI9q/Vao5L3ea+wZIabvdBzPWUJFoNX/ RsugpZ049fPjbTzddPn+78nDmnjYzx0XL2h9BD4dxwUx1k6OUSwesw46UoXaYXB2TQ6J A8Ubaih7+bavOnmm0jGPV0STl6IZ1P2vS2fBcxqC3u2b8/GnNbtC4LQPdadIt82385zC 7gpuugCiAcEs00juqYi/2jiFaatZJxO6jxATA2kkbfM/WQZUqEVUJTRbwx3tGBcnOGYX ym3QHZC3ZSs7UjPinXLJfAvCW3VKMXTW4Nd5kEEQ+k6F6JLfOtIcWkDeqkUsycr1dFdV V6JA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:message-id:date:subject:cc:to :from:dkim-signature:arc-authentication-results; bh=T0yFUfWgon6lbcjF6/McGJrJieEFa/DxXIThEVl+RJg=; b=YQnwa+5PyQHl0mHXP5bNXTUFpQVN+AzxgWoYXAgSyfIReZEQY7puRfv64YZDmUylVK EfM4FRI+sKO2YbyNDJZPGx6Q/H1sqd4I8JKUq1mjGPFyhj7Ldr3ArVaHrvluDLX4e82b NHjac3tGacNQqlLL+eUvF0Dh2Qhdm1PjiqfUceWIv9Lo8CzLcnuJUe7eCaX7GTAykpE4 eRRTLiqA+keD64PI/g18vsb8dFmB8htHsZv+qZsnQ6n1Nlbo16haBBPvDdp1iBgUesFK MzzP/3UU9ze/JfSBZNuaPFrZqJCmJm+6dquDrIB0A8xD/4rxZr5c/Kc9+pTTaIPcOYS2 TAVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=WKX8Stp3; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 2-v6si1734366pla.509.2018.08.02.08.36.35; Thu, 02 Aug 2018 08:36:50 -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=pass header.i=@virtuozzo.com header.s=selector1 header.b=WKX8Stp3; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387671AbeHBR0p (ORCPT + 99 others); Thu, 2 Aug 2018 13:26:45 -0400 Received: from mail-eopbgr30110.outbound.protection.outlook.com ([40.107.3.110]:8561 "EHLO EUR03-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387490AbeHBR0p (ORCPT ); Thu, 2 Aug 2018 13:26:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=T0yFUfWgon6lbcjF6/McGJrJieEFa/DxXIThEVl+RJg=; b=WKX8Stp3h1qvQb1A7P8soQFkygUB43m31eE2A1XdnQ41LAtxJX9U8I+ebOxLhwVhl/0+fGZjBrVGxta0yFU97zfFDMxLxlUs8teGGQeYOb5gRmZKzqXJnGqasYmTkcPVmsrV+DZPVWzwHtaK5ABacn3TtFE7Y7z0+OiNskSK9xw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=aryabinin@virtuozzo.com; Received: from i7.sw.ru (185.231.240.5) by AM0PR08MB3250.eurprd08.prod.outlook.com (2603:10a6:208:5e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.14; Thu, 2 Aug 2018 15:32:19 +0000 From: Andrey Ryabinin To: Andrew Morton Cc: linux-kernel@vger.kernel.org, Andrey Ryabinin Subject: [PATCH] lib/ubsan: remove null-pointer checks. Date: Thu, 2 Aug 2018 18:32:09 +0300 Message-Id: <20180802153209.813-1-aryabinin@virtuozzo.com> X-Mailer: git-send-email 2.16.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: VI1PR08CA0130.eurprd08.prod.outlook.com (2603:10a6:800:d4::32) To AM0PR08MB3250.eurprd08.prod.outlook.com (2603:10a6:208:5e::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6257800c-7040-42a7-1408-08d5f88d22e5 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:AM0PR08MB3250; X-Microsoft-Exchange-Diagnostics: 1;AM0PR08MB3250;3:/c8XDmcxMOJ1DYtYFXU6z55/iIg7YCRmPHNn/RrsmoWfWZ3XuKAAXUchI+iyqTIQowosHd72h+h/VP5krfqXEKilpE2fSTaKL9V+vs9oDd/pqFrVbvO3wBVgQszZj/DB4T/gyjh9QDbrY1kCryjLLxmmUBQiDcKtsAFqct1J/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z910kEFWZ4/oT0R9q12S2GnacrFUSI/MfVig7BLFtmkneKkVWaVJydiZBq9oKwNA7CAhXs+UWuRo0NoLlOZWM2BSlFHR+ei0kaAZVmTZP5o1WLirbpioq6aED3V37cbrFDEFMYtchx8G9JGfO7ZCmWlC/snkjomsjcdwWiMaMz8yN/cq;4:KmJXwyWDklHvuOjcYJNFt6ZKQcIJbN4UlCWnkDJBxvvO1sg9hb37ho/45lpbKv3vm6pcqjrgGDXC44gNxxJlQrPLkbie1NKd6pMohVZC0oindb3r1jBTvn7gm5qHPm0FFbgdvpS+x6sG781Qatg+YDScEk3xd72J8Sn0cGYLSOChyCatwD+6XT0yIl1AT/U9YqJRtaiEi46IZZ1Rhwz98sIwbUaYxUi/Zz2sLAelO4q4LSPXXVxpYBDOISHHuW+6crP/+VYGcUF6XV+C9VkTAQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3002001)(3231311)(944501410)(52105095)(149027)(150027)(6041310)(20161123564045)(20161123560045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016);SRVR:AM0PR08MB3250;BCL:0;PCL:0;RULEID:;SRVR:AM0PR08MB3250; X-Forefront-PRVS: 07521929C1 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(396003)(136003)(39840400004)(376002)(366004)(346002)(199004)(189003)(97736004)(51416003)(478600001)(52116002)(6506007)(6486002)(5660300001)(186003)(48376002)(16526019)(50466002)(68736007)(50226002)(6916009)(956004)(53936002)(107886003)(386003)(6512007)(4326008)(53416004)(316002)(26005)(6116002)(6666003)(8936002)(1076002)(8676002)(105586002)(3846002)(1857600001)(66066001)(47776003)(486006)(106356001)(25786009)(81166006)(2616005)(7736002)(16586007)(2906002)(86362001)(476003)(305945005)(14444005)(36756003)(81156014);DIR:OUT;SFP:1102;SCL:1;SRVR:AM0PR08MB3250;H:i7.sw.ru;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;AM0PR08MB3250;23:gjFwRi+P3NraDZwTMPYjKDd+yYi52WkAVPITirSUI?= =?us-ascii?Q?VNUgY4+yXVJqPgv9EmCyLys8tjJ1VAcpnVxNJhyGVoDfv7NZZOVsC4qqjOrW?= =?us-ascii?Q?fBPqNZqAbVeCajEYL+yUJOJ28FSrdXojf2++Nja9xRZtNkf+obGHAnwUzCog?= =?us-ascii?Q?FwAhJa4cNijEhYaVebblzZ+Yn9s8tevyak/zQrx0njfWrq4yqirZYmAGwUG+?= =?us-ascii?Q?WO8Jqg5YBuGDdiZKlKcVYxzaRoWMEtVbVNwBeE6kPJ2fKtzP8iCAtpY6AvmG?= =?us-ascii?Q?3hQi1mHENzd53oJOwN45gd/RqeGYZvwKWhBzcTZZ36Ae/8rpLruFPVgrjumR?= =?us-ascii?Q?W6TMiQKiz7F7j/n52qy1kTQdEbClZ1+IaZTAwmID8rADgbXm+94ZvyHqCacs?= =?us-ascii?Q?etjVuxiM8f0n+35gBLo7jFJQ9x970Qw8Y7csIpwqBILa29Hw4DL49dfLXrgC?= =?us-ascii?Q?Hw26Aea9AhoWmACQERiNTAqekwLqIHAsqzjZ83hiP/zWyaB1j8lxKskuQvlQ?= =?us-ascii?Q?nx9DWQb/oNhz0ttl9O/bn4uhDhrYW3LEy3jivtL08CWh7X+d+z39HBk7NrND?= =?us-ascii?Q?kUDoPglccEdGb8VwNkPr1w+eUtemh/K3tTDCy8qBjT9oMa4pb66fLzFHQ+ob?= =?us-ascii?Q?fCSzq7E/x4NidWHHdPkneTBTV/+mXKCoa9NCZDv4yTasIV4W7HMTIt4oYHls?= =?us-ascii?Q?9PAKv91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s9H6LqGCIJPc1EcDceVOIB0solMYY+1b3lvREjgS6Uozbs1Y4= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Aug 2018 15:32:19.7995 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6257800c-7040-42a7-1408-08d5f88d22e5 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3250 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With gcc-8 fsanitize=null become very noisy. GCC started to complain about things like &a->b, where 'a' is NULL pointer. There is no NULL dereference, we just calculate address to struct member. It's technically undefined behavior so UBSAN is correct to report it. But as long as there is no real NULL-dereference, I think, we should be fine. -fno-delete-null-pointer-checks compiler flag should protect us from any consequences. So let's just no use -fsanitize=null as it's not useful for us. If there is a real NULL-deref we will see crash. Even if userspace mapped something at NULL (root can do this), with things like SMAP should catch the issue. Signed-off-by: Andrey Ryabinin --- arch/parisc/Kconfig | 1 - arch/s390/Kconfig | 1 - lib/Kconfig.ubsan | 11 ----------- scripts/Makefile.ubsan | 4 ---- 4 files changed, 17 deletions(-) diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig index c11d9939c1db..e21751fb24aa 100644 --- a/arch/parisc/Kconfig +++ b/arch/parisc/Kconfig @@ -11,7 +11,6 @@ config PARISC select ARCH_HAS_ELF_RANDOMIZE select ARCH_HAS_STRICT_KERNEL_RWX select ARCH_HAS_UBSAN_SANITIZE_ALL - select ARCH_WANTS_UBSAN_NO_NULL select ARCH_SUPPORTS_MEMORY_FAILURE select RTC_CLASS select RTC_DRV_GENERIC diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 184ea341437b..515240576930 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -106,7 +106,6 @@ config S390 select ARCH_USE_BUILTIN_BSWAP select ARCH_USE_CMPXCHG_LOCKREF select ARCH_WANTS_DYNAMIC_TASK_STRUCT - select ARCH_WANTS_UBSAN_NO_NULL select ARCH_WANT_IPC_PARSE_VERSION select BUILDTIME_EXTABLE_SORT select CLONE_BACKWARDS2 diff --git a/lib/Kconfig.ubsan b/lib/Kconfig.ubsan index 19d42ea75ec2..98fa559ebd80 100644 --- a/lib/Kconfig.ubsan +++ b/lib/Kconfig.ubsan @@ -1,9 +1,6 @@ config ARCH_HAS_UBSAN_SANITIZE_ALL bool -config ARCH_WANTS_UBSAN_NO_NULL - def_bool n - config UBSAN bool "Undefined behaviour sanity checker" help @@ -39,14 +36,6 @@ config UBSAN_ALIGNMENT Enabling this option on architectures that support unaligned accesses may produce a lot of false positives. -config UBSAN_NULL - bool "Enable checking of null pointers" - depends on UBSAN - default y if !ARCH_WANTS_UBSAN_NO_NULL - help - This option enables detection of memory accesses via a - null pointer. - config TEST_UBSAN tristate "Module for testing for undefined behavior detection" depends on m && UBSAN diff --git a/scripts/Makefile.ubsan b/scripts/Makefile.ubsan index b593b36ccff8..38b2b4818e8e 100644 --- a/scripts/Makefile.ubsan +++ b/scripts/Makefile.ubsan @@ -14,10 +14,6 @@ ifdef CONFIG_UBSAN_ALIGNMENT CFLAGS_UBSAN += $(call cc-option, -fsanitize=alignment) endif -ifdef CONFIG_UBSAN_NULL - CFLAGS_UBSAN += $(call cc-option, -fsanitize=null) -endif - # -fsanitize=* options makes GCC less smart than usual and # increase number of 'maybe-uninitialized false-positives CFLAGS_UBSAN += $(call cc-option, -Wno-maybe-uninitialized) -- 2.16.4