Received: by 10.213.65.68 with SMTP id h4csp427890imn; Tue, 27 Mar 2018 01:51:54 -0700 (PDT) X-Google-Smtp-Source: AG47ELspkGtOSlxxNk+bkrDLOeg8THOtQeM/ny0pNIhwvdc+3udoAcrJfV01CgzEoD/+0CABTzvc X-Received: by 10.98.210.7 with SMTP id c7mr32143086pfg.92.1522140714121; Tue, 27 Mar 2018 01:51:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522140714; cv=none; d=google.com; s=arc-20160816; b=ruJXxZt8siHW+/RJrnZ+mwKXm0v/0rpfNjM34PrNXcX84nm4mO3IJC0JQI+mpBTbjo 5oWai3UqvmTPCDWBcG+GgS3pcL1JWvasMa3TrEHLMsGCvufJ67zuvV/EMtnVdXG+GwNs Repret4hySDdAQOMP7cdKI7+1x+uOJ7GKQIgi9ZTCIO0tnGiAX7JV1+0gExvYxEj3GLI nga2NjB76iA/7AkA2LT985A3rGYPKmAMJaKWwaZdYwtOrQvj9trXzb2iiAABbnIs/aNk /5S/3bmJcxF/Xp0rFu6ix5lht7GFzIXHqNfakAUBvlgWC2b17O3fmXOfcOlbWg2lLYgf zMuw== 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:mime-version :message-id:date:references:in-reply-to:subject:cc:to:from :arc-authentication-results; bh=JeFeSkOfZQEDtGo/nIQHj3jmgMsVNJqbp6svrXInHEg=; b=TMNW1eojdcM/1hDnjaHaLQpQSfXJO+xDzgymPI/erVrWqf5t4SQ32awTthtSEii50A wD7Fb0N9T/opZmWpK7h1QrpRyEhCO6ZqhL6rCbt/M0NhUVItPNDA7i2j8cicdolNWAbP meKd/RO1UrYCgbFRfnjG7aRJw8oe/GHa1CIsL6psTZKf/wspSMA5cz4IOVJgICwE3LEr 3LSP8OYv96Hp9j56NbgpMKMiLSV217xqIYwMS2hq2CffGt+tv5tREwlefu1uxAsq+Lt0 q3BCoZzln7NFD9dEA0P+fpj6xLiHZp2l9u8/t1SXZoCHCxXCZEl4mNBuHQ/1yX7BrI2S 9tug== 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 22si562401pgg.390.2018.03.27.01.51.39; Tue, 27 Mar 2018 01:51:54 -0700 (PDT) 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 S1752425AbeC0IuQ convert rfc822-to-8bit (ORCPT + 99 others); Tue, 27 Mar 2018 04:50:16 -0400 Received: from ozlabs.org ([103.22.144.67]:54375 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752087AbeC0IuN (ORCPT ); Tue, 27 Mar 2018 04:50:13 -0400 Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 409Ppp4QmLz9s1R; Tue, 27 Mar 2018 19:50:10 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au From: Michael Ellerman To: Mathieu Malaterre Cc: Benjamin Herrenschmidt , Paul Mackerras , Jiri Slaby , linuxppc-dev , LKML , Al Viro Subject: Re: [PATCH 17/21] powerpc: Add missing prototype for sys_debug_setcontext In-Reply-To: References: <20180225172236.29650-1-malat@debian.org> <20180225172236.29650-18-malat@debian.org> <87muzoglga.fsf@concordia.ellerman.id.au> <878tb2etva.fsf@concordia.ellerman.id.au> Date: Tue, 27 Mar 2018 19:50:09 +1100 Message-ID: <87h8p1kim6.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 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 Hi Mathieu, Mathieu Malaterre writes: > On Thu, Mar 8, 2018 at 11:36 AM, Michael Ellerman wrote: >> Mathieu Malaterre writes: >>> On Sun, Mar 4, 2018 at 11:54 AM, Michael Ellerman wrote: >>>> Mathieu Malaterre writes: >>>>> In commit 81e7009ea46c ("powerpc: merge ppc signal.c and ppc64 signal32.c") >>>>> the function sys_debug_setcontext was added without a prototype. >>>>> >>>>> Fix compilation warning (treated as error in W=1): >>>>> >>>>> CC arch/powerpc/kernel/signal_32.o >>>>> arch/powerpc/kernel/signal_32.c:1227:5: error: no previous prototype for ‘sys_debug_setcontext’ [-Werror=missing-prototypes] >>>>> int sys_debug_setcontext(struct ucontext __user *ctx, >>>>> ^~~~~~~~~~~~~~~~~~~~ >>>>> cc1: all warnings being treated as errors >>>> >>>> This one should actually be using the SYSCALL_DEFINE syntax, so that it >>>> can be used with CONFIG_FTRACE_SYSCALLS. >>>> >>>> See eg. our mmap: >>>> >>>> SYSCALL_DEFINE6(mmap, unsigned long, addr, size_t, len, >>>> unsigned long, prot, unsigned long, flags, >>>> unsigned long, fd, off_t, offset) >>>> { >>>> return do_mmap2(addr, len, prot, flags, fd, offset, PAGE_SHIFT); >>>> } >>>> >>>> >>>> We probably still need this patch, but I'm not entirely sure because the >>>> SYSCALL_DEFINE macro does all sorts of shenanigans. >>> >>> I see. Could you please drop this patch then. The patch does not look >>> that trivial anymore. I'll need to dig a bit more on how to do the >>> syscall stuff with a 7 params function. >> >> Ergh, yuck, seems we're the first suckers to need do that. >> >> I think I'll take this patch for now, it's still good for now at least, >> and then the SYSCALL_DEFINE stuff can be an addition. > > Just to close the loop (for later reference). Here is what Al Viro > told me about this function > > [begin quote] > int sys_debug_setcontext(struct ucontext __user *ctx, > int ndbg, struct sig_dbg_op __user *dbg, > int r6, int r7, int r8, > struct pt_regs *regs) > > can't be converted to SYSCALL_DEFINE... not because it's a 7-argument > syscall (it isn't); the problem is that the last argument here does > *not* come from userland. What it really is trying to be is > 3-argument syscall: > SYSCALL_DEFINE3(debug_setcontext, struct ucontext __user *, ctx, > int, ndbg, > struct sig_dbg_op __user *, dbg) > with no dummy r6/r7/r8. The thing is, ppc dispatcher combines the > "pass 6 arguments" and "pass pt_regs *" by passing both. > > debug_setcontext(), swapcontext(), sigreturn() and rt_sigreturn() are, > AFAICS, the only ppc syscalls that make use of that argument. All of > those are relying upon regs == current_pt_regs() == current->thread.regs, > [...] > But in any case, these are not 7-argument syscalls - debug_setcontext(2) > and swapcontext(2) are 3-argument and sigreturn()/rt_sigreturn() have > no arguments at all. > [end quote] Awesome follow-up thanks. I should have realised that's what the code was doing, but I didn't look closely enough. Apologies to Al for having to stare at our horrible signal code again :) We should really clean all that up, I can't see any reason those syscalls aren't using current_pt_regs(). That would then mean we could use SYSCALL_DEFINE. I wrote that down so we don't (might not) forget: https://github.com/linuxppc/linux/issues/131 > Sorry about the wrong analysis in the number of arguments count. I > believe commit 0d60619e1c0ca (powerpc/next) should be just fine for > now. No worries. cheers