Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1499206pxk; Fri, 18 Sep 2020 14:20:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJykZpb8jPBEsnAyJ2zKXvWaqQKuy8nisDQkwBr/rMWfs/DJIjsfc2HoAjdff/8MN0DKs6Tt X-Received: by 2002:a50:f1d1:: with SMTP id y17mr39336251edl.231.1600464046636; Fri, 18 Sep 2020 14:20:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600464046; cv=none; d=google.com; s=arc-20160816; b=rk2zZ66rKXkXFJGirWH2eAwL6VpOtQ931oKAFnOOHxXmCvtmy5DYi4x5+tHV/Ncio9 Gxm1L5JoghmmedCVe5Dq1Qy3+4+OmK+kNEOv+LF9xddUByzSnNm2aEzm8IWvy8X0Q6xP yWjxmnoLtQHIoNvLDJGQXalIicXN+GsURifF2ww3XDq9EMBP3lr18GHFDCqv60v0rEc7 8vsAvXEsJ62UoIta6lVAq2KQViz1BYdngGa7boao/XYNEfNYHKZQ3gtCLEvQwagsH8CU 9MWIKX7o511QxiDg843Yof9LNXqlc8iRhVJWlNBoLa4IbUjm7NPvAg8tORpCsbPqupXo nlHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=gW6J35G/dtu0lRot+wO7D3GCux7aBPJGLPsj5jdXvLs=; b=H2O1v1LsRwETcpgRvqjSUHiIrLs5qvcouyg3pB1YcctvWjt3nb48pU1CSFdgo5B+Nm vNoLO3i9DEgcg1mvAG7U/ZsXDHeIJGfBVXg0CoFFzjV/gm1agRiWp7xRO03FKv62tJfc PaVhUHn8iAAnHbNfebaFGnRypxrlmzWwDmQPXVS9KOEux+9QCAREly7Urwk9aFERaEA+ X9UJI4CSp7hasKhtKSMiUiF6CNmQ0aHk10b62mgSnfrLEtJ+BPUxUTS14KbR0IMOaK7B TeuXMM/HnRoTLxBbISlvVO3kelMiJGXqGWUI4qWfV7B/QXQfpPbGKBgoTqhDRGtfhv4z dAMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=W1aGW+4W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z18si3298634edm.355.2020.09.18.14.20.22; Fri, 18 Sep 2020 14:20:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=W1aGW+4W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726247AbgIRVSl (ORCPT + 99 others); Fri, 18 Sep 2020 17:18:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726168AbgIRVSl (ORCPT ); Fri, 18 Sep 2020 17:18:41 -0400 Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EE52C0613CE for ; Fri, 18 Sep 2020 14:18:41 -0700 (PDT) Received: by mail-lj1-x242.google.com with SMTP id y4so6189888ljk.8 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=tGVPPj73DvitV9pW4ycMWOPxX0s8UF1NH3Vp6wcaQFY5Ke9UGUQYfLTYZyEjeLELl1 QOuLstkm+uKrQPmnYS5Tq4x5x6GRlSp26Uk6xR6pnjTxVliXbLr+sPYZtlMPcWgPQ6F4 tyTqSMp/3coKTksHFF/Xb4PXveUm3HqFQucuqHzuaU5q7qX0pePuPes/Oca5+hQ059ru X2zzCxlT4wU03gJxW/GtGdRfNOObAipzsHYyvisWJFCm7G8KUxKDf/V8mYhyPe3LEksR h6vkFJnpNbUMWOKSwecZS37M81v7syXwrDReUmrgJiIHUcrjfm5IniO2D2upcIWrZN/G mZzg== X-Gm-Message-State: AOAM532G3yHB8O3gD/4EWCEQCbbKmhjPNInPBsfkhh96lJJ3ld9Cuev/ eV+W8Va8rUFQWsHhZHhEs6tQnR9OtZLfCQ== X-Received: by 2002:a2e:9a4a:: with SMTP id k10mr11616937ljj.355.1600463918676; Fri, 18 Sep 2020 14:18:38 -0700 (PDT) Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com. [209.85.167.50]) by smtp.gmail.com with ESMTPSA id v25sm826840ljh.102.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-f50.google.com with SMTP id q8so7592218lfb.6 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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