From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.2 Received: (qmail 26458 invoked from network); 22 Apr 2020 06:57:04 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with UTF8ESMTPZ; 22 Apr 2020 06:57:04 -0000 Received: (qmail 17465 invoked by uid 550); 22 Apr 2020 06:57:01 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 17429 invoked from network); 22 Apr 2020 06:57:00 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:subject:to:cc:references:in-reply-to:mime-version :message-id:content-transfer-encoding; bh=McFY1qmfP9otNM9K4ThqnjSfg4IHXwK59iAZ0RpC3/0=; b=YDBiU1fWRxyj0yw5PMoz4K6spGqX8NJLH0izSdv0BeEoavGlDM4FaLH7kc8wlbBlsM xv/uOutJelLuLut7MiNOTYrHCSu1d/CObgcbujiQHc6YeOS9LYtu6BFJGjF2//B+aQSZ 6wnyOokBJ2H42WtcwxZEGU2725Q63pKsR4PDVByhJX25RZsu0+hCUeZts88Ox13UnCKN FdH9RuOOiY7A/3VE+lFBiRkd9ITCCPioNRVG/m7JMdlV6NT+Pfac9lvjovXZE/xl0zyH U/avIlgd54AFU1QZ6MTuUDiSPKZc+sVqS5k5+fWHnQcTYGupTjp4VBmIB8Fytk7XGSR9 mtHg== 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=McFY1qmfP9otNM9K4ThqnjSfg4IHXwK59iAZ0RpC3/0=; b=XAmq7/EVYCpjktDzPHBwXnIrazaGnD1qwtaAaNcCR0zt2maA1HaqcqyaGf2WKEWw5Y sBvWcKQb9tvpqJ+HXVMN865P95lzltG6zHUhX4Axes6Nn/F9/vb/jDYFYgPrVh5pEGit 8T+YvN94OoMZm3ASAT6RSJRS8K7kqsQ1gZdw1g6MJwBuSZ2R0kpOblc49XlAdLL4R6++ vTQTRJBGW+DtqQrgjQt9ID7fvGo/ZllPXmltNUagt4Od0YKuiDcv0qVr0M0iYT6A3i6T IqG1H4CDPJ0FvvPTPc7oqQtsSehIZcgylXGgfALzR1B1tGCvpQO9mCUoGH3W/2EQNY4v yyTQ== X-Gm-Message-State: AGi0PubfcquqT5UG9AZ55aADdXub0vRd7eZJ8+jqjqKSA+awX32neXG8 Gfj8Cmkp1iqcKWxD0VL5cSg= X-Google-Smtp-Source: APiQypL2bvrJpMnUAGbe1Gdl7oeNveEtwNKWNpmIrUM5eIUx+uqLrvcBGD43Q3+qdWvb232bkHIJ+w== X-Received: by 2002:a63:e03:: with SMTP id d3mr18039918pgl.47.1587538607940; Tue, 21 Apr 2020 23:56:47 -0700 (PDT) Date: Wed, 22 Apr 2020 16:54:18 +1000 From: Nicholas Piggin To: Adhemerval Zanella , Rich Felker , David Laight Cc: "libc-alpha@sourceware.org" , "libc-dev@lists.llvm.org" , "linuxppc-dev@lists.ozlabs.org" , "musl@lists.openwall.com" , Segher Boessenkool References: <1586931450.ub4c8cq8dj.astroid@bobo.none> <20200415225539.GL11469@brightrain.aerifal.cx> <20200416153756.GU11469@brightrain.aerifal.cx> <4b2a7a56-dd2b-1863-50e5-2f4cdbeef47c@linaro.org> <20200416175932.GZ11469@brightrain.aerifal.cx> <4f824a37-e660-8912-25aa-fde88d4b79f3@linaro.org> <20200416183151.GA11469@brightrain.aerifal.cx> <1587344003.daumxvs1kh.astroid@bobo.none> <20200421143941.GJ11469@brightrain.aerifal.cx> <960127e0-57a0-55b4-f309-ae0a675c7756@linaro.org> In-Reply-To: <960127e0-57a0-55b4-f309-ae0a675c7756@linaro.org> MIME-Version: 1.0 Message-Id: <1587536988.ivnp421w2w.astroid@bobo.none> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [musl] Re: Powerpc Linux 'scv' system call ABI proposal take 2 Let me try to summarise what we have. - vdso style call is ruled out as unnecessary with possible security=20 concerns. Caller can internally use indirect branch to select variant=20 if it wants to use that mechanism to select. - LR clobber seems to handled okay by gcc. It can increase size of small=20 leaf wrapper functions, but they can use the caller stack frame for=20 this (and even red zone for saving other things if necessary), but not=20 a huge amount. - -ve error return seems to be favoured by everyone. Experimentally,=20 it's better for musl (but musl could probably improve cr0[SO] error=20 handling a bit 'asm goto'). - Preserving syscall args and volatiles up to r8 is a small but=20 noticable help for cases that inline the call rather than always call=20 wrappers. This is unlikely to be helpful unless 'sc' support is=20 compiled out but I'll consider doing it for the long term. Next step=20 is to trace and test on real hardware. - One thing that nobody has really asked about is error handling for=20 unsupported scv vectors, so I would like to just go over it: Today, the scv facility is disabled by the kernel (FSCR[SCV] is=20 cleared), which makes any `scv` instruction take a facility unavailable, which ends up printing a kernel message about SCV facility unavilable, and SIGILL's the process with ILL_ILLOPC. Enabling 'scv 0' will enable 1-127 as well, so the kernel has to handle=20 those somehow. What we are saying is that we will allocate HWCAP bits in future if we=20 implement more scv vectors, so userspace is not *supposed* to rely on=20 this, but kernel has to choose some behaviour for invalid vectors. My proposal was to do the same SIGILL (with no kernel facility message), so it appears to behave the same way to userspace as it does now. There=20 is also the ILL_ILLOPN code that could be used as invalid operand, but powerpc does not use this much, and e.g., the static instruction=20 coded operands e.g., invalid mfspr generate ILL_ILLOPC so we could=20 consider the entire instruction as the opcode, and input register values=20 as operands. Now I don't know why a process would want to distinguish between=20 FSCR[SCV]=3D0 and the case where it is enabled but kernel doesn't=20 implement the vector, but maybe it does? Another option would be to use a different signal. I don't see that any=20 are more suitable. Or return without a signal but -ENOSYS or something in r3. This doesn't=20 seem so good because an invalid scv vector is not a system call, and a=20 failure ABI would constrain any future implementation just a little bit. Any objections to SIGILL ILL_ILLOPC? Thanks, Nick