Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp552669pxb; Wed, 18 Nov 2020 11:01:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJxtAzjwEawsoFobDY7/Y6zWtUY7h4NAqxEJkfOxRyt2ABPenMkv1OJiFSw7n7b1kPml7k8N X-Received: by 2002:a17:906:37d2:: with SMTP id o18mr26064156ejc.379.1605726090936; Wed, 18 Nov 2020 11:01:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605726090; cv=none; d=google.com; s=arc-20160816; b=BqSslzyCzfMt8SjnMRJlkhLbpMvICsH7VS59zpnY17J07c2jpPhk1mG97XlrZMgv9b ae7lMzSNU9Qi+lFl7Lz0ohRy3OyMkuBuvEeOfeJYi/7QyBeV4wBgw/G8UUyDyEIiPaOp Secf5CGlUZf81D42TEmReQHiqeDzcewDH8+Ma0TuC9j3tyNw9cHRpO3yCE64H3GruchK lpMLYaIjZwDoTxF4FQn+sdJ5dzGt7Hw4cPhKgiCIY6LiilDG2FWxiYdkFAT0vM79Gg88 mIhvt/5HsDC3azISebEQng7lHwJv8RnTQaFDmepbGgecbd7R9kdrZ7VI/36hc+XDv7JZ vVIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=eyW0E3hIFsvm4OKz+CQ4gB9hrFC/GKFvCQuCbWht4a4=; b=ILP6w3kPN+UELA1wpn91RxqCDSwADIPZBYdXUzVfjq+CqasxFujcb8uAUhCNzuX6+W oz/4/tt4tu/v5Wz+7l3vFishcTXhJDNY9rueoVi+vBb9PpCQqXN6Y+i/jiLdnvsT8q4G pEdDjMT6Xx4gR1MRu3ggP/sq5ZhPBpD/25xJ7Gx85ieThrmSriu0xYx+6gaZgvx4F7Uo wlVmtVLHM3AdY2dAEMnBqcXRABmH9xCtzFIZHqNyrMhWUTAWWPKAhZA4NSc0k8cSEQrj 5STjACcsfKO8wDufKboVh/cDcAEXOycc0wyoik6FcPAltei4hvPalWK3jTmijjDSpUfl etXA== ARC-Authentication-Results: i=1; mx.google.com; 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 bc3si5566439edb.258.2020.11.18.11.01.04; Wed, 18 Nov 2020 11:01:30 -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; 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 S1726938AbgKRS63 (ORCPT + 99 others); Wed, 18 Nov 2020 13:58:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:58582 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726721AbgKRS62 (ORCPT ); Wed, 18 Nov 2020 13:58:28 -0500 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 900DA20639; Wed, 18 Nov 2020 18:58:25 +0000 (UTC) Date: Wed, 18 Nov 2020 13:58:23 -0500 From: Steven Rostedt To: Florian Weimer Cc: Segher Boessenkool , Nick Desaulniers , Peter Zijlstra , Sami Tolvanen , Mathieu Desnoyers , 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@vger.kernel.org Subject: Re: violating function pointer signature Message-ID: <20201118135823.3f0d24b7@gandalf.local.home> In-Reply-To: <87o8jutt2h.fsf@mid.deneb.enyo.de> 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> <20201118121730.12ee645b@gandalf.local.home> <20201118181226.GK2672@gate.crashing.org> <87o8jutt2h.fsf@mid.deneb.enyo.de> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 18 Nov 2020 19:31:50 +0100 Florian Weimer wrote: > * Segher Boessenkool: > > > On Wed, Nov 18, 2020 at 12:17:30PM -0500, Steven Rostedt wrote: > >> I could change the stub from (void) to () if that would be better. > > > > Don't? In a function definition they mean exactly the same thing (and > > the kernel uses (void) everywhere else, which many people find clearer). > > And I think () functions expected a caller-provided parameter save > area on powerpc64le, while (void) functions do not. It does not > matter for an empty function, but GCC prefers to use the parameter > save area instead of setting up a stack frame if it is present. So > you get stack corruption if you call a () function as a (void) > function. (The other way round is fine.) I wonder if we should define on all architectures a void void_stub(void), in assembly, that just does a return, an not worry about gcc messing up the creation of the stub function. On x86_64: GLOBAL(void_stub) retq And so on. -- Steve