From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04A38C43464 for ; Fri, 18 Sep 2020 21:18:43 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5208222208 for ; Fri, 18 Sep 2020 21:18:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="W1aGW+4W" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5208222208 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id BF6766B0093; Fri, 18 Sep 2020 17:18:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BCC556B0095; Fri, 18 Sep 2020 17:18:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AE2506B0096; Fri, 18 Sep 2020 17:18:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0117.hostedemail.com [216.40.44.117]) by kanga.kvack.org (Postfix) with ESMTP id 994D96B0093 for ; Fri, 18 Sep 2020 17:18:41 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 59E972C9D for ; Fri, 18 Sep 2020 21:18:41 +0000 (UTC) X-FDA: 77277446442.24.light90_3c15d732712e Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin24.hostedemail.com (Postfix) with ESMTP id 3DC4F1A4A0 for ; Fri, 18 Sep 2020 21:18:41 +0000 (UTC) X-HE-Tag: light90_3c15d732712e X-Filterd-Recvd-Size: 4883 Received: from mail-lj1-f196.google.com (mail-lj1-f196.google.com [209.85.208.196]) by imf46.hostedemail.com (Postfix) with ESMTP for ; Fri, 18 Sep 2020 21:18:40 +0000 (UTC) Received: by mail-lj1-f196.google.com with SMTP id a15so6205833ljk.2 for ; Fri, 18 Sep 2020 14:18:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=gW6J35G/dtu0lRot+wO7D3GCux7aBPJGLPsj5jdXvLs=; b=W1aGW+4WsnUDs5fIzfvjirVNDuNgVOe3fbcpZi2dJFxkGtB34cLeAmrt80m2ID1Cgh hIAiqxJtsgOTRL/viG7eHS9Jb5RikD31JBg+iMpW5RMI+3vi47F4dTpblCfHkay/Zg2W T8IVoonLN7ONYTh6VrIvQGHNmvSWJGbRgHOGc= 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=gW6J35G/dtu0lRot+wO7D3GCux7aBPJGLPsj5jdXvLs=; b=BX97QrScB8R3p/LNy97VKWqWwvRsZd6apbHI7fgCdkJsbJWpGvCEm158BZwmmyTlug 3Qmv0dRPSg1e5k1iRe8G0sBry4C98O9FVxTFmfQzHSn4aPd90oPdew8AFoLQRKSMn/f8 vLgvIa3B7tnhFHMk1FTk56QRf1+pJO7UdxWq8E2/822MIwjH2ulh1gqvlOuc6R4xzSi3 T+rddiaeiDimoVOKM1eyL9/KJ8iohS770HDmTgjTkfNPlfxebttK/j1rcMTfntn2HcdV KrfceApd/zoXVIgPMAoUGkErn+icVwv0Sx6Tvt/ILxR/nskoX4LQT74dciJPPgtENYqj wbMA== X-Gm-Message-State: AOAM533fcsKY8CC5w3PvZVKZCMthbcPHE3mVMq9n19o9vQSlFjbuYCd4 51ng/VMGYBqqAmklD2hqsFgG88DUtx+dpw== X-Google-Smtp-Source: ABdhPJzjVC/1LIhrgvEVNyciPdB7y6AY7wj8Jo4RZxb4iNt1KOSvnU7H3Xa0x2B+ugPxlgCwx8wOjA== X-Received: by 2002:a05:651c:102a:: with SMTP id w10mr12039688ljm.64.1600463918576; Fri, 18 Sep 2020 14:18:38 -0700 (PDT) Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com. [209.85.167.41]) by smtp.gmail.com with ESMTPSA id r15sm815151lfn.259.2020.09.18.14.18.37 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 18 Sep 2020 14:18:37 -0700 (PDT) Received: by mail-lf1-f41.google.com with SMTP id b12so7569951lfp.9 for ; Fri, 18 Sep 2020 14:18:37 -0700 (PDT) X-Received: by 2002:ac2:4a6a:: with SMTP id q10mr10536957lfp.534.1600463916853; Fri, 18 Sep 2020 14:18:36 -0700 (PDT) MIME-Version: 1.0 References: <20200917204514.GA2880159@google.com> <20200918162305.GB25599@embeddedor> <20200918193426.GA15213@embeddedor> <20200918200252.GH32101@casper.infradead.org> <20200918202909.GA2946008@rani.riverdale.lan> <20200918210050.GA2953017@rani.riverdale.lan> In-Reply-To: <20200918210050.GA2953017@rani.riverdale.lan> From: Linus Torvalds Date: Fri, 18 Sep 2020 14:18:20 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [GIT PULL] percpu fix for v5.9-rc6 To: Arvind Sankar Cc: Matthew Wilcox , "Gustavo A. R. Silva" , Dennis Zhou , Tejun Heo , Christoph Lameter , Linux-MM , Linux Kernel Mailing List , Kees Cook Content-Type: text/plain; charset="UTF-8" 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: On Fri, Sep 18, 2020 at 2:00 PM Arvind Sankar wrote: > > You could just assert that offsetof(typeof(s),flex) == sizeof(s), no? No, because the whole point is that I want that "sizeof(s)" to *WARN*. It's a nonsensical thing to do. That 's' has no statically known size. The C standard is being very confused here, in that it tries to claim that the flexible arrays are somehow fundamentally different from a zero-sized one. But then it acts as if they are exactly the same wrt sizeof() and structure copies. It should warn, exactly because right now it causes potential bugs like the one that started this thread. You can't have both "zero-sized arrays are bad and shouldn't be used" and "flexible arrays are good, and work exactly like zero-sized arrays". Either zero-sized arrays are bad or they aren't. And if they are bad, then flexible arrays shouldn't work *exactly* like them apart from some UBSAN warnings. See my point? Linus