Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1592365ybt; Sat, 27 Jun 2020 13:13:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpvozf+EWXr4IiD58rKbI6jJeADq6LN/oc8pzo9pPQ/o5w7mRmqzQo43iX4YUHGQ5cEIa6 X-Received: by 2002:aa7:d283:: with SMTP id w3mr10152273edq.262.1593288796212; Sat, 27 Jun 2020 13:13:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593288796; cv=none; d=google.com; s=arc-20160816; b=QgbqeTRBd9BI+tuxwgW2YW+R509ytshfFx1EsLTo+CHwlIIAwrSrXZ1I98g0SD8Jim UEHRtS9dLgBVbVwuIdzwyX50+9hOO97lQ0MsG1rRhCxbsW4Gix6Cy3Ldr46hxZzq4NXC tA5w5zNrv5Hi0nhbFaRXnPFSFoGYXmPWP6736Np5yiPaDmLL5xkjOJ0ng5Hqn+Zr5drv jl4iVyvU4hv4sG98aG1DkOOVjpL97migYGmxyh6HFAr+khk4NxZRAI27aZmyNSQ1xIDl r56+vUIjZCoxmf+TAFeyeffybnweeKuDfuPUDvw8cZIAyfIO9oiTg9D2azfMdLZGDo+X FgOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:from:references:cc:to:subject:dkim-signature; bh=AA0rDOWvut+jSjqLb8a6XwXisolSy++vm+xC3PN1KvU=; b=xFrZw8omqA4QGy5Hb22GC2y1yJF6xtUoenlnCs3VWdj4lwAG4w99Bd2Dj3wGE6yhIL 5b47tm1qyZnRrs3JFwg/naXxfq5Mbst6dDcxiLijFykJRMirOterXiLOxBuuTO0cQUXA Dj8LfU6KsXyhukACiqFP8PzqX2yPGZL+YU1hf+fuU8p0572xyZi7QbrNhbCM5QRo8Czm RiSaW2OFY4laPuTosfsulS90RXc6WpSKeacFHuZRPeuzDMx445povlq3QoqQYRHKrm+j oUIXzALwdyis65zVN4Rju7s6qxUgB16mxJt7bCcLkH+EkA2LZRHuIWiBrly3ESSUT/Ng KGpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=Hijh+mws; 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 gt5si12224112ejb.679.2020.06.27.13.12.53; Sat, 27 Jun 2020 13:13:16 -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=@gmx.net header.s=badeba3b8450 header.b=Hijh+mws; 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 S1726691AbgF0UKf (ORCPT + 99 others); Sat, 27 Jun 2020 16:10:35 -0400 Received: from mout.gmx.net ([212.227.17.22]:37841 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725975AbgF0UKe (ORCPT ); Sat, 27 Jun 2020 16:10:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1593288581; bh=0xRFBPnhnaPrlHc1tRYH+09EADTZE+3Mw2WcK+6MPMA=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=Hijh+mwszlEaeRAwzlRJz3k+6Zcgg+7Z2pgdvcjD8nqCqpSbSnjnlsfVp4+jkoRx1 6G5Iokt/9kjDqfodRAjdTwActu90pnedpp7A0kmiVZBtz37r5IkNu5syvVeuf/Wz2B GXQpwxVeHflbGTReLVAg3w/Yz+ZnBFwCbM5Uu+sg= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.20.60] ([92.116.164.11]) by mail.gmx.com (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Mt79F-1j0LHg2wvZ-00tRKl; Sat, 27 Jun 2020 22:09:41 +0200 Subject: Re: [PATCH] parisc/kernel/ftrace: Remove function callback casts To: Oscar Carter , Kees Cook , Steven Rostedt , Ingo Molnar , "James E . J . Bottomley" Cc: kernel-hardening@lists.openwall.com, linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org References: <20200627134348.30601-1-oscar.carter@gmx.com> From: Helge Deller Autocrypt: addr=deller@gmx.de; keydata= mQINBF3Ia3MBEAD3nmWzMgQByYAWnb9cNqspnkb2GLVKzhoH2QD4eRpyDLA/3smlClbeKkWT HLnjgkbPFDmcmCz5V0Wv1mKYRClAHPCIBIJgyICqqUZo2qGmKstUx3pFAiztlXBANpRECgwJ r+8w6mkccOM9GhoPU0vMaD/UVJcJQzvrxVHO8EHS36aUkjKd6cOpdVbCt3qx8cEhCmaFEO6u CL+k5AZQoABbFQEBocZE1/lSYzaHkcHrjn4cQjc3CffXnUVYwlo8EYOtAHgMDC39s9a7S90L 69l6G73lYBD/Br5lnDPlG6dKfGFZZpQ1h8/x+Qz366Ojfq9MuuRJg7ZQpe6foiOtqwKym/zV dVvSdOOc5sHSpfwu5+BVAAyBd6hw4NddlAQUjHSRs3zJ9OfrEx2d3mIfXZ7+pMhZ7qX0Axlq Lq+B5cfLpzkPAgKn11tfXFxP+hcPHIts0bnDz4EEp+HraW+oRCH2m57Y9zhcJTOJaLw4YpTY GRUlF076vZ2Hz/xMEvIJddRGId7UXZgH9a32NDf+BUjWEZvFt1wFSW1r7zb7oGCwZMy2LI/G aHQv/N0NeFMd28z+deyxd0k1CGefHJuJcOJDVtcE1rGQ43aDhWSpXvXKDj42vFD2We6uIo9D 1VNre2+uAxFzqqf026H6cH8hin9Vnx7p3uq3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5MaU ou0ZH9LCDjtnOKxPuUWstxTXWzsinSpLDIpkP//4fN6asmPo2cSXMXE0iA5WsWAXcK8uZ4jD c2TFWAS8k6RLkk41ZUU8ENX8+qZx/Q== Message-ID: <97375269-f6f1-6157-c8a8-3b925232f00c@gmx.de> Date: Sat, 27 Jun 2020 22:09:40 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200627134348.30601-1-oscar.carter@gmx.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:ijfqLiA+RCGLQiCBZppckhhgNlNUWEsBwLIIegBt/vFVeox2CJL 6v1lNvnCaxVKABnlNGkZFB+o6xaDKeSnC76HrYrxX4pzgVUJBa3FJCKAg09EnkGNy7tWlhd 3NXe4tjcwgCrC20XGpW0Ysnqpm9x50nC36MlfY3IsDJXMBRraZ2m1wwnnyE16+WoPJevcOe w7ciIRlz9UoEGjh9U2F5Q== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:gW/zsCM3uFA=:E+UYYiBJkNhlFVVyunILvs vBOAaQZ1vErTvEJDPymkL0EEHZ1JrxZc2XBn07oTWvolQZe3M9dJeupeybT06FJBvzavGFT7w DRNdDWnRtLXX/eNTi8+Z9g3vvS8ZRdScAPT5WEdT1h6MhPzmRwJcz8lvIpOpg3iycPTs/6UZb tOodBD4nQgXOAIW+Q93O9+SBtHXqYd3HU1pDcHSWsxrnKqRps01e6TTNaI+frHuLyDfaNZvHh x44fmPYYgBoSbjmKNvFXoyrpY2fvqL5UA8C7NBdqVMP4Pvg70wjMdt+4jXyQ0QGwTRiVk4BIU YDvtqC/FBeosQhKXuo40dlokdORSMkc06hbeWLsjaqqjeXLez4ibdYa4XREgLrbfOt3TmzRFs MEFdlnDFK/V6fTG4txTyu+22JODHuxCOGcFnuushhwczory54IcTjuIPYIxTixky0P49JQHZj c58AMa2stWqj5aIoUdSHhQF0DyRNc4WoUOb5S1e+/WtZj63wy2XHlkM4ZAvB9zLhM6+8UP9iN QezZvSZBjaXMJrSCtv1hC6JAsiIUQKU7KpjCGpnRlvX9J/Ogyr4XmuqH+1cQmMvyDrIoEUnla gT03Ilsd//laH4f49LgM17MJN1oArJZBigEhu+Q7cJmrgarL3UBBx4AlHVOa5olfBZ76MOh+q ORKrdekZ7FHs6fDim0gQhuMkz5+Hv6MWFTti4D9kqyDOrW28cYIjMWpgRVJPEDWBCBD+OynDS N/HcR/WbMSQxZiECoFOJZgwJUm8+2htVmbv18addLsJmSw6PzRnZA0Ygshjgt1TrNwEGqnfCp cpJ1Iy1wltLRMT6IluRaeko9fsftIAkrNpbUZZoraamOpU/I2YQyGxk+HiWpLYs76GBujBNUe XiaGRFQTXdKKG6piFCzA31OtZa8odI3pmavXKeJhVqLx0y3niMb2aw8e7jzmoMJq6VXg9QOdB XGXD9bn8q1Og1B4h97mFPzzP94dVuod47thTTlXeIgRjP2KTZHaDNXRokn+J3j1TZeK/rJ3e0 jyOf/3S8kdRu7KVgqoIFsum43lcb8U1JoTPXBjF7Mxzy8H4NxgmrA5Be+X2SgbF0fopxoY6ch Dnlvqf8zTq5ekUKUPMmV1g2JXAs3N5fgBdTAJA2P1+uJ8JRfXkVe2sc2ZvWc7C9R1eLUQ72X/ Z0QQ3v69axpGKCvsQ40Sw1VXsnWXsEE9trWIqm1YeM8gXhijI28isQVdj8TvbJuFrYLdlWWfK y13CG6itfPwPygxsk Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 27.06.20 15:43, Oscar Carter wrote: > In an effort to enable -Wcast-function-type in the top-level Makefile to > support Control Flow Integrity builds, remove all the function callback > casts. > > To do this remove the cast to a function pointer type in the comparison > statement and add to the right and left operand a cast to unsigned long > type. This can be done since the comparison is against function address > (these operands are not function calls). On some architectures (namely ia64, ppc64 and parisc64) function pointers actually refer to function descriptors, which in turn point to the real function address. The compiler usually takes care of such comparism. That said, casting to "unsigned long" might break this... > Signed-off-by: Oscar Carter > --- > arch/parisc/kernel/ftrace.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/parisc/kernel/ftrace.c b/arch/parisc/kernel/ftrace.c > index 1df0f67ed667..86b49a5fc049 100644 > --- a/arch/parisc/kernel/ftrace.c > +++ b/arch/parisc/kernel/ftrace.c > @@ -64,7 +64,7 @@ void notrace __hot ftrace_function_trampoline(unsigned= long parent, > function_trace_op, regs); > > #ifdef CONFIG_FUNCTION_GRAPH_TRACER > - if (ftrace_graph_return !=3D (trace_func_graph_ret_t) ftrace_stub || > + if ((unsigned long)ftrace_graph_return !=3D (unsigned long)ftrace_stub= || Untested, but maybe better use: dereference_function_descriptor(ftrace_graph_return) !=3D dereference_function_descriptor(ftrace_stub) ? Helge