From patchwork Thu Jan 4 22:16:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Noah Goldstein X-Patchwork-Id: 83336 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7A4C5386EC7C for ; Thu, 4 Jan 2024 22:17:10 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x734.google.com (mail-qk1-x734.google.com [IPv6:2607:f8b0:4864:20::734]) by sourceware.org (Postfix) with ESMTPS id 38BA93858D32 for ; Thu, 4 Jan 2024 22:16:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 38BA93858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 38BA93858D32 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::734 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704406600; cv=none; b=dw3Y3CuMb+5md4x7iWTah/Kgx3cZB+VuXXQ2iYst6uPXmlvxLGaZY1hfOgBfGYfKwalBzdfzmcOGo4+K7YA5CAR6I5VaMCR3hqk/HNM0t3l/ym5ur6Oz2ibxtDLtjC0Dxc97XoAdxYbCkywDTPmQLllRWKn5bFS/4v9TfPL8glw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704406600; c=relaxed/simple; bh=lYHRie28kCgUk2kctsKHks81HlymuHGcsYqXn5zctiQ=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=KSNL/5UbNRpJzE2V202LUeG8ZPMREcW6uGj/r4PwZ7wjhQU3Dk+pZJReShKNqmWvqZKrtF81pPslybAUzrXhfgSACT/bTv8FpZ/60srvMS339lgSs3n+LogwDEmzmEMHFBAG0LEaCevL2cPH5qlPv+D6J55Zpk3Zikbe8r7hGuc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-qk1-x734.google.com with SMTP id af79cd13be357-78106c385a1so63299485a.0 for ; Thu, 04 Jan 2024 14:16:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704406598; x=1705011398; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=ZUGKWp4+VgjNK9f5ZZbleTIjanr2SH8DS+ICn7O2P1w=; b=Gn6Hhyap5VQuoma74sWBoWJNSOeOVknXCoPMHTSLx6TZM4WrY2GLkBUsYwnomIrnwM oFyFAkxf+FIOx4uPXilKU6Qo23dedztjfXwYxNKT9/ecfHOA89TG21PUsuiVVV09M0Rz XVjqv+Xc8Xk4yYj8dmisEVThsxewBVszPBBPxTshShiCmdwDfUkP0GrB8uBtcZcBFY6l hA4CRSDF+3wHmhB068iNriZbzlXyFkIN3JjUz39voBHupHZY1c0NaP5QwrHg257TSO6Z Q00CQGJpCkT5TVzDZAOHaBcTQRdV72EJYfRdVxJ5xK0Npxe3AzCFN9MHHKoqQpuWxK9C KNlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704406598; x=1705011398; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ZUGKWp4+VgjNK9f5ZZbleTIjanr2SH8DS+ICn7O2P1w=; b=kwoy2+JrnREvea6fPnPZy7pVlKvw4IV8mO6OrgyMp1fdTySxQjcK3n8jSfIXytJmY7 jt6oZxG2zZLz1x9v3ZzsMUY33ailiklIMrO2ZMa9BLvWR1EMnJElt9UAS4pdWNaKN70D WhnbJgUGaT0n2oDLTaDOJv7pZQXrWOAhTOAHIkK8F/b3uITWJ/QC4FU5ScPOmEKyrQw/ 1p/4ENBfF9OCiN7jmJVrkIyKd6aMdj3guXzuAMUcX5szZgoiIFdSKVHWCqJGP1Lp5KMu 2rNbrue7ZtVhjVXhNG66ZWHhYczDVSPzBDYO71rZ+eGTuifBL7YGjolgLGtaFpErYiBd Vigw== X-Gm-Message-State: AOJu0YzXl7QFDl3v2C909CO7s616YzCodSHkO26c2qq7T44EBdv763s5 4fXZ4oO0Rg9yVlVuF/zHNqB17/Uf8f8= X-Google-Smtp-Source: AGHT+IFEm7queXTtVxOf+4SHceAERYm41KcuGO4FSGadSFcJQx1ixq82jAP3LR/bdfCrzHJn8ydfKw== X-Received: by 2002:ae9:f101:0:b0:781:221f:40b3 with SMTP id k1-20020ae9f101000000b00781221f40b3mr1157396qkg.44.1704406598131; Thu, 04 Jan 2024 14:16:38 -0800 (PST) Received: from noahgold-desk.sc.intel.com ([192.55.54.50]) by smtp.gmail.com with ESMTPSA id s5-20020a05620a030500b0077d74f884d9sm119919qkm.117.2024.01.04.14.16.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 14:16:37 -0800 (PST) From: Noah Goldstein To: libc-alpha@sourceware.org Cc: goldstein.w.n@gmail.com, hjl.tools@gmail.com, carlos@systemhalted.org Subject: x86: Fixup some nits in longjmp asm implementation Date: Thu, 4 Jan 2024 14:16:34 -0800 Message-Id: <20240104221634.3612621-1-goldstein.w.n@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org 1) Replace `jne` with `jb`. This is generally safer incase either r10/rcx are misaligned. 2) Replace a stray `nop` with a `.p2align` directive. --- sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S | 2 +- sysdeps/x86_64/__longjmp.S | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S b/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S index 9aa24620b9..083ffb33f2 100644 --- a/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S +++ b/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S @@ -57,7 +57,7 @@ longjmp_msg: cfi_def_cfa_offset(16); \ LOAD_MSG; \ call HIDDEN_JUMPTARGET(__fortify_fail); \ - nop; \ + .p2align 3, 5; \ cfi_restore_state; \ .Lok2: \ movq %r10, %rdi; \ diff --git a/sysdeps/x86_64/__longjmp.S b/sysdeps/x86_64/__longjmp.S index 22fedc4997..d38ace7512 100644 --- a/sysdeps/x86_64/__longjmp.S +++ b/sysdeps/x86_64/__longjmp.S @@ -89,7 +89,7 @@ L(find_restore_token_loop): subq $8, %rcx /* Stop if the current ssp is found. */ cmpq %rcx, %r10 - jne L(find_restore_token_loop) + jb L(find_restore_token_loop) jmp L(no_shadow_stack_token) L(restore_shadow_stack):