From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from hall.aurel32.net (hall.aurel32.net [IPv6:2001:bc8:30d7:100::1]) by sourceware.org (Postfix) with ESMTPS id 44BE43858012 for ; Tue, 14 Dec 2021 22:19:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 44BE43858012 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=aurel32.net Authentication-Results: sourceware.org; spf=none smtp.mailfrom=aurel32.net DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=aurel32.net ; s=202004.hall; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date: Subject:Cc:To:From:Content-Type:From:Reply-To:Subject:Content-ID: Content-Description:In-Reply-To:References:X-Debbugs-Cc; bh=M5WvALlnmbbVZt9yKe2UB5waWRsm39tGNXxLmZtxnZ0=; b=e6yoRxm25IMmXEZQyRjBGRhY3F khPlb4hVNptlsTKbkApVvA8SSbJDIua77Zxwc1glZkb65DQitKfuviNhTj5lQwtJ83WqiMTwGmpIw b/pKrsBNy90oL24kxNGNKLGf3cqr1iqRo62Eke1uOl4uuOfLszQWHOnU/FAZWtrBZCNnGCHZBLuB1 E56JkejdXzqjHfxci27xU2duH1dGoEuqoASc6WgxRWeTeubxvQ7q4IBfdGUW+YE8LzhTy5FYvKPaf nKIgbtQDL2kvPYSk54+Luh2ZScQWBkxt8XjbCxifu3AOrjRSGMiLF3PuFci8YHkxT45lE+ksktwBK jrmlftJQ==; Received: from [2a01:e34:ec5d:a741:8a4c:7c4e:dc4c:1787] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mxG8p-0006cV-T1; Tue, 14 Dec 2021 23:19:23 +0100 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.95) (envelope-from ) id 1mxG8p-0014fC-H3; Tue, 14 Dec 2021 23:19:23 +0100 From: Aurelien Jarno To: libc-stable@sourceware.org Cc: Xi Ruoyao Subject: [COMMITTED 2.34 1/2] mips: align stack in clone [BZ #28223] Date: Tue, 14 Dec 2021 23:19:18 +0100 Message-Id: <20211214221919.256237-1-aurelien@aurel32.net> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_PASS, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-stable@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-stable mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Dec 2021 22:19:27 -0000 From: Xi Ruoyao The MIPS O32 ABI requires 4 byte aligned stack, and the MIPS N64 and N32 ABI require 8 byte aligned stack. Previously if the caller passed an unaligned stack to clone the the child misbehaved. Fixes bug 28223. (cherry picked from commit 1f51cd9a860ee45eee8a56fb2ba925267a2a7bfe) --- NEWS | 1 + sysdeps/unix/sysv/linux/mips/clone.S | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/NEWS b/NEWS index 698964bb9e..693ac78229 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,7 @@ The following bugs are resolved with this release: [19193] nptl: pthread_kill, pthread_cancel should not fail after exit [28036] Incorrect types for pthread_mutexattr_set/getrobust_np [28182] _TIME_BITS=64 in C++ has issues with fcntl, ioctl, prctl + [28223] mips: clone does not align stack [28310] Do not use affinity mask for sysconf (_SC_NPROCESSORS_CONF) [28340] ld.so crashes while loading a DSO with a read-only dynamic section [28357] deadlock between pthread_create and ELF constructors diff --git a/sysdeps/unix/sysv/linux/mips/clone.S b/sysdeps/unix/sysv/linux/mips/clone.S index 71d9dba8bd..43a5ad3a40 100644 --- a/sysdeps/unix/sysv/linux/mips/clone.S +++ b/sysdeps/unix/sysv/linux/mips/clone.S @@ -55,6 +55,13 @@ NESTED(__clone,4*SZREG,sp) .set at #endif + /* Align stack to 4/8 bytes per the ABI. */ +#if _MIPS_SIM == _ABIO32 + li t0,-4 +#else + li t0,-8 +#endif + and a1,a1,t0 /* Sanity check arguments. */ li v0,EINVAL -- 2.33.0