Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp47158pxf; Wed, 24 Mar 2021 20:32:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9HUBOGVB7IEEnI4l0gyYSNWiEZjBIQ18DD8jMg2Wz6BxB0UnGtjS4Cynpma5oIwEjX9DX X-Received: by 2002:a17:907:75d9:: with SMTP id jl25mr6880486ejc.452.1616643158639; Wed, 24 Mar 2021 20:32:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616643158; cv=none; d=google.com; s=arc-20160816; b=CFnqDF0O8Ux39MF3LZACyzd/xVIRwDF3+E8sB0ZfAqwO1/vCUJ8Z3AviFyK8uu9GUZ COuMyTGsqKBrpVGh7geqYIElPpBze4GECBAP7CBIU4tBitR99xFpY5YYcYWNfr+1KzJ4 zLrGNCz/L6RpPpOxIuPiObA/bxz/l2oqP7n4IWSECYEqBago0sYnh7S4xMPGkcy8ktTg 8HXdyB/0stYZLflkUg7cGDn15HC7dNSsqCc8lKfuyq3UuKPrmW0d4gTPxh+UyEf8EYZN 7lPXv2BKdEMt2DPgEzVfuqAtW3JKSkpLE7nMytXqp0xPrUH/Ji8k9pvLjSWqWK8xkT9U jzZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=yjhN2o4D3D5cmTUfZsR0LyLCAl4RHtBYpnuqfRgNGNU=; b=Ht48D8GLdOzgcB5HI7NqbzpD72o5UHkHwDN/lZLkFl6bGwJwGoF2GZHQdtP08omd45 6w2+R6o+SiRORLWlGgkGndCdYwB5NW1QZrehP7d/NZ9e3Ci0pUUK38OHnC4GAZgXhtFz teQiw4hKjQVgGIcRqaEw1WKB0IiaAmgnbw9nxwMubYic1zrWUSywa2vvwa6FaokupRBV JvCU4rhMFw6r+a226ZUj96oS1aa14dDsUF3WBtxpjjjJmD7kJBJc5PdT9MZNU9dBVY+2 bHh1kgV+St0PCxJjFoDH/M58gIzk69W10wPeKPjXjOuiCx60+t0Tcg4aNaPIn90DeA0t NEtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=M1eCd+1d; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p9si3193109edh.186.2021.03.24.20.32.16; Wed, 24 Mar 2021 20:32:38 -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=@google.com header.s=20161025 header.b=M1eCd+1d; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235337AbhCXWfR (ORCPT + 99 others); Wed, 24 Mar 2021 18:35:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235280AbhCXWep (ORCPT ); Wed, 24 Mar 2021 18:34:45 -0400 Received: from mail-vk1-xa31.google.com (mail-vk1-xa31.google.com [IPv6:2607:f8b0:4864:20::a31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E29AC06174A for ; Wed, 24 Mar 2021 15:34:45 -0700 (PDT) Received: by mail-vk1-xa31.google.com with SMTP id j15so5837719vkc.1 for ; Wed, 24 Mar 2021 15:34:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=yjhN2o4D3D5cmTUfZsR0LyLCAl4RHtBYpnuqfRgNGNU=; b=M1eCd+1dFlwux5POF+d5odHsJUJpYb7tAp9dKy3MFjj158OFkg+1g6gV3XvSXePAcx cuPALrN0wgKFGtXtv9sJk2cQjNApqNoFFObwIeqZfq5AhtjWpzUs12Rlwo8wvs0T1nt+ 6Uu6qJ6aVDSsQFcCVSzxhKewS5BxEAPiOhI4Ge0pFVCAurb/i7HVKSadO7lCCjHTPnwb ewE4o3eNJW0qEJnHlBmFtgpSXl7h8eKgEnwWKrBYHdV8292Eo9b3KrrD4xLQs28HWIO3 wlKg1KljYG89tAwEFiU9xb0B35i7ndhGPmAu3vlyZk7SsqZniRTDWZoioNRCcY5gpo2k cA6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=yjhN2o4D3D5cmTUfZsR0LyLCAl4RHtBYpnuqfRgNGNU=; b=MifDPH25kft4I0X3uvk4zWH39GgowQDaT0lrhAl/YvdkXdYwoKisjkskdWVHu6CByI Wc0Gj8JHf2O4t2HYCqBoTxbqpuxKClzcHzVnqFHDhpeMhogFn0gKY+Y1iiUmGN5lZV2D RPFhKno1wKw8l26xscVwNZt/ZREPczdtKX2+XwASevkbM7EPYzrRVhSFuzokRfMGRbiq JhV9DzMwmzgD7lulKrs2+kaObEjE3jge+96KHQIKu03voM/Qj9Qk4Prg5JlIyEb3bEFR egvFzLrOD8pYNtbxSks67CO3XF3azbWk9ylTmhcZcYVoBwGFhNmnZu9XisijlLHBYwDO JYDw== X-Gm-Message-State: AOAM531R5EACjzoKydzld1UdQWevsmVD3MaOdhFFKVWWnZsSnP2QJCrQ MUERGfnpVhNf7gjpfa0NigPZ1hRzpxWR9cjIbuhzog== X-Received: by 2002:a1f:2d09:: with SMTP id t9mr3589700vkt.3.1616625284423; Wed, 24 Mar 2021 15:34:44 -0700 (PDT) MIME-Version: 1.0 References: <20210322170711.1855115-1-arnd@kernel.org> <20210322153214.25d869b1@gandalf.local.home> <20210322172921.56350a69@gandalf.local.home> <0f4679d6-44a4-d045-f249-a9cffb126fd4@rasmusvillemoes.dk> In-Reply-To: From: Sami Tolvanen Date: Wed, 24 Mar 2021 15:34:33 -0700 Message-ID: Subject: Re: [PATCH] static_call: fix function type mismatch To: Rasmus Villemoes 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Sami