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=-6.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 41370C43460 for ; Thu, 15 Apr 2021 14:47:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 20C78613B4 for ; Thu, 15 Apr 2021 14:47:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233530AbhDOOrw (ORCPT ); Thu, 15 Apr 2021 10:47:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:35874 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232774AbhDOOrv (ORCPT ); Thu, 15 Apr 2021 10:47:51 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6A0B8611CD; Thu, 15 Apr 2021 14:47:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1618498048; bh=cHuvASof4cEDa0CgFMEjc3MfMRcbdCVjcIlcGec1vDU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Ur71+nf4sZphgCqov1HZANWal3mCDWqYYEx9UcGEnR1H5TLxz0iurai3fSEafNieu 2AtIkxgoCoBhbcwry8C+nDr0qjGgT0rQDeoz5gZ5u4RDcWVtnphLMpl2eafyd9RR/N SL6dYhb3Op8HpMWJ5Sb3+GO+CyOK8AK8gugXzNyqiL2T8bGo2wlMJy/kxkABYxv0RW CyFNc9KxoPBX4dcgy+UwWLyCPGbbTxDOazLm/4lnnaFVXLeZPwMYlqcUtyjLXpyR/O k+nI6XWKV2ls/kuVEIXj7hlaSmu3wg4d6So92Ns5ImBt07AN1LaNJC7FavbKis/PxL VoTg7H/sRA0XQ== Date: Thu, 15 Apr 2021 07:47:22 -0700 From: Nathan Chancellor To: Christoph Hellwig Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Sami Tolvanen , Kees Cook , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Thomas Gleixner , Borislav Petkov , x86@kernel.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com Subject: Re: [PATCH 1/2] x86/events/amd/iommu: Fix sysfs type mismatch Message-ID: References: <20210415001112.3024673-1-nathan@kernel.org> <20210415075335.GA1954964@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210415075335.GA1954964@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 15, 2021 at 08:53:35AM +0100, Christoph Hellwig wrote: > On Wed, Apr 14, 2021 at 05:11:11PM -0700, Nathan Chancellor wrote: > > dev_attr_show() calls _iommu_event_show() via an indirect call but > > _iommu_event_show()'s type does not currently match the type of the > > show() member in 'struct device_attribute', resulting in a Control Flow > > Integrity violation. > > While the fix looks fine I think we need to solve this kind of problem > by better type checking. The fact that we can use the wong type here > without a compiler warning is the real issue. I agree. Unfortunately, it seems that is going to be a much longer tail project because of how pervasive this is (using container_of() + attributes to get callbacks). https://lore.kernel.org/r/202006112217.2E6CE093@keescook/ https://lore.kernel.org/r/202104021823.64FA6119@keescook/ Cheers, Nathan