From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B224C55ABD for ; Tue, 10 Nov 2020 15:40:17 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 01A472076E for ; Tue, 10 Nov 2020 15:40:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="XtgfW+13" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 01A472076E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xmission.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Subject:MIME-Version:Message-ID:In-Reply-To:Date: References:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=OkuDAF62Yz+RgsIOODQpatevJ/EgEO0GuFyFUxB90dc=; b=XtgfW+133fgsD3IEIRWjibO3y HGn28sDEd8uHJDd37JDpMRozayLmpTgvfcCXxkywEJh/azxbwCtmc9Q7PELs5wt3K5fmPXT6a1ni4 qUJjUSXshbMmAJFojYPsb6qCdKFYgXYjULUYPW9YaeV5uHw3TOY5GiJhSYMCy6vlmd4hJkztPrJBC lHVuwvpFla/hrsnokgXNNRXp0NKRWRBmOGEv3ofxTYHNvlqXI/qbvmUHhdnrq/pKVERyjaX0ez9zM CW76oD6dvUt3Hhnkf6Sos7p8GTIXEAkXjRJAxV/tUGXxDgNfXyO4oj3WSp8D/www78zvWl7USyjnz iOALujMbQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcVjS-0005nh-7D; Tue, 10 Nov 2020 15:38:54 +0000 Received: from out01.mta.xmission.com ([166.70.13.231]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcVjM-0005lx-5f for linux-arm-kernel@lists.infradead.org; Tue, 10 Nov 2020 15:38:50 +0000 Received: from in01.mta.xmission.com ([166.70.13.51]) by out01.mta.xmission.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1kcVjJ-001ycA-0Y; Tue, 10 Nov 2020 08:38:45 -0700 Received: from ip68-227-160-95.om.om.cox.net ([68.227.160.95] helo=x220.xmission.com) by in01.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.87) (envelope-from ) id 1kcVjI-0006WK-0f; Tue, 10 Nov 2020 08:38:44 -0700 From: ebiederm@xmission.com (Eric W. Biederman) To: Peter Collingbourne References: <4d826a62121153d54d7e36fc8a402c97e2106764.1604523707.git.pcc@google.com> <87lffa11sa.fsf@x220.int.ebiederm.org> Date: Tue, 10 Nov 2020 09:38:34 -0600 In-Reply-To: (Peter Collingbourne's message of "Mon, 9 Nov 2020 18:37:36 -0800") Message-ID: <875z6dte6d.fsf@x220.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 X-XM-SPF: eid=1kcVjI-0006WK-0f; ; ; mid=<875z6dte6d.fsf@x220.int.ebiederm.org>; ; ; hst=in01.mta.xmission.com; ; ; ip=68.227.160.95; ; ; frm=ebiederm@xmission.com; ; ; spf=neutral X-XM-AID: U2FsdGVkX1/qYS2D7zgHzmBolnqloWRSVcj8hZZqxIo= X-SA-Exim-Connect-IP: 68.227.160.95 X-SA-Exim-Mail-From: ebiederm@xmission.com Subject: Re: [PATCH v14 4/8] signal: deduplicate code dealing with common _sigfault fields X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201110_103848_272046_CE7876A5 X-CRM114-Status: GOOD ( 20.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Catalin Marinas , Helge Deller , Kevin Brodsky , Oleg Nesterov , Linux API , "James E.J. Bottomley" , Kostya Serebryany , Linux ARM , Andrey Konovalov , David Spickett , Vincenzo Frascino , Will Deacon , Dave Martin , Evgenii Stepanov , Richard Henderson Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Peter Collingbourne writes: > On Mon, Nov 9, 2020 at 4:41 PM Eric W. Biederman wrote: >> >> Peter Collingbourne writes: >> >> > We're about to add more common _sigfault fields, so deduplicate the >> > existing code for initializing _sigfault fields in {send,force}_sig_*, >> > and for copying _sigfault fields in copy_siginfo_to_external32 and >> > post_copy_siginfo_from_user32, to reduce the number of places that >> > will need to be updated by upcoming changes. >> >> Acked-by: "Eric W. Biederman" > > Thanks for the review. > >> No real objection but I am wondering if it might be better to >> introduce two small inline functions for setting common fields >> instead of: >> >> > + if (siginfo_layout_is_fault(layout)) { >> > + to->si_addr = ptr_to_compat(from->si_addr); >> > +#ifdef __ARCH_SI_TRAPNO >> > + to->si_trapno = from->si_trapno; >> > +#endif >> > + } >> >> and >> >> > + if (siginfo_layout_is_fault(layout)) { >> > + to->si_addr = compat_ptr(from->si_addr); >> > +#ifdef __ARCH_SI_TRAPNO >> > + to->si_trapno = from->si_trapno; >> > +#endif >> > + } >> >> perhaps called: >> copy_sigfault_common_to_external32 >> post_copy_sigfault_common_from_user32 >> >> I have not benchmarked or anything but my gut says one less conditional >> branch to worry about makes dealing with spectre easier and probably >> produces faster code as well. Possibly even smaller code. > > Dave made the same proposal on an earlier version of the patch which I > responded to in [1]. The main reason for keeping things as I > implemented them was because of the ptrace handling but if we do end > up dropping that as you proposed on the other patch then I think I'd > be happy to move the code into helper functions. > > Peter > > [1] https://lore.kernel.org/linux-parisc/CAMn1gO42arQKGBj1Nnbs86TGYyogpRR_t73H=GbTmQrbAbV30A@mail.gmail.com/ That makes sense. Eric _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel