From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by sourceware.org (Postfix) with ESMTPS id 82FC43858D31 for ; Mon, 20 Apr 2020 02:09:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 82FC43858D31 Received: by mail-pj1-x1044.google.com with SMTP id nu11so3761236pjb.1 for ; Sun, 19 Apr 2020 19:09:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:subject:to:cc:references:in-reply-to :mime-version:message-id:content-transfer-encoding; bh=0NpoVIV5BBpVC9+Ar43gGkMf3ia+u5987WDF4Vw/Yd4=; b=EJdEbNBDlpSztChpa/rssKdjjA2gn5n9NPTGfRl4XxO9WI6hKF+Tfh/fUgNEdWzSEu yR2pmbZYRoVZRsrgeFaDYOXsQrdxWvFw+kjQDemHEyu8SXwYPy5rsXf6LmpqDdaN8hwt Tsb6LzJ89IlMYfO+TAJfEbaGGFH1bmV7dxMc3c763mBcTWeSReJ9o++dPY4GPrFuGDUy A3B3r9iaCGkDYwNl/yjwuUOOFwochZIyKq5W9EjtBSHbJpuOh4616T7v+qrgODYNqF04 w0E41tRKRRb05Oax8/dGxy2TbT7MEyaHacr/fddNbrsCS3x7yTymWlwBN8+lj05MlkWw OrVQ== X-Gm-Message-State: AGi0Pubf7gBVEWENudYcZFhbJd+ka/lJ6xr/yN7r9x1wy9fGMNYOCLIr LhxKNJSDIszcnzlJry3wJcHeYYft X-Google-Smtp-Source: APiQypLV9QIfOcoh2wLkCPSokDBB4f5ZROkcHlo59I/B+/M5nASv+P03Cn9b/A/a2GNhbL9E9iE/xg== X-Received: by 2002:a17:902:868d:: with SMTP id g13mr14171889plo.317.1587348595565; Sun, 19 Apr 2020 19:09:55 -0700 (PDT) Received: from localhost ([203.185.249.170]) by smtp.gmail.com with ESMTPSA id c28sm357376pfp.200.2020.04.19.19.09.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Apr 2020 19:09:55 -0700 (PDT) Date: Mon, 20 Apr 2020 12:08:36 +1000 From: Nicholas Piggin Subject: Re: [musl] Powerpc Linux 'scv' system call ABI proposal take 2 To: Rich Felker Cc: Nicholas Piggin via Libc-alpha , libc-dev@lists.llvm.org, linuxppc-dev@lists.ozlabs.org, musl@lists.openwall.com, Szabolcs Nagy References: <1586931450.ub4c8cq8dj.astroid@bobo.none> <20200415225539.GL11469@brightrain.aerifal.cx> <1586994952.nnxigedbu2.astroid@bobo.none> <20200416095800.GC23945@port70.net> <1587341904.1r83vbudyf.astroid@bobo.none> <20200420012904.GY11469@brightrain.aerifal.cx> In-Reply-To: <20200420012904.GY11469@brightrain.aerifal.cx> MIME-Version: 1.0 Message-Id: <1587348046.pwnfbo52iq.astroid@bobo.none> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Apr 2020 02:09:57 -0000 Excerpts from Rich Felker's message of April 20, 2020 11:29 am: > On Mon, Apr 20, 2020 at 10:27:58AM +1000, Nicholas Piggin wrote: >> Excerpts from Szabolcs Nagy's message of April 16, 2020 7:58 pm: >> > * Nicholas Piggin via Libc-alpha [2020-04-= 16 10:16:54 +1000]: >> >> Well it would have to test HWCAP and patch in or branch to two=20 >> >> completely different sequences including register save/restores yes. >> >> You could have the same asm and matching clobbers to put the sequence >> >> inline and then you could patch the one sc/scv instruction I suppose. >> >=20 >> > how would that 'patch' work? >> >=20 >> > there are many reasons why you don't >> > want libc to write its .text >>=20 >> I guess I don't know what I'm talking about when it comes to libraries.=20 >> Shame if there is no good way to load-time patch libc. It's orthogonal >> to the scv selection though -- if you don't patch you have to=20 >> conditional or indirect branch however you implement it. >=20 > Patched pages cannot be shared. The whole design of PIC and shared > libraries is that the code("text")/rodata is immutable and shared and > that only a minimal amount of data, packed tightly together (the GOT) > has to exist per-instance. Yeah the pages which were patched couldn't be shared across exec, which is a significant downside, unless you could group all patch sites into their own section and similarly pack it together (which has issues of being out of line). >=20 > Also, allowing patching of executable pages is generally frowned upon > these days because W^X is a desirable hardening property. Right, it would want be write-protected after being patched. Thanks, Nick