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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2537CC4332F for ; Wed, 2 Nov 2022 19:23:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=K4Ua7ELi3ByU2JefgWf9IjJG6y8S5M2agM6ayoKfEq8=; b=RoYDp2fz6YgnE7 KHugNrJR2t93mvzhvrz9GzlnGLbctOSQPm0jjumMWnuU1ik7BJMwLt7kZhVLGszwU2C8gX2NcmQhI x47/iGg2q7f2/9V5UASiqaDER9UdbDYRKor2CkIPC2T0BlhPm5/RAknJHERomdLb8yumGvXLiHWFB N2XL2O0UBRz7cdgzNII5RuZcSQzE5hP1/GgMShN/EMyiyE8nocEqg4GHz9iwVjDcG4NvE+OuSm8Bx fw939eSOWRgnFormJAzICFtcNYuXFNmLKRhIGEurEAeaMAIykHb3iVYdPG8NtDjQA5zLvYBcwlysL UrFj4IIMTfxUnuQXQxNg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqJJf-00Dhn9-It; Wed, 02 Nov 2022 19:22:24 +0000 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqJJW-00Dhch-9i for linux-arm-kernel@lists.infradead.org; Wed, 02 Nov 2022 19:22:16 +0000 Received: by mail-pf1-x436.google.com with SMTP id m6so17321652pfb.0 for ; Wed, 02 Nov 2022 12:22:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=4EDI3vYbHaaiAQeZuuGzJ5Pv1WpOR32gAtsS0QDWLuw=; b=cf2nTr5YnckoTzWzbGWmtwmcSXrd8AamU45cN4BkmLr5woysN2W1kdbIKrPwII4PVI ce8I7YTY4uSDnL6ZPBTz94gxiF8GCs7pA974P296j4z8qCIMA1+np81HnE/zTRa6yv+M k3Z8gi82o4u4QsaXVn9ASZodldSA4+ubXIZL0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=4EDI3vYbHaaiAQeZuuGzJ5Pv1WpOR32gAtsS0QDWLuw=; b=s1pOOY9kAQaoBx0PDKPBGgGLnryIPewwBONqLH6VZ/gZ2DuGJLY+1X2cv2EvLrI7EZ 10MjtP61giG30/jkPAwYGB5I1FjiD4hzefGeehJrWlQqSv+hP5+oS9o6FNY663/Pa/bQ 3cH1bfl1A/6+JX/9FxqWYsQG9es9bpskeZHko2dQHkGqPXiHtE0TEJ9bEIzPqIYxYxT5 tpIwr9wsyZb/SGHGeRHfcNYBOQCj1Z1KNw+14FBKIUgigSerj+aWaKN9K8n8Ld2LNd/l eIrcMeFINLhvWB0tMf4mP5YCfZh1RN/Hftm/EpGvgG4m35mdlvtyyEgeMsnHnVGw9l+8 TjUQ== X-Gm-Message-State: ACrzQf1Qh5ctlHasQrtHuDvaGX0RFuUCUtSHjABqwbk6WEVgJiniu6cY B1p2nh/1TEj8cua3Kw0sHjOz+Q== X-Google-Smtp-Source: AMsMyM6VtLTeGYSXsL6Ro3gC8gkszOK2+Cjl0KViNXychOWaLiDIqn26ITH/JYsmSRn3aX4X3qwIeQ== X-Received: by 2002:a05:6a00:1391:b0:56d:2b6f:57b3 with SMTP id t17-20020a056a00139100b0056d2b6f57b3mr23293181pfg.56.1667416932256; Wed, 02 Nov 2022 12:22:12 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id 85-20020a621658000000b005609d3d3008sm9054723pfw.171.2022.11.02.12.22.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Nov 2022 12:22:11 -0700 (PDT) Date: Wed, 2 Nov 2022 12:22:11 -0700 From: Kees Cook To: Nathan Chancellor Cc: Chun-Kuang Hu , Philipp Zabel , dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Nick Desaulniers , Tom Rix , Sami Tolvanen , llvm@lists.linux.dev, linux-kernel@vger.kernel.org, patches@lists.linux.dev Subject: Re: [PATCH] drm/mediatek: Fix return type of mtk_hdmi_bridge_mode_valid() Message-ID: <202211021222.1E8A8BCB43@keescook> References: <20221102154712.540548-1-nathan@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20221102154712.540548-1-nathan@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221102_122214_403642_EC404522 X-CRM114-Status: GOOD ( 15.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Nov 02, 2022 at 08:47:12AM -0700, Nathan Chancellor wrote: > With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG), > indirect call targets are validated against the expected function > pointer prototype to make sure the call target is valid to help mitigate > ROP attacks. If they are not identical, there is a failure at run time, > which manifests as either a kernel panic or thread getting killed. A > proposed warning in clang aims to catch these at compile time, which > reveals: > > drivers/gpu/drm/mediatek/mtk_hdmi.c:1407:16: error: incompatible function pointer types initializing 'enum drm_mode_status (*)(struct drm_bridge *, const struct drm_display_info *, const struct drm_display_mode *)' with an expression of type 'int (struct drm_bridge *, const struct drm_display_info *, const struct drm_display_mode *)' [-Werror,-Wincompatible-function-pointer-types-strict] > .mode_valid = mtk_hdmi_bridge_mode_valid, > ^~~~~~~~~~~~~~~~~~~~~~~~~~ > 1 error generated. > > ->mode_valid() in 'struct drm_bridge_funcs' expects a return type of > 'enum drm_mode_status', not 'int'. Adjust the return type of > mtk_hdmi_bridge_mode_valid() to match the prototype's to resolve the > warning and CFI failure. > > Link: https://github.com/ClangBuiltLinux/linux/issues/1750 > Reported-by: Sami Tolvanen > Signed-off-by: Nathan Chancellor Reviewed-by: Kees Cook -- Kees Cook _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel