Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp838694pxb; Thu, 15 Apr 2021 07:48:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPMxS//eEgQHFQRm6ak+kJA6q9ujrYeg+Hpk7ofiwiyzGag3DCTuq+8g+HF7/0/+bYsoLG X-Received: by 2002:a17:90a:6585:: with SMTP id k5mr4208004pjj.40.1618498094392; Thu, 15 Apr 2021 07:48:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618498094; cv=none; d=google.com; s=arc-20160816; b=NTpK/QSjLY6Aemoj//7QNtXdJabjS8dcEm+fLyN7VoF2R44vMT0ZV+KmqozrypAFIM qzwS+nmy3o+RAZ4Wnj9beeeldEhbcdiFzL/unc91t1A4ZWDt6BJ8q++SXb4CCjuR1zyV E5eQ3bmT/kTytOoN+FOZ5qYYrLb2cOVIjIhRYCP8IQ2tH/vq/bqBDy9jO9ZyZkhDqp4k gRBahZveTClwGeTxa0uBOIw7L2vHPC1lAaiysguIxkwp5FJ1acEWS2rv0xIZkDLSUE1m F/pr+6JqwILtwy6NGNSLnWw22doyzYk+n1EXaQe5R9KTOmHEMi3lzH0ntNJ72xPC3jGy /BfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Yt0E+fDRtpKXGe+BjIE0cuh61mwnWfiS4xsqZGd4ySk=; b=EAumIjY4YzYntr67wDl684gMMd3etgNtR3CmlvC2fRO8G75pEkWcuRkbLuZKseII3z Dr6KaPUGdYhLaWrEnJEqbYgSdRhh1iZv5SkxZU3qbRSUtc1SGvw6v3BMWBARjVPwY6oD nMhUsvy4cN0ngQI/oLUU75Uk1c6+BS/UyN0JYYSOzhW4aNrLvV3b/nUmgoVOUvKE7Odd 4+6gR5iGS6gGiah96LD5QXP2/uajGiQVHxfnb1F1V6gl9WdRgCroY7LX3F3Vgpd/uYtt IG8NEDxlD0SVQhdWNx8Ff8iQweOYE8iZQlvDX+FjUuvT7oUsn1DPATRf7ZYP4wtlpHIK PJ9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ur71+nf4; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k17si3421420pgl.58.2021.04.15.07.48.01; Thu, 15 Apr 2021 07:48:14 -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=@kernel.org header.s=k20201202 header.b=Ur71+nf4; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233518AbhDOOrv (ORCPT + 99 others); Thu, 15 Apr 2021 10:47:51 -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