From nobody Sat Aug 12 22:34:16 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 4RNb7F35pCz4TvFJ; Sat, 12 Aug 2023 22:34:17 +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 4RNb7F0087z4Ymc; Sat, 12 Aug 2023 22:34:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691879657; 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=2UoF5QEypwPuwJ19VCfctIcRkkVV5X4Hvq6OWoHHbZw=; b=Z75E0Vl1zUTvw51weWLt92pvpkA7NGiOWJmTfJBrL1guhV8g+dObu2uusXMW/vp5gzOpAq XKxOY+jPo3wjU0TomhvgzdzoVPocw07lTaXxYWax6ObhWpFjWNhze+4VJesgLJ0QkLPWif ccnagX3ew3rX0JD7aOkEL8qpA8L2obGXmqEcdH09XOYSOT6W8C6pGexWPERu5W0VxmZ2QK QFkWfh2QZsq9jwoQhu/VHZgGWDkTVPR5uf6KTbmsatnTsTpLfFDJ/MjT7FH0E2/N7hEZdi hORsKZrMLg9KHF07F3fO5d4GuyHGksTfT877lXOtqfq4atO6bIpyQWbyBpFelQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691879657; 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=2UoF5QEypwPuwJ19VCfctIcRkkVV5X4Hvq6OWoHHbZw=; b=lssSX8o70mM7XKjZUvZ93Eez7j5UmliH2DghwCFh6NY2cP64kyxDsJ91wFOxPfuKX2JXBv bnTAM8bWBU6L5uv+ImKCMGmN/MBve9Knsq1amZ5vBWZc0iAbt7vp6vBLNufqhtj96k0ERs PpyiwCboeqGpOTeZFzz8OIi6JqWdHg20263yqBm94EHRjCcgpsP7WJ7Y2ulEkiehtHTnzV H2eJ3WCzatSYrzW9WB0I+R5H72jdeivn97rHp0LfMRxoogca+qR+07WMhTteZ0X5WQlcdV yr4gzXvwKH5hf+IsTLUbJ7Ox9kb8uCO+B0pOSFpte4Nt+EME8pluDp6iXiUtqg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1691879657; a=rsa-sha256; cv=none; b=CgjZoHuaIR7rBD9hRHoqAxU9itWx0SbV9X9RfRidu5tCtgcrxdieQqVh+113ylv3m9B633 hUE3JuXM4ozfRRHcZi9sUTp5VrWQBUR6DZIRF6J28WsxojFIGPores25h6FcopkJ2XWKKv HzTfC3qMslDr99VJGgKTMA/spIbKrTI2vVzQRo30g2lgOOxDMp5WbZlrYTsJuhHZsv4JvS h28Llwao/i4WabH+fmu8y6uOOFT5XRj46paDNYnugE757el5s3mkPpOPlTbP2VhrX7bxO+ Rq49D5peyh+IT/6zEajAdN4Hx3LqNFlJEjJC9jfYrLij/iuC4qN000f/3oYDCg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4RNb7D682Czdj4; Sat, 12 Aug 2023 22:34:16 +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 37CMYG5j037136; Sat, 12 Aug 2023 22:34:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 37CMYGDj037133; Sat, 12 Aug 2023 22:34:16 GMT (envelope-from git) Date: Sat, 12 Aug 2023 22:34:16 GMT Message-Id: <202308122234.37CMYGDj037133@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 93626d543702 - main - tc_fill_vdso_timehands32(): fix 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 93626d54370292b09cd0ca604b144737109e9071 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=93626d54370292b09cd0ca604b144737109e9071 commit 93626d54370292b09cd0ca604b144737109e9071 Author: Konstantin Belousov AuthorDate: 2023-08-12 19:51:37 +0000 Commit: Konstantin Belousov CommitDate: 2023-08-12 22:34:08 +0000 tc_fill_vdso_timehands32(): fix On 64bit, there is a 4-byte hole in struct vdso_timekeep32 after tk_current, if the structure is not packed. This is due to the MD th_x86_pvc_last_systime being 64bit. Change amd64 VDSO_TIMEHANDS_MD32 to not use uint64_t, replace it with pair of uint32_t, as it is done for all other members. PR: 273085 Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/dev/acpica/acpi_hpet.c | 3 ++- sys/x86/include/vdso.h | 7 ++++++- sys/x86/x86/pvclock.c | 2 +- sys/x86/x86/tsc.c | 3 ++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/sys/dev/acpica/acpi_hpet.c b/sys/dev/acpica/acpi_hpet.c index 9ed7c5a47b35..a1171027ddf7 100644 --- a/sys/dev/acpica/acpi_hpet.c +++ b/sys/dev/acpica/acpi_hpet.c @@ -171,7 +171,8 @@ hpet_vdso_timehands32(struct vdso_timehands32 *vdso_th32, vdso_th32->th_algo = VDSO_TH_ALGO_X86_HPET; vdso_th32->th_x86_shift = 0; vdso_th32->th_x86_hpet_idx = device_get_unit(sc->dev); - vdso_th32->th_x86_pvc_last_systime = 0; + vdso_th32->th_x86_pvc_last_systime[0] = 0; + vdso_th32->th_x86_pvc_last_systime[1] = 0; vdso_th32->th_x86_pvc_stable_mask = 0; bzero(vdso_th32->th_res, sizeof(vdso_th32->th_res)); return (sc->mmap_allow != 0); diff --git a/sys/x86/include/vdso.h b/sys/x86/include/vdso.h index 546a92a47301..be90e26702f7 100644 --- a/sys/x86/include/vdso.h +++ b/sys/x86/include/vdso.h @@ -49,7 +49,12 @@ #ifdef _KERNEL #ifdef COMPAT_FREEBSD32 -#define VDSO_TIMEHANDS_MD32 VDSO_TIMEHANDS_MD +#define VDSO_TIMEHANDS_MD32 \ + uint32_t th_x86_shift; \ + uint32_t th_x86_hpet_idx; \ + uint32_t th_x86_pvc_last_systime[2];\ + uint8_t th_x86_pvc_stable_mask; \ + uint8_t th_res[15]; #endif #endif diff --git a/sys/x86/x86/pvclock.c b/sys/x86/x86/pvclock.c index 3da3373bb2ee..9d8ac99f5a8a 100644 --- a/sys/x86/x86/pvclock.c +++ b/sys/x86/x86/pvclock.c @@ -253,7 +253,7 @@ pvclock_tc_vdso_timehands32(struct vdso_timehands32 *vdso_th, vdso_th->th_algo = VDSO_TH_ALGO_X86_PVCLK; vdso_th->th_x86_shift = 0; vdso_th->th_x86_hpet_idx = 0; - vdso_th->th_x86_pvc_last_systime = + *(uint64_t *)&vdso_th->th_x86_pvc_last_systime[0] = atomic_load_acq_64(&pvclock_last_systime); vdso_th->th_x86_pvc_stable_mask = !pvc->vdso_force_unstable && pvc->stable_flag_supported ? PVCLOCK_FLAG_TSC_STABLE : 0; diff --git a/sys/x86/x86/tsc.c b/sys/x86/x86/tsc.c index a9e44307dd83..fc72dee176e9 100644 --- a/sys/x86/x86/tsc.c +++ b/sys/x86/x86/tsc.c @@ -990,7 +990,8 @@ x86_tsc_vdso_timehands32(struct vdso_timehands32 *vdso_th32, vdso_th32->th_algo = VDSO_TH_ALGO_X86_TSC; vdso_th32->th_x86_shift = (int)(intptr_t)tc->tc_priv; vdso_th32->th_x86_hpet_idx = 0xffffffff; - vdso_th32->th_x86_pvc_last_systime = 0; + vdso_th32->th_x86_pvc_last_systime[0] = 0; + vdso_th32->th_x86_pvc_last_systime[1] = 0; vdso_th32->th_x86_pvc_stable_mask = 0; bzero(vdso_th32->th_res, sizeof(vdso_th32->th_res)); return (1);