Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp726677yba; Thu, 18 Apr 2019 08:34:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqyhpPOoq0OuJDXVpCPI/sjE6SfwFpOWX5WcMyzHnugI0p4cTA1h8a01bcG9K2zb9EQEej/X X-Received: by 2002:a17:902:280a:: with SMTP id e10mr78198292plb.244.1555601687595; Thu, 18 Apr 2019 08:34:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555601687; cv=none; d=google.com; s=arc-20160816; b=KY5GPql5utphqUv2mqnNDsCcg7GNjhuduRrvwfJ1s3S01dx60OMVEfWwje87CBm1NM O7ZPaoCPhI5vwoyAqhGc30YmYpuwPb8fyqBX77gZyV3KBk2iM1taOb2U1rBa1KQIhHyf GoR69It/ZSGb+JSnMJfjSCcGj7C/jK1f9KFf6J2sKUU6Sz9I4yqp+5z2W394DsnP3JFs sJ7AVqtWlDxEVOQYI7JF5invHFFtLfhZ2dbBMnVfK/1Des33Ij5nME+Se2R1X6HDFTzi Nik0Piza2fDlZU6TtrBfrk6+L1QD0h/oCbMBDagBt33eHl1x6pP3R/Ii7d+AhCCVgHdZ vWkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender: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=Q0ENr6tvZZ8CFWvNyjR34BQxJmDe12agR1pmn4b8EUI=; b=cLSOw1B6yvoRKnw08G9e/LXkXxEsf2WaLH9Q3bQ+tvLKOdzeZwq6mj8vMwMsTGUrxt wDsd+MF2nQlp4egP/blpQL9F0wgNiZRxNrMwCu2+X5aZghZeAHiZawy4DAAUe/mZGHp5 DaI3YNwTruiq2WgeB7flMjACP5TYJmTqJBJwgIMRtqZORGtftYUzKeZyFtY89fuWrRv9 UOu+2qJEPbkozVMH1TRXWC4wPlSYLE9NdQOkkhsRlVpjhTS3WFaZGJUAmfGw1hhKGd/e eUP5Kc6wgOXbeNslJbITMCuHhuSO/dFouZqJJRZx6xLMawbkE94WLdxRjjElOnoc3oWk Ppng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b=oyga4m08; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c1si2419103pla.240.2019.04.18.08.34.31; Thu, 18 Apr 2019 08:34:47 -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; dkim=pass header.i=@efficios.com header.s=default header.b=oyga4m08; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389434AbfDRPb7 (ORCPT + 99 others); Thu, 18 Apr 2019 11:31:59 -0400 Received: from mail.efficios.com ([167.114.142.138]:33698 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731317AbfDRPb6 (ORCPT ); Thu, 18 Apr 2019 11:31:58 -0400 Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id 10A0318C70B; Thu, 18 Apr 2019 11:31:57 -0400 (EDT) Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id Q59LoxcTY1DJ; Thu, 18 Apr 2019 11:31:56 -0400 (EDT) Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id 65FAD18C701; Thu, 18 Apr 2019 11:31:56 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 65FAD18C701 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1555601516; bh=Q0ENr6tvZZ8CFWvNyjR34BQxJmDe12agR1pmn4b8EUI=; h=Date:From:To:Message-ID:MIME-Version; b=oyga4m08fTOVY6MCCRgq3wQ5KokbAV2rUW7trr9ep9ystA5l+q4WvjCj95IUcIgfE 7r1El6J95PkyI7PgtreHXE+ihtuVCLlY+N3Ddh8SdcNwOrhf8DK3RltI7ZM1ugugZu X9QnVzQLXos76hUrlVVW4/VLpXDkDgm7+1dSEhwKcWng13eYEOyAveELM9BHo9G0gG iSAJ/Ylm9ScdHoeBIuL0zLpRpAgl7ip0svqsppAHKHJSlSKamqYa6ERzKxm50JtK1u g+wzYKv39mGw827zI4ZsaTVsy22ucrC+TthB+o7jwbrV8josLlt9OaOoRVxPtScTr1 45+RePwAYUwQw== X-Virus-Scanned: amavisd-new at efficios.com Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10026) with ESMTP id v7XT5fqFeT21; Thu, 18 Apr 2019 11:31:56 -0400 (EDT) Received: from mail02.efficios.com (mail02.efficios.com [167.114.142.138]) by mail.efficios.com (Postfix) with ESMTP id 43A0718C6FA; Thu, 18 Apr 2019 11:31:56 -0400 (EDT) Date: Thu, 18 Apr 2019 11:31:56 -0400 (EDT) From: Mathieu Desnoyers To: Alan Modra Cc: Michael Ellerman , Carlos O'Donell , Tulio Magno Quites Machado Filho , Florian Weimer , Michael Meissner , Peter Bergner , Paul Burton , Will Deacon , Boqun Feng , heiko carstens , gor , schwidefsky , "Russell King, ARM Linux" , Benjamin Herrenschmidt , Paul Mackerras , carlos , Joseph Myers , Szabolcs Nagy , libc-alpha , Thomas Gleixner , Ben Maurer , Peter Zijlstra , "Paul E. McKenney" , Dave Watson , Paul Turner , Rich Felker , linux-kernel , linux-api Message-ID: <836018684.1056.1555601516134.JavaMail.zimbra@efficios.com> In-Reply-To: <20190409092948.GA14424@bubble.grove.modra.org> References: <5166fbe9-cfe0-8554-abc7-4fc844cf2765@redhat.com> <87y34o4xt3.fsf@oldenburg2.str.redhat.com> <43f97ddb-c8df-27ea-9517-63252ebd3183@redhat.com> <877ec4pam2.fsf@linux.ibm.com> <877ec3yffq.fsf@concordia.ellerman.id.au> <20190409092948.GA14424@bubble.grove.modra.org> Subject: Re: [PATCH 1/4] glibc: Perform rseq(2) registration at C startup and thread creation (v7) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [167.114.142.138] X-Mailer: Zimbra 8.8.12_GA_3794 (ZimbraWebClient - FF66 (Linux)/8.8.12_GA_3794) Thread-Topic: glibc: Perform rseq(2) registration at C startup and thread creation (v7) Thread-Index: tb6ujxePzM1jYDms2xneqI8KQYPvrg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- On Apr 9, 2019, at 5:29 AM, Alan Modra amodra@gmail.com wrote: > On Tue, Apr 09, 2019 at 02:23:53PM +1000, Michael Ellerman wrote: >> I'd much rather we use a trap with a specific immediate value. Otherwise >> someone's going to waste time one day puzzling over why userspace is >> doing mtmsr. > > It's data. We have other data in executable sections. Anyone who > wonders about odd disassembly just hasn't realized they are > disassembling data. > >> It would also complicate things if we ever wanted to emulate mtmsr. > > No, because it won't be executed. If I understand correctly, the only > reason to choose an illegal, trap or privileged insn is to halt > execution earlier rather than later when a program goes off in the > weeds. > >> If we want something that is a trap rather than a nop then use 0x0fe50553. >> >> That's "compare the value in r5 with 0x553 and then trap unconditionally". >> >> It shows up in objdump as: >> >> 10000000: 53 05 e5 0f twui r5,1363 >> >> >> The immediate can be anything, I chose that value to mimic the x86 value >> Mathieu mentioned. >> >> There's no reason that instruction would ever be generated because the >> immediate value serves no purpose. So it satisfies the "very unlikely >> to appear" criteria AFAICS. > > Yes, looks fine to me, except that in VLE mode (do we care?) > ".long 0x0fe50553" disassembles as > 0: 0f e5 se_cmphl r5,r30 > 2: 05 53 se_mullw r3,r5 > No illegal/trap/privileged insn there. > > ".long 0x0fe5000b" might be better to cover VLE. Can you share with us the objdump output of ".long 0x0fe5000b" in VLE mode ? VLE mode support does not appear to be available in typical toolchains. Also, is VLE mode only for powerpc 32 be, or also for powerpc 64 be/le ? Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com