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 29F98385842D for ; Fri, 17 Dec 2021 21:49:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 29F98385842D 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=n7Rm/mKFbkpDZ0ZLjvPLI5G+ajy3nJd1VVKVHps49pI=; b=esnx1WOSq4PcHbQJZ7zgkWJXth AK+yOWJ3xgnZplRUz8CaBeLX+StCEqC37XMiI1qNtlqasVMOqQ24Q9kx53Yd76WT9QRYKp1k6FYdV 9r2ztlKB3I5DG3/aIrthaMAS6qv2ZsvqDvMvjyfprYbw8OTbKoDQMOp/HGdm/Qrx1rpLjdms1uIG3 HMrTH7FDW9w92yPFR7Uu2zmShblOyx2+pxjzuvdsv/TPipQrx0ruRAdAuZEsUEy/hPmrzKl0C0rWf 3yXpho9yN1LVia9R8Qu3bit6XqAruG523k7X6OagUwe0QFIYD6z1e3GnvqpqS/VKhC7AWGYJsoH1K A6jsiryA==; 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 1myL6b-0004Hn-4O; Fri, 17 Dec 2021 22:49:33 +0100 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.95) (envelope-from ) id 1myL6a-002Ukj-P1; Fri, 17 Dec 2021 22:49:32 +0100 From: Aurelien Jarno To: libc-stable@sourceware.org Cc: Aurelien Jarno Subject: [COMMITTED 2.34] riscv: align stack in clone [BZ #28702] Date: Fri, 17 Dec 2021 22:49:29 +0100 Message-Id: <20211217214929.594855-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: Fri, 17 Dec 2021 21:49:35 -0000 The RISC-V ABI [1] mandates that "the stack pointer shall be aligned to a 128-bit boundary upon procedure entry". This as not the case in clone. This fixes the misc/tst-misalign-clone-internal and misc/tst-misalign-clone tests. Fixes bug 28702. [1] https://github.com/riscv-non-isa/riscv-elf-psabi-doc (cherry picked from commit d2e594d71509faf36cf851a69370db34a4f5fa65) --- NEWS | 1 + sysdeps/unix/sysv/linux/riscv/clone.S | 3 +++ 2 files changed, 4 insertions(+) diff --git a/NEWS b/NEWS index 1214ec4727..873491df1f 100644 --- a/NEWS +++ b/NEWS @@ -24,6 +24,7 @@ The following bugs are resolved with this release: [28532] powerpc64[le]: CFI for assembly templated syscalls is incorrect [28678] nptl/tst-create1 hangs sporadically [28700] "dns [!UNAVAIL=return] files" NSS default for hosts is not useful + [28702] RISC-V: clone does not align stack [28704] elf/tst-cpu-features-cpuinfo fails for KVM guests on some AMD systems diff --git a/sysdeps/unix/sysv/linux/riscv/clone.S b/sysdeps/unix/sysv/linux/riscv/clone.S index 12f91a20d3..161e83c7e3 100644 --- a/sysdeps/unix/sysv/linux/riscv/clone.S +++ b/sysdeps/unix/sysv/linux/riscv/clone.S @@ -32,6 +32,9 @@ .text LEAF (__clone) + /* Align stack to a 128-bit boundary as per RISC-V ABI. */ + andi a1,a1,ALMASK + /* Sanity check arguments. */ beqz a0,L (invalid) /* No NULL function pointers. */ beqz a1,L (invalid) /* No NULL stack pointers. */ -- 2.33.0