Received: by 10.213.65.68 with SMTP id h4csp2930145imn; Mon, 9 Apr 2018 11:21:05 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/GJhC+SN5ylNKI2lOMXT+x3VlLhsoD8PkvEa6qper3LDfyyV6PdgwZ3OY4zhELxeYNN083 X-Received: by 10.167.132.132 with SMTP id u4mr40620pfn.17.1523298065752; Mon, 09 Apr 2018 11:21:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523298065; cv=none; d=google.com; s=arc-20160816; b=E932Zn1ha1iz00RFod1f/6jg7vQk5ehPVt1T5ASdDAH2cxRGPTJN2CvGOSRuagEqYB qhj3on2wvHyqKs7BjMqU+rfaWnLyqC6MXfY2ksMHE+BS2exaDKM1tvDiuPs/sHSO4sf2 veG4wZKdp64qGyTRp74zOPtAUIhA+1+4ZA4kRQB4PVtrbWH95Zfa62z9B7ri/OWiA6II epnoFu5X9foyuUomJRhMLUiWTiVmhxuiek649CkxzIDs7FwFW62hd0zbu1y7NfRgCIne YF0W6gON/476ohRFozs1YnsmRjJNtWc+n64pKW+P/6+WTV6x4EkbDdtxNNkKyTvQHNuv MoDg== 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 :references:in-reply-to:mime-version:dkim-signature:dkim-signature :arc-authentication-results; bh=4IskfmzqDCP0LQUqUSfdM/utTo629vFLbhkE6ecfs/4=; b=EMVZkP/nT7R5xYM21/xEVDvXGWOr5XCQaBqreP1Th1nbLqZQRt2LrBdmyeD2xcfIEo YOd2hkrGP4129z8zPsTo0ptQaF9rZb6FG+A8aEja7ost2mMx2dnND2S1yIU2fBmxriK8 zIo94EL7y9uRBKCLaPwazz6Nzeeh2PApt7DBUGHRKjwNGsU0vNKOyRfziDSvQT8zzhyM qUfNrTF7FGtJYlnqyTSl0ow/UwpcCA+9dDHcTBqKBNFE8Mlea1cm1OPJGsY7fAlHDVso mQItmtxuNIdMl7ZDEMm1IDD2bkFp8OGxOIPr7aWhMwRoiPOVLtHD+1+ti9HTadIvYani G2Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=CGjHvYjf; dkim=fail header.i=@linux-foundation.org header.s=google header.b=H62Hnt5o; 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 t3si501071pgt.547.2018.04.09.11.20.28; Mon, 09 Apr 2018 11:21:05 -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=@gmail.com header.s=20161025 header.b=CGjHvYjf; dkim=fail header.i=@linux-foundation.org header.s=google header.b=H62Hnt5o; 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 S1753585AbeDISRO (ORCPT + 99 others); Mon, 9 Apr 2018 14:17:14 -0400 Received: from mail-io0-f193.google.com ([209.85.223.193]:38122 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752576AbeDISRN (ORCPT ); Mon, 9 Apr 2018 14:17:13 -0400 Received: by mail-io0-f193.google.com with SMTP id b20so10714056iof.5 for ; Mon, 09 Apr 2018 11:17:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=4IskfmzqDCP0LQUqUSfdM/utTo629vFLbhkE6ecfs/4=; b=CGjHvYjfEkoPYhJOYzyRX3ilgEtiQXXBLxVu7LqwTaOlaZZ2zVicXFIe9E3Qs2Cwn6 JqEVTDyI9vZ50/+gF95agQoP5+gyviyxnYwGc3Ndb6EdIu+XkzR9ZeabB3YW7qRh7Bt/ M3/HEjGJ01s6yPlRYNUEHRrhZi19eo3H27uSyWvKgq3C77QwM7jH2B6K7W8q9xp375Sy 5elMOrLKIc8uT1glAAyTck8gw2n/RpNt2zfQsMXTQpsEK7j+5OHFr0lV858ZoJJT7an+ pLAbaibO/r206QgyGFeGwv9/pIpEzxNSv5xZFro1AXEz1jII6Zy1J99GtT6MVP0zbuLF 07ug== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=4IskfmzqDCP0LQUqUSfdM/utTo629vFLbhkE6ecfs/4=; b=H62Hnt5o11CrtmWoViDBsJrPBuwqFOjwQ18TyaECaIojWTq1kAf5o2WweibXdn5+rL oQ8c64JY9PzV0BWbxQeSC57WxofVOro8NMH0jEI7WPXQ7AHSOWm2lHkYSaMU7tvQBwNC hoUwAPv7QpOGYw+3qCeFztgGKfgP/kz9hmwEY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=4IskfmzqDCP0LQUqUSfdM/utTo629vFLbhkE6ecfs/4=; b=JSr7dB9spsbRMWMHAVinuj145ktiiZNZvP6rCMax1haV752y9oGcBdFmYlaEXCJB9d WhyJc3MbEBFkvMjlFKpu/7MNK5NAzRNTqPcmzomlbI5KeXWxSO2LpBFUPNqOzu8kX5MY bshu57O3eaxZ8JsoBWzMl5RA8mwiX6fxtdM4+kRPW7+fXaMKwg9I8ysql8M5Gg+/9B5u lxLylT2RB4Vc/USx/Ul7op6YsSqUcQvGHS7DkwJ7IScZHbPrjYDhkL5OqqsJHvlsGaob zdMXqvBTpSs57OGyGVhW4qYZifTPhURsTTtQYbKpVHjQ+cIAhAg3DqDAsHcr3Pmj/Cbk hNbQ== X-Gm-Message-State: ALQs6tCgCFX7zGTQFsNn7xsyc38IZCJuARqGXBJ4mVq6J/yM+VMXlm1L hMqUmQu+/XKyLhLRwPu5yA+xmtMZ38eUOg+b6ec= X-Received: by 10.107.175.219 with SMTP id p88mr39008ioo.257.1523297832062; Mon, 09 Apr 2018 11:17:12 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.95.15 with HTTP; Mon, 9 Apr 2018 11:17:11 -0700 (PDT) In-Reply-To: References: From: Linus Torvalds Date: Mon, 9 Apr 2018 11:17:11 -0700 X-Google-Sender-Auth: 8wMahn2QzubulVYDY24lbbY_3Ms Message-ID: Subject: Re: [bisected] 3c8ba0d61d04ced9f8d9ff93977995a9e4e96e91 oopses on s390 To: Kees Cook Cc: Sebastian Ott , Sebastian Ott , LKML , Heiko Carstens , Martin Uecker , Ingo Molnar , Miguel Ojeda 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 Mon, Apr 9, 2018 at 11:00 AM, Kees Cook wrote: > > Can we update the comment near the top to explain why we need > __UNIQUE_ID() since we've now rediscovered why it was originally > there? Too late, since it's already committed in my tree and going through the build test paces. But I really hope somebody revisits __UNIQUE_ID, and maybe they can then add a comment to the users too. It looks like gcc needs at least version 4.3 to have a working __COUNTER__ implementation. What a coincidence - we don't really support anything older now anyway. And similarly for clang - the only versions that didn't have it are not able to build the kernel anyway. So we should remove any version conditionals, and we should remove the known-broken generic fallback that uses __LINE__ instead of __COUNTER__. And once you do that, the "prefix" is actually pointlessm and we could drop it to make __UNIQUE_ID() easier to use. The *REAL* problem, however, is that __UNIQUE_ID is such a pain to use in general. You basically have two choices: - use it as a single-declaration throwaway variable name that is never actually used - use it only in a wrapper macro that then passes it off as an argument to another macro that uses it several times That "throwaway" use sounds pointless, but it's actually the *common* use we have for this thing outside of this min/max case. It's used to shut up the compiler about other unused variables, where people do things like static __unused__ __UNIQUE_ID(xyz) = .. mark other variable as used here ..; and I think the reason it's common is that it's the only *easy* use of that unique-name-generator macro. Having to pass it off to a second macro to use as a variable name makes it cumbersome to use for most normal macro cases. It would be nice to have the equivalent of __COUNTER__ that just expanded not to a continually increasing number, but expanded to a number that expands for each macro expansion. Then you could do things like int UNIQUE(a) = (a); to generate a variable name that was unique within a particular macro expansion, and then actually _use_ UNIQUE(a) in the same macro expansion to refer to it without having to pass it off as a name to another macro that does the declaration and use. You can't use __UNIQUE_ID() for that, because every new __UNIQUE_ID(a) will give _another_ unique ID. (And you *could* use the __LINE__ based one for that, but then you'd get the whole "nasty shadowing" problem if we have nested macros again). Ugh. We have no wonderful model for unique names. Which is why we obviously just use the "add underscores until it's unique" and the get it wrong with nesting. Linus