Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp837748imj; Fri, 15 Feb 2019 07:37:58 -0800 (PST) X-Google-Smtp-Source: AHgI3IaGQ6QTqb3O06GlMbR0LFIjkimeiftY5hi/76BriiU4f5i5oeyscBUsW0nwWn4gxuA/xFnj X-Received: by 2002:a63:d709:: with SMTP id d9mr5852228pgg.157.1550245077992; Fri, 15 Feb 2019 07:37:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550245077; cv=none; d=google.com; s=arc-20160816; b=OQAg98htlKSyL+Y40BKfqNwtpv8fzPJUfjZnrkVY3dVydnNqVuRPQfKfDwj5PRG26f wv7F5qnRgqMKygan1QYuPBj1n3SL1x95A423jbxmb2PZW6rUeh8TbYvFYxT35EhrbRQr m24d8sx+mnBvSJWXAcxDHnkjqy+c+xLU/SRyrqW7Rc7tF0UISOfAXbMnnzNIsT6CuYQw BhcSPmBcna26bucatBxKNC4pBYxnod0HTv9Z0Dk+89VnLSqC+h16JjDt2l4UEhvT6Quq N2ewjj913xiypS1msV+K49mLqzKdA+lycFaElnxgXRyqH+mY57hf8jImY1URQhClV0A1 2Stw== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=ySUBDyV48kqAOwmzgJUOiAvUEf2aqMVqlfSCY2icL78=; b=TaigGST39botkI705MfI2/TYW7gJPO6yQpMbID1wTTm8HuoogdnP6dBZDdaGq9JoMf Zsw8mKSQ2Eg1L0PAUaamSy2eoD0VHGk05xw/S0xjM4V2XvPs31CEclRC7B6fg4QTM4qZ vCgfr0w/sr/eJHzNyL31uVxErTG6mLG4TuMlHLy0ED5AGSMoDX+ACI+KbUXtlUYKu5WE ychjUbxkL+5le+QZbPVlAGy9QzQvhKh/dAWBaYAhOCaERP3+gAcfYA+rCiPF7vSAhf/x pXY1tu3XsXgmWajYKkRxDLa6gWA6glB404xYH2fK30yLFZ0YF8OsJMoYBEATd0HaYZ11 HySA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v6si5590544pfv.181.2019.02.15.07.37.41; Fri, 15 Feb 2019 07:37:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404501AbfBOIqO convert rfc822-to-8bit (ORCPT + 99 others); Fri, 15 Feb 2019 03:46:14 -0500 Received: from mail-ot1-f68.google.com ([209.85.210.68]:45500 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728761AbfBOIqN (ORCPT ); Fri, 15 Feb 2019 03:46:13 -0500 Received: by mail-ot1-f68.google.com with SMTP id 32so15230348ota.12 for ; Fri, 15 Feb 2019 00:46:13 -0800 (PST) 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:content-transfer-encoding; bh=B0dPGRCNmKatrjVoIUq55VqUlKIBw5TV2xm1zcMqDZc=; b=sgMrKxkkDSifrvX9s/sQwx+gURdFkbl96UsXdpm2vsCFLaE/ZgLVjeFAO7Bsvi9FX6 FNvoawwcnG3VsyU0IUhpUTBpz4AHRAxB/V+h6px/T2AQKDoy1ADWLQ742jl89h6iBvF3 kRDFcp4LxpZVyIQj/eBoyhpcnQfUE1rPZXjURLV1x3lYnOHnHyEWQCp6W840ht7xupTP 3mdP1HRNJ0l3K7Rjuo1xM6kwInVmdCK5iSjHZ7PzeJoxZ4Dth9SK1g79iOzThlpnliIz 49TgXQr/IHgKRNntPuRb+w9nCrfgjwP3/+RlP0wJEsZwGSfLrTIoW8cflDP/p4eXGZ+s 8jCw== X-Gm-Message-State: AHQUAuaRQEIAjCmUx8ZJhNO39XvDlm6zvVa862u7bCpLcMK/v6RkQO+W 7if7RfaRFuLgB4PnRPvdZGLjjnpC9hCmBOXNO7Y= X-Received: by 2002:a9d:7841:: with SMTP id c1mr5170654otm.354.1550220372529; Fri, 15 Feb 2019 00:46:12 -0800 (PST) MIME-Version: 1.0 References: <20181208154624.6504-1-malat@debian.org> In-Reply-To: From: Mathieu Malaterre Date: Fri, 15 Feb 2019 09:46:01 +0100 Message-ID: Subject: Re: [PATCH] powerpc/ptrace: Add prototype for function pt_regs_check To: Christophe Leroy Cc: Michael Ellerman , linuxppc-dev , Paul Mackerras , Oleg Nesterov , LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 15, 2019 at 9:21 AM Christophe Leroy wrote: > > > > Le 15/02/2019 à 09:11, Mathieu Malaterre a écrit : > > On Sat, Dec 8, 2018 at 4:46 PM Mathieu Malaterre wrote: > >> > >> `pt_regs_check` is a dummy function, its purpose is to break the build > >> if struct pt_regs and struct user_pt_regs don't match. > >> > >> This function has no functionnal purpose, and will get eliminated at > >> link time or after init depending on CONFIG_LD_DEAD_CODE_DATA_ELIMINATION > >> > >> This commit adds a prototype to fix warning at W=1: > >> > >> arch/powerpc/kernel/ptrace.c:3339:13: error: no previous prototype for ‘pt_regs_check’ [-Werror=missing-prototypes] > >> > >> Suggested-by: Christophe Leroy > >> Signed-off-by: Mathieu Malaterre > >> --- > >> arch/powerpc/kernel/ptrace.c | 4 ++++ > >> 1 file changed, 4 insertions(+) > >> > >> diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c > >> index a398999d0770..341c0060b4c8 100644 > >> --- a/arch/powerpc/kernel/ptrace.c > >> +++ b/arch/powerpc/kernel/ptrace.c > >> @@ -3338,6 +3338,10 @@ void do_syscall_trace_leave(struct pt_regs *regs) > >> user_enter(); > >> } > >> > >> +void __init pt_regs_check(void); > >> +/* dummy function, its purpose is to break the build if struct pt_regs and > >> + * struct user_pt_regs don't match. > >> + */ > > > > Another trick which seems to work with GCC is: > > > > -void __init pt_regs_check(void) > > +static inline void __init pt_regs_check(void) > > Does this really work ? Did you test to ensure that the BUILD_BUG_ON > still detect mismatch between struct pt_regs and struct user_pt_regs ? > My bad, I was unaware of GCC behavior for static inline in this case. Sorry for the noise. Original ugly patch does work though. > > > > >> void __init pt_regs_check(void) > >> { > >> BUILD_BUG_ON(offsetof(struct pt_regs, gpr) != > >> -- > >> 2.19.2 > >>