Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp2035750ima; Mon, 22 Oct 2018 03:07:58 -0700 (PDT) X-Google-Smtp-Source: ACcGV63RPzhAJ2WPA1zrI3xXjalyQqJLNwAhnPhNaEMFkl64A2IssyAQyfHOao+mcOGgJapeVAm8 X-Received: by 2002:a62:3641:: with SMTP id d62-v6mr36079797pfa.97.1540202878278; Mon, 22 Oct 2018 03:07:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540202878; cv=none; d=google.com; s=arc-20160816; b=dhulYqfge0BRGdKIdAwlarTD2+dzYT0tJ9oIaNndYdzuPIWWhZJSFhloJLOrbB1mHI 9ZOnRlnrwv0nxTQHwnf2s37BIT0i4M+mCfW0psrZuTbWdgDUMv10OIcNSzlLrQ9l/oG5 5VMCbV/QJ0HS17LD5nsTTv7Whd0awHIxxySyRolOxzD9R02woJ+jRcwMzSgE1iRbxU2H KnkazB7/litm675vj+RroLYR627OD9ILfpOZzdj6w/OhpA5zGNjg+5xWR/r0NXB96d9q hzoKxlFia7BFTyJnz1Qc/QIGNGujZnqNoS7lhqTqnyJKkflVGtqM1xgheSSA+GY4/EOh iEOw== 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; bh=Gh3kUPWXIp5mrPU/Do+stSfXrDwAtMQcpb+ivzkBaOY=; b=Gwx3FA+LPUanKXR2AS2kBbnz4EOM6PRzg0OBynOz6ooDR0+DZGUSWYtPJ8DzUEgs+z 2NOsjAXd3VR+58mx1Rt9tDIKd0sHTGJJa7eGYub73fTlXmZsQBihm4pCazfRLrIyPK56 YseorEfTPegM88gR+xU9p6ose6MvhT+AUON7Yeg2ESU8y26XP0T5zmJmSCIJIBxBrzJe qj5etPLKRrgQAeQHrlDfYI20A7pKzV4CeGyaU2Fu1Lme+jPKg+7TqBR4A1p+OrBg35R7 DqIPsTvVlqytGec8VhQwFQLUwnrw6rjvOh4Yd0hkz/aNpiidPMMTDDMC/R0tucI4xMhK M4KA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ZpJdltZr; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p6-v6si391188pgd.312.2018.10.22.03.07.43; Mon, 22 Oct 2018 03:07:58 -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=@chromium.org header.s=google header.b=ZpJdltZr; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728196AbeJVRwC (ORCPT + 99 others); Mon, 22 Oct 2018 13:52:02 -0400 Received: from mail-yb1-f195.google.com ([209.85.219.195]:45428 "EHLO mail-yb1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727748AbeJVRwC (ORCPT ); Mon, 22 Oct 2018 13:52:02 -0400 Received: by mail-yb1-f195.google.com with SMTP id 131-v6so1105861ybe.12 for ; Mon, 22 Oct 2018 02:34:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Gh3kUPWXIp5mrPU/Do+stSfXrDwAtMQcpb+ivzkBaOY=; b=ZpJdltZrkMsKFsaJ2c0iSoW5BHJEaEsP7nL/OpkuBL4TlMlPPIVn7B+dq8MBUwUyhv f8z7TK8zMmR7vq/f4rOnIaMlOOAbnrZMSdLqHDI8MAP/zHs7/5AONhG+lfznVeecua9e xCqmB8hnbLolfC/vEL+UcEP8hd/h4Y1IBW8yo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Gh3kUPWXIp5mrPU/Do+stSfXrDwAtMQcpb+ivzkBaOY=; b=NymwVqiyQ8uH8AZo28yh1bKiZrM4rIllFsCLa+BaBmFmfWexgCrAzwndrylvFQ7ig2 1+rxbYS4B+0bmWilKUX5b6LZ8wFy8R9zjInZL8Q3fDm6eSkiCW+azVD6qLt6qcWX5rMt P+0q+BwVWLOELLuKt/1mNCtWc0v324sdLuse2WRuaYSLFuCf6sXObYfgpD2Ir/BeqAMd v+2zGkmJp4876LXFoNEvuOZ8tWljHjzR22BqE6FVIq4fAuUxjndgQoY2JCV2oJgf9Duf My1SxvUXaP8QE2EXWse81KU8ARhoJe2/yqsoYmdlxCIpoCEK0sXyPY0yOapZR9zMPgBk tTYg== X-Gm-Message-State: AGRZ1gINIoFFA4NEdwLW+UmxXn4YRp1uqunw/brSwyOdwkUeUubrIRyo NI560g/myiI1rU/MmlLUz3oidVIfEEw= X-Received: by 2002:a25:3813:: with SMTP id f19-v6mr9424335yba.237.1540200856785; Mon, 22 Oct 2018 02:34:16 -0700 (PDT) Received: from mail-yb1-f169.google.com (mail-yb1-f169.google.com. [209.85.219.169]) by smtp.gmail.com with ESMTPSA id w188-v6sm1458980ywf.59.2018.10.22.02.34.15 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Oct 2018 02:34:15 -0700 (PDT) Received: by mail-yb1-f169.google.com with SMTP id k132-v6so4733454ybc.2 for ; Mon, 22 Oct 2018 02:34:15 -0700 (PDT) X-Received: by 2002:a25:820d:: with SMTP id q13-v6mr16994817ybk.171.1540200854791; Mon, 22 Oct 2018 02:34:14 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:3990:0:0:0:0:0 with HTTP; Mon, 22 Oct 2018 02:34:13 -0700 (PDT) In-Reply-To: References: <20181021171414.22674-1-miguel.ojeda.sandonis@gmail.com> <20181021171414.22674-2-miguel.ojeda.sandonis@gmail.com> <20181021222712.GI1617@thunk.org> From: Kees Cook Date: Mon, 22 Oct 2018 02:34:13 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/2] Compiler Attributes: add support for __fallthrough (gcc >= 7.1) To: Miguel Ojeda , "Gustavo A. R. Silva" Cc: "Ted Ts'o" , Greg KH , linux-kernel , Dan , Andreas Dilger , Masahiro Yamada , Michal Marek , Steven Rostedt , Mauro Carvalho Chehab , Olof Johansson , Konstantin Ryabitsev , David Miller , Andrey Ryabinin , Thomas Gleixner , Ingo Molnar , Paul Lawrence , Sandipan Das , Andrey Konovalov , David Woodhouse , Will Deacon , Philippe Ombredanne , Paul Burton , David Rientjes , Willy Tarreau , Martin Sebor , Christopher Li , Jonathan Corbet , Geert Uytterhoeven , Rasmus Villemoes , Joe Perches , Arnd Bergmann , Dominique Martinet , Stefan Agner , Luc Van Oostenryck , Nick Desaulniers , Andrew Morton , Linus Torvalds , Linux Doc Mailing List , Ext4 Developers List , Sparse Mailing-list , linux-kbuild 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, Oct 22, 2018 at 2:26 AM, Miguel Ojeda wrote: > On Mon, Oct 22, 2018 at 12:27 AM Theodore Y. Ts'o wrote: >> >> On Sun, Oct 21, 2018 at 07:14:13PM +0200, Miguel Ojeda wrote: >> > From the GCC manual: >> > >> > fallthrough >> > >> > The fallthrough attribute with a null statement serves as a >> > fallthrough statement. It hints to the compiler that a statement >> > that falls through to another case label, or user-defined label >> > in a switch statement is intentional and thus the -Wimplicit-fallthrough >> > warning must not trigger. The fallthrough attribute may appear >> > at most once in each attribute list, and may not be mixed with >> > other attributes. It can only be used in a switch statement >> > (the compiler will issue an error otherwise), after a preceding >> > statement and before a logically succeeding case label, >> > or user-defined label. >> > >> > https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html Please CC Gustavo on these kinds of things -- he's been driving the bulk of the fall through coverage. >> Do we know if coverity understands the fallthrough attribute? One of >> the reasons why I started using /* fallthrough */ is because it kept >> Coverity happy. > > If Coverity is like gcc, they should be doing both (i.e. I see the > comment parsing as an "extra" that gcc did, but the "basic stuff" is > the attribute -- and I would guess it is way easier for them to > support than the comment parsing). > > But I cannot test it myself :-( Someone, please? > > However, if I understood Greg correctly in his reply to the cover > letter, he replied that Coverity knows about it (?). > >> >> If the conversion from /* fallthrough */ to the __fallthrough__ >> attribute means that we start gethting a lot of Coverity warnings, >> that would be unfortunate. OTOH, if this is getting standardized, >> maybe we can get Coverity to understand this attribute? > > Indeed! That would be the best for everyone, including Coverity customers. We need to make sure the static analyzers are happy with either method. Additionally, when was -Wimplicit-fallthrough added to GCC? If it was added _before_ the attribute, we need to continue using the comment style otherwise we lose coverage even with gcc itself. Additionally, does Clang support this attribute (it supports -Wimplicit-fallthrough). -Kees -- Kees Cook Pixel Security