Received: by 10.213.65.68 with SMTP id h4csp1092960imn; Wed, 4 Apr 2018 12:27:40 -0700 (PDT) X-Google-Smtp-Source: AIpwx49KeXi1LWUkYnRqOX83dnpphFtoQtRuZWY+ZwMva79Qff5pQByfDTGkQKvGcoazFNJ9LH6Y X-Received: by 10.98.220.218 with SMTP id c87mr14996736pfl.198.1522870060434; Wed, 04 Apr 2018 12:27:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522870060; cv=none; d=google.com; s=arc-20160816; b=iLEwkigbGO/i33XucQjd7r0pWENS8iBgqxCJnwbp8zY0RJIGZYgioJxzfbj7us09JQ zFyQerVKesgeFcKDsZZ3n4ADUTFOf5vUC8cYpXBksglmPaSDGDUMrvv0fmcNZw7Wvpf0 L/xRAwq2253iXzb68FUFOcky5UVLvSfR7VHPX9TPxa1tFkrqWEChFD8Rq3wx+NZCf1gb aLvzRabn3lz5+dtSj9WqOvJrynV6ZtaSpA/J0RwqknV6C+X8NvKVNQ8suCDUWUu1xE3X xBa6kcss/v2i0ioxoZ1Q7wPGu3zj+D9vOhrcEXn0oEj2BW87LlUK1hjaFbxPeRUgBatL 8IWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=b/f9EaiF3LfXEZPcNNIB2Ub982tnLmUyc2KfEepCN14=; b=VGxf5xbDY9hDOixL7kswNGo/EvFE78BvtcvvylVJtGYrVSZQrVAc2jQ3pyLoYntW3U XiP84J5j/+dRvOQh2GRhhKW1xeaYToaTP3aspGKRLM67+S/HiPawjJPy8Q0f/F+wariL TlyGJ4+KsUGh4oaUKprmU3BadjAUpcqB6cP0wjcFCKMps8MDKK88YvapjRLGNRiDsnLq tdNYVeWtbNr9AOmD0BBceZo0yBbOUH+u69JMBKIszcFbiYW5/8aQh8191MyoVycDdx0L ncA+XH42k7AnimHEOg9M7puydxhgTT6+8AUHrXhFm/WoZjTa9bK9PyyBQ0TXvowb9bRU HA4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=UPzveeMe; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z11si4223571pgz.412.2018.04.04.12.27.26; Wed, 04 Apr 2018 12:27:40 -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=@google.com header.s=20161025 header.b=UPzveeMe; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752197AbeDDT0W (ORCPT + 99 others); Wed, 4 Apr 2018 15:26:22 -0400 Received: from mail-ua0-f196.google.com ([209.85.217.196]:38557 "EHLO mail-ua0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751442AbeDDT0T (ORCPT ); Wed, 4 Apr 2018 15:26:19 -0400 Received: by mail-ua0-f196.google.com with SMTP id q38so13964713uad.5 for ; Wed, 04 Apr 2018 12:26:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=b/f9EaiF3LfXEZPcNNIB2Ub982tnLmUyc2KfEepCN14=; b=UPzveeMeU6PszQABV1B9zxwkhzmbSjfymz5KryfH3QengQu4dW/lxfX/MHLCauPmma WLUk2apCbbRofsf5VvI9CzaF+y3OoM1PVnGfIeNMuNJFm/s4oaehmmt97RpBHG/Pqr58 IcV4Y14HMa58Cb3cE4rYlLMrSjzkjdyVwrn5PcKO/XLXo9i2ve6JcdTzDaETxng27nVp AhY/jRGYzUM/IfMPy+EI5RqAIoY3a5bKZH2Q52rD+xZWrZBQKHKXJNjEjNkTaovz0v6t OWgNzjinoX+fLlOuUxciwRe1I6IFeeBi4yZ+/x5QH5IZI2aZS3iCAGODsB+Uw20ek+VW 3KCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=b/f9EaiF3LfXEZPcNNIB2Ub982tnLmUyc2KfEepCN14=; b=o7FY59NkhuXBWd/XlCCSRIEAe0uf5nZ9AeDQSIERiv9Dcba1IdxB/XQdyrJm/CFD6o 4m1rIt5hG2MRFqmflbavFWO5p8rg/v+lbOfGFlO2334F5dzvNPabUJkexcWdI8Kf6uU6 vCAMn4fpfItWO85n6Da689Z0bUCfgFfT2SRMkPhxSz6W/RFka5QY4TPTnqbU2O8QchU3 Q1V+EabCMJ15ToFkfF8EkC+y+tOMVtfN/0ucMtcw1/QoPjsaWtXGRnYcdIho/AXk0OUj B+QLrp2djOA77YgIW7E/GSlPtc0TDlZOvbjLY+/Be+hqrFWpz/Hcj5cNyy1XTAYz2r4v UcIA== X-Gm-Message-State: ALQs6tBIINVN2Wmhqctp7NTUYuEV0yphETFLUFZtyCO2lbODUPCKD15l sRTe+n+eIsp1DZ35E/8uzc0B5T6e/NvizGVqRfj5wA== X-Received: by 10.159.51.103 with SMTP id a39mr12126133uac.50.1522869978460; Wed, 04 Apr 2018 12:26:18 -0700 (PDT) MIME-Version: 1.0 References: <20180402095033.nfzcrmxvpm46dhbl@gmail.com> <20180403085904.GY4082@hirez.programming.kicks-ass.net> <20180403095118.rpf7tj577dppvx7d@gmail.com> <20180403180658.GE87376@google.com> <20180404093823.GC25996@kroah.com> <20180404165914.GA9034@kroah.com> In-Reply-To: <20180404165914.GA9034@kroah.com> From: James Y Knight Date: Wed, 04 Apr 2018 19:26:06 +0000 Message-ID: Subject: Re: [GIT PULL] x86/build changes for v4.17 To: gregkh@linuxfoundation.org Cc: Nick Desaulniers , mka@chromium.org, Ingo Molnar , Peter Zijlstra , Linus Torvalds , Linux Kernel Mailing List , tglx@linutronix.de, Andrew Morton , Chandler Carruth , Stephen Hines , Kees Cook , groeck@chromium.org, Greg Hackmann Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 4, 2018 at 12:59 PM Greg KH wrote: > Here is another horrible work around that was needed to get clang to > stop generating invalid code, beaec533fc27 ("llist: clang: introduce > member_address_is_nonnull()") That one caused a lot of odd failures by > users, I wonder what else is lurking in that same code pattern. It's a > hard one to debug... I would note that this issue is an entirely different issue from the null-pointer-deref-is-undefined-behavior optimizations, even though it may seem superficially similar. For _this_ issue, the behavior at question is that the compiler assumes that objects are contiguous in memory, and thus that "&struct_pointer->member_at_nonzero_offset != NULL" is always true. I don't really see clang ever getting a flag to stop assuming that objects are contiguous. Note that clang does actually emit an on-by-default warning for a situation analogous to this: warning: comparison of address of 'p->sub' not equal to a null pointer is always true [-Wtautological-pointer-compare] if (&p->sub != NULL) { ~~~^~~ ~~~~ ...but unfortunately that warning is suppressed when it occurs in a macro-expansion, so the llist_for_each_entry error was silent. (OTOH, I _do_ expect clang to eventually gain support for a flag to treat NULL-pointer deref as a legal operation instead of UB. I'm not really sure it makes sense for the linux kernel, but it's a useful feature for the compiler to provide in any case, so why not...)