Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp428856pxb; Wed, 18 Nov 2020 08:04:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJy5HB7JeCtwE2AQLHTD3YqzftU0GKKcuaKyJH2U+PLTkeQL1CVEIrQU8bmXdZZaa3C8h3ty X-Received: by 2002:aa7:c499:: with SMTP id m25mr25760329edq.237.1605715495761; Wed, 18 Nov 2020 08:04:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605715495; cv=none; d=google.com; s=arc-20160816; b=jjajKzC1aoFvEa1r6mWEZdatrlr/cX/ZTA+x4damORg2v/RRucWV9u002/Rl/9hDel WDff3/9+z/JQN2ET3eo9+bnADklA6sxQp0AAhUqmJE9/y6ufi4JTjYBNveHaMfDYDOn7 Zkq7izgXSw4fnBbdfMgnFYFUDCBlx98tqK6yv0dDBo/l70M8PcAdEv2RYfAJcxxcnAAC LtUurA3xy+/G8IHiG7lKkV/MNNOzvtnFlRr2rmJ2OW35yUSDt9GYl4T290gj3Bx9EtpF +sHxC4Lx3NKWw9mqxtM8wTLhZojq+IKEvYbADx9j/llrmNSTx58wZMY6Sh02NkA717Ao I3sQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:thread-index:thread-topic :content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:dkim-signature:dkim-filter; bh=k0a1RGHOSG7fsNrb43ytVhAyD3oE/dKDtNyXyy8B/xU=; b=lx39c0JUneHlil67GIPM1BiLpQfoUF513muSCKc4ktx87VcWFDJefJf+t2uqcGZvzU RdSveJmnmFeiO6PSz46WuMfV4+t3gSmzgQY1UlAtplZ6DGOrtPzooK/YubsORfAp78Dk 0tMz1S6cmpybMT5qz31zPNXzkHCm+gbLs5FroCv/Q2+EuWEDs9b0kEnw43KcvnvZsbTD 7ZOHoX2leLnTwBOfKA/3VdKL0iikjK8IVIR96FPREVauZ5K3MH34IXTjnLtzD7RcsJL9 r8zy6wegsx3H9AMe8EblhIP3+spAxI4ZIkiovjFCKHlWXYihyJXmE8iGciEI2hK7yKgw 1h9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b=Qbs2RxYP; 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=efficios.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n25si2624098eda.190.2020.11.18.08.04.31; Wed, 18 Nov 2020 08:04:55 -0800 (PST) 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=@efficios.com header.s=default header.b=Qbs2RxYP; 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=efficios.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726601AbgKRQB2 (ORCPT + 99 others); Wed, 18 Nov 2020 11:01:28 -0500 Received: from mail.efficios.com ([167.114.26.124]:44436 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726496AbgKRQB1 (ORCPT ); Wed, 18 Nov 2020 11:01:27 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id A801B2ECB82; Wed, 18 Nov 2020 11:01:25 -0500 (EST) Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id ZwJ7XCNKGbub; Wed, 18 Nov 2020 11:01:25 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 4FBAC2ECB05; Wed, 18 Nov 2020 11:01:25 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 4FBAC2ECB05 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1605715285; bh=k0a1RGHOSG7fsNrb43ytVhAyD3oE/dKDtNyXyy8B/xU=; h=Date:From:To:Message-ID:MIME-Version; b=Qbs2RxYPZHVq3437Ui3yAsk8VLrqTSOLM6tl8uIbE1D+3t4YO2Lzq3YRH8NDzfHvP Y7wmgNkD2kbQTYE7CrMESIGdDzNS2OYcviVTNFj9lO8FzleB+aAwXymiLaY248KdBP 4l/jvyiHO91lZYWLaKOcS+k4MjSMBv4ddr2cLNCASbYr/oPZWG++KoEJByvG/RNNBr qgVNXbzRuXBxGwGamciMRHLOkRpbxBDO27twHHbEdQxM2CvTifblwcTzCnNfekT4Ov q2eYPl+HXVOqbn2m/5gfqWm3d0kOsctj6Jc02dcCFzmQgQawcEQFtNS5FLetkN0h9Z 0EM+PrO/Uq9yw== X-Virus-Scanned: amavisd-new at efficios.com Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id jkAbwSowY55M; Wed, 18 Nov 2020 11:01:25 -0500 (EST) Received: from mail03.efficios.com (mail03.efficios.com [167.114.26.124]) by mail.efficios.com (Postfix) with ESMTP id 398402EC75B; Wed, 18 Nov 2020 11:01:25 -0500 (EST) Date: Wed, 18 Nov 2020 11:01:25 -0500 (EST) From: Mathieu Desnoyers To: rostedt Cc: Peter Zijlstra , linux-kernel , Matt Mullins , Ingo Molnar , Alexei Starovoitov , Daniel Borkmann , Dmitry Vyukov , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , John Fastabend , KP Singh , netdev , bpf , Kees Cook , Josh Poimboeuf , linux-toolchains Message-ID: <1762005214.49230.1605715285133.JavaMail.zimbra@efficios.com> In-Reply-To: <20201118090256.55656208@gandalf.local.home> References: <20201116175107.02db396d@gandalf.local.home> <47463878.48157.1605640510560.JavaMail.zimbra@efficios.com> <20201117142145.43194f1a@gandalf.local.home> <375636043.48251.1605642440621.JavaMail.zimbra@efficios.com> <20201117153451.3015c5c9@gandalf.local.home> <20201118132136.GJ3121378@hirez.programming.kicks-ass.net> <20201118090256.55656208@gandalf.local.home> Subject: Re: violating function pointer signature MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [167.114.26.124] X-Mailer: Zimbra 8.8.15_GA_3975 (ZimbraWebClient - FF82 (Linux)/8.8.15_GA_3975) Thread-Topic: violating function pointer signature Thread-Index: Obd4w6s/wcVB2Hvi8sMQ1l1Yr980kA== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- On Nov 18, 2020, at 9:02 AM, rostedt rostedt@goodmis.org wrote: > On Wed, 18 Nov 2020 14:21:36 +0100 > Peter Zijlstra wrote: > >> I think that as long as the function is completely empty (it never >> touches any of the arguments) this should work in practise. >> >> That is: >> >> void tp_nop_func(void) { } > > My original version (the OP of this thread) had this: > > +static void tp_stub_func(void) > +{ > + return; > +} > >> >> can be used as an argument to any function pointer that has a void >> return. In fact, I already do that, grep for __static_call_nop(). >> >> I'm not sure what the LLVM-CFI crud makes of it, but that's their >> problem. > > If it is already done elsewhere in the kernel, then I will call this > precedence, and keep the original version. It works for me. Bonus points if you can document in a comment that this trick depends on the cdecl calling convention. Thanks, Mathieu > > This way Alexei can't complain about adding a check in the fast path of > more than one callback attached. > > -- Steve -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com