From nobody Thu Jun 29 08:20:46 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4QsBGl2vsZz4knsl; Thu, 29 Jun 2023 08:20:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QsBGl05pLz3w3s; Thu, 29 Jun 2023 08:20:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688026847; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LVEOLmii+PN6j20OycVOLtWt68pXHfG0dFWkXNTwTUM=; b=jnPe2HvvOuf+kUGwZOCmIhmBRmL4lZZ76WfpF0tXqWnQgUKt13QMu6GpvwUs0DO44ZQhYC dHFMH83dMmIm275NKPv8kZGmf2TcV+LWARw2FV+mIDxNoRxmF4c/uq/pq/aAW940nLGUhr 8bgxk+aWw3zBMwQuvSlyFGEsqjDhbtK3p0sEOvhdDm4vQHzDcfKIQidgXpCTwu3RqiuMvm M+KxY6Ws6l0gy+lC14nkobyOeavlEnom+M/k5oKxV+klYwOC3DPplkTmDp1i1J6SmZ/SX6 PV3nHtDI/0KyCrN8ckobhWIhsyLEFnc1Oy3+3MJyLhIvnd/gpexlwD9GQ+np9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688026847; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LVEOLmii+PN6j20OycVOLtWt68pXHfG0dFWkXNTwTUM=; b=X1aU2x0lX5bbB6p1hev7Wj7o7iumP1a0csUMEX5M7+VXWEWpwAsqqBD6nfls6r82/JPz4Z tF9qTR8XKE72/5AinPx1UXNcAIhyEODRchd3OrNe6xxb5zG/36AGRM52RW3Z4cq4jTXFrG gMnrEVPF8zSWOuEZLQyB4G1+q6NmQ5GmjvXEYUhAjR13YQSaQfazfH4JjmltDH3Jmtlx+N mhu7/ciu5zZJDUw/CTtqApK9VMUBFggu2ZwknFFYwg6EiBUHQkWtMtArirN9z/PEydXUHc hiw0dg1R5LX+2/LKpX7dHLlQo3C1JSo4ii25WssKYneXZiYxKxcchf8IB7+S1g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1688026847; a=rsa-sha256; cv=none; b=qqhtP+wr8Af8lL7BMY14U6HJ4j/KqaoTJv6xf3Ar6Kxc3az8Ni86GcQE6SL6gvJGjx3Ckj cs+epHYDf0zGcnu++36nmKGlkejkU0Jb/TibdWQLzhnn7yqolsuPBfXL5ne5FOfBS/2Y/D lG73DdNPIY87bD4tIZgasR0boWigY1H7Z8jpIhNsqdpFZw3dyBxBfGwDH8w7tcz2e7TF5/ iujyBul719EssijIHbIC2p5iieojMEuYu+xlDS78+ZO9JJAQs+iuiT5z77wVEAjAOmW/6m 6HMWDfGRN46/xUNl71hNEumVFh3FFmUOrwzIRP5IZ/jW2C7lbTJH26LmviTUzQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4QsBGk6Gs0z17NW; Thu, 29 Jun 2023 08:20:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 35T8Kk9w085708; Thu, 29 Jun 2023 08:20:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 35T8KkAV085707; Thu, 29 Jun 2023 08:20:46 GMT (envelope-from git) Date: Thu, 29 Jun 2023 08:20:46 GMT Message-Id: <202306290820.35T8KkAV085707@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: fa3d164dd9ef - stable/13 - linux(4): Preserve %rcx (return address) like a Linux do List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: fa3d164dd9ef6fadac6ed4f747ffb09657c5ae76 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=fa3d164dd9ef6fadac6ed4f747ffb09657c5ae76 commit fa3d164dd9ef6fadac6ed4f747ffb09657c5ae76 Author: Dmitry Chagin AuthorDate: 2023-05-28 14:06:47 +0000 Commit: Dmitry Chagin CommitDate: 2023-06-29 08:16:02 +0000 linux(4): Preserve %rcx (return address) like a Linux do Perhaps, this does not makes much sense as destroyng %rcx declared by the x86_64 Linux syscall ABI. However,: a) if we get a signal while we are in the kernel, we should restore tf_rcx when preparing machine context for signal handlers. b) the Linux world is strange, someone can depend on %rcx value after syscall, something like go. Differential Revision: https://reviews.freebsd.org/D40155 MFC after: 1 month (cherry picked from commit 037b60fb0fbcb2dd6b6cbb632b05a2939ff4ff29) --- sys/amd64/linux/linux_sysvec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/amd64/linux/linux_sysvec.c b/sys/amd64/linux/linux_sysvec.c index fea1e274ac95..53eda1cbc7c0 100644 --- a/sys/amd64/linux/linux_sysvec.c +++ b/sys/amd64/linux/linux_sysvec.c @@ -168,6 +168,8 @@ linux_fetch_syscall_args(struct thread *td) /* Restore r10 earlier to avoid doing this multiply times. */ frame->tf_r10 = frame->tf_rcx; + /* Restore %rcx for machine context. */ + frame->tf_rcx = frame->tf_rip; td->td_retval[0] = 0; return (0);