Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp47687pxf; Wed, 24 Mar 2021 20:33:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5rXhkx9dsTMTsUeCiLE3MWciQh1tVZw6FGis1yh5IB4/W/6kpoJHLN9BKuLAnlAUIM8I6 X-Received: by 2002:a17:907:2d9f:: with SMTP id gt31mr6996446ejc.233.1616643233068; Wed, 24 Mar 2021 20:33:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616643233; cv=none; d=google.com; s=arc-20160816; b=NlORui3j9BjOm2bwsSryTNQeC5w1Hx+mT/YfeGAJZy8Y9NNt7xK9P4kKpoCwPJwQBV PSZgWe6gbMnXsJ16KPIE3MN9uZQE117L0qkBREyhbQ8l2MxhfUsrOiXbMfaG6jz3YMab K+ENmLdy+dGN7SXoTwsEWd8Mih06nmwK8D+IltaIKbxsi+s5w6TKaTGw4bHBguKmCLi9 KitR3+d/TJUGgZS0CLIfMWIi6piGNn+B+ZGQqS1p6AZSyBcHiULeestLvj6inyzVq4p/ jbiRC0zcO7aJiZ2JI8GMRJDnnzPBNLrVbWaaPVWiFX7s1MSt5d1n2QNHyfi2Eij8EPOd LJrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=AHr083VjHOHzDz2ujRoHkPciK56RoE+YYVsaDRyaSiQ=; b=uJ0zuz3L1LNtCG+YquYlFxVhSrDEVJR9HCydnqpE5rdC3wsYO4DJR+9hIrg7enSSvW Xby6eMTjbmMwi0qgLr5ChB4lQ59dk3bN5qNQY54I2Gi/bPLhyHYcD0WgORUzbkysgx4K 5pVvw8QkZRTZ8+nXfb+ffmtTo3akkI0GxpZMw+eu2/2DrFsNHG3jjfx7eMMPNKFsoypu /W1GcJwzlWVC82EWIB6F/r4ezsm/pjGdShrxSfG1je1ta2ODMkOLyxEQWhMa+R6R/qZB RHExUN2bI3gxXMsxSwZmRjkoUodugMfrDNKQH/hXX5x093tq0FN983jJEHP9q8MNPvtb M2hA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=Vek+K7e1; 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 o22si3085723ejm.138.2021.03.24.20.33.31; Wed, 24 Mar 2021 20:33:53 -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=@rasmusvillemoes.dk header.s=google header.b=Vek+K7e1; 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 S234358AbhCXWx3 (ORCPT + 99 others); Wed, 24 Mar 2021 18:53:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234060AbhCXWx3 (ORCPT ); Wed, 24 Mar 2021 18:53:29 -0400 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C5D6C06174A for ; Wed, 24 Mar 2021 15:53:28 -0700 (PDT) Received: by mail-ej1-x62d.google.com with SMTP id b7so35576421ejv.1 for ; Wed, 24 Mar 2021 15:53:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=AHr083VjHOHzDz2ujRoHkPciK56RoE+YYVsaDRyaSiQ=; b=Vek+K7e1QLSZ/0x/6kpFsL1yBWndI2BEHUjCF1/Y5KeVlyj0qeX54HmJ790i0rLgpR v8alr48dgmUOPYORHVOg8Fpa32AuFydasSF4LPc4bcr20WGyIhix/nu0xmIUCrJsFvT1 ONW5cG3lljQPSAaKVBEau9ytkVMktMxea0WZo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=AHr083VjHOHzDz2ujRoHkPciK56RoE+YYVsaDRyaSiQ=; b=tzQ8IhLDijl1d0ChA5BjNiYLd9EIyECuxwVnawvCJbsjAVhWU9Flm1JbE8yZCIFLl7 gRDGWdArBxLSRqUISR0VhXKtsBn2KnwkeBXs0YhtcocmMLVAlvpU9k6ASHtoHax2P4OJ 2jtkJSGRurs0B+FLEW8OHsBPqbtjPkcV+8HcZQ/b9cj1qmUy+LnOqjavyyGxUxXMjUh0 eORJKfbnRwIPaZXHXB3iL78GHpWHlzcAPdTNPxI1AxKqqNTGLc53DAjPJbE4ijG1HHXO I4upHytS09Qo/Vq6wnvow3n+k+X172RQVolHLLmFbxN7XAPYyMWG2+eHTRzaym87P8Fd xAKg== X-Gm-Message-State: AOAM531vos+EOUlbS5qkt6+YDLEKEQvg+cTvRdZ1MIGrWaB9ea5xpAB8 1MiA1zakYEDFLiKHg6Spv8DjSw+eFBj2qqvL X-Received: by 2002:a17:906:d9d1:: with SMTP id qk17mr6124224ejb.52.1616626406757; Wed, 24 Mar 2021 15:53:26 -0700 (PDT) Received: from [192.168.1.149] ([80.208.71.248]) by smtp.gmail.com with ESMTPSA id p9sm1785629eds.66.2021.03.24.15.53.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 24 Mar 2021 15:53:26 -0700 (PDT) Subject: Re: [PATCH] static_call: fix function type mismatch To: Sami Tolvanen Cc: Peter Zijlstra , Steven Rostedt , Arnd Bergmann , Josh Poimboeuf , Jason Baron , Ingo Molnar , Juri Lelli , Vincent Guittot , Ard Biesheuvel , Dietmar Eggemann , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Frederic Weisbecker , Linux Kernel Mailing List References: <20210322170711.1855115-1-arnd@kernel.org> <20210322153214.25d869b1@gandalf.local.home> <20210322172921.56350a69@gandalf.local.home> <0f4679d6-44a4-d045-f249-a9cffb126fd4@rasmusvillemoes.dk> From: Rasmus Villemoes Message-ID: <2b38d13f-9f90-b94b-7de4-c924696e6a9f@rasmusvillemoes.dk> Date: Wed, 24 Mar 2021 23:53:25 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 24/03/2021 23.34, Sami Tolvanen wrote: > On Wed, Mar 24, 2021 at 2:51 PM Rasmus Villemoes > wrote: >> >> On 24/03/2021 18.33, Peter Zijlstra wrote: >>> On Wed, Mar 24, 2021 at 05:45:52PM +0100, Rasmus Villemoes wrote: >>>> Sorry, I think I misread the code. The static calls are indeed >>>> initialized with a function with the right prototype. Try adding >>>> "preempt=full" on the command line so that we exercise these lines >>>> >>>> static_call_update(cond_resched, >>>> (typeof(&__cond_resched)) __static_call_return0); >>>> static_call_update(might_resched, >>>> (typeof(&__cond_resched)) __static_call_return0); >>>> >>>> I would expect that to blow up, since we end up calling a long (*)(void) >>>> function using a function pointer of type int (*)(void). >>> >>> Note that on x86 there won't actually be any calling of function >>> pointers. See what arch/x86/kernel/static_call.c does :-) >> >> I know, but so far x86 is the only one with HAVE_STATIC_CALL, so for >> arm64 which is where CFI seems to be targeted initially, static_calls >> are function pointers. And unless CFI ignores the return type, I'd >> really expect the above to fail. > > I think you're correct, this would trip CFI without HAVE_STATIC_CALL. > However, arm64 also doesn't support PREEMPT_DYNAMIC at the moment, so > this isn't currently a problem there. Well, there's PREEMPT_DYNAMIC and HAVE_PREEMPT_DYNAMIC. The former doesn't depend on the latter (and the latter does depend on HAVE_STATIC_CALL, so effectively not for anything but x86). You should be able to select both PREEMPT_DYNAMIC and CFI_CLANG, and test if booting with preempt=full does give the fireworks one expects. Rasmus