From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.zytor.com (terminus.zytor.com [198.137.202.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9FD1535CBC9; Wed, 12 Nov 2025 21:26:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.136 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762982770; cv=none; b=bG5zmyxH1HBnkjsu/vxuMwN+1igxF83N6v1v2Glxl7/nY9NmU8gJw89DpK7+Bsg+LVvXxRYv4XnTgyGI13bCyHYUsUVTxgnI66TcRoe2q/77NfCCbGV4dIdHX8MqnWQTmQwEeuFPNx0vg98bK/kL+KEI+dlFWuk+QNuGulpMpZU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762982770; c=relaxed/simple; bh=SioGFd0C7lxIkSMsxeKFwmjfLz0wr4SniCII2cKk08c=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=tSwOrHQiUSE3zx8wV9kOXW/8Prjeeus5XHtNpYfEW3v1pGehQ5TWqpcQmYAF1v8G57sgMBemvlmJovhpvUsHklS76n+NVqaNYNLwNgYkftxqL6NrBm2labcVJADX6V7DYPoZiTcHs/Ow+PaMmsDU4+e5Cq5sqsgp9UJLAnPndHk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zytor.com; spf=pass smtp.mailfrom=zytor.com; dkim=fail (2048-bit key) header.d=zytor.com header.i=@zytor.com header.b=l4sYpKrF reason="signature verification failed"; arc=none smtp.client-ip=198.137.202.136 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zytor.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zytor.com Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=zytor.com header.i=@zytor.com header.b="l4sYpKrF" Received: from [172.27.2.41] (c-76-133-66-138.hsd1.ca.comcast.net [76.133.66.138]) (authenticated bits=0) by mail.zytor.com (8.18.1/8.17.1) with ESMTPSA id 5ACLPBM51004081 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Wed, 12 Nov 2025 13:25:12 -0800 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 5ACLPBM51004081 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2025102301; t=1762982714; bh=8N8ijlsC6KhiWuu4QbjeYznaUps6aMGSWXMdwdxDAxw=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=l4sYpKrFCrAsnPAUyghmeRvLc4mPQ58O8qoEOPAzhg8jBuxPwak/5xDhgQWN78fys QSjKjYsvalXcxtnp9HzBoEO9qWXhDIdwf/mwzIQAdam4tfqTBiqVbrOwIPxfHQoLAw b47MS7R2RlNPoDYTPCOFO35llNJHDLZ32JwpBzoo/VDXeoj8K6OPCRL4/0wrcjT7KN MdFFSLf5wVH/PLLOFkI8gZtVJTzqi6kqtcDUYAveaXx2MXgCBoAwdEOCse1XChFlwr q6x51Xhio24ZjGTMigtf82gbuTS5LTfHI4ZHCnNNQzanQco9yEzECdXehZ6JdLUc3a knoLwc6mpTVhg== Message-ID: Date: Wed, 12 Nov 2025 13:25:11 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 7/9] x86/vdso: abstract out vdso system call internals To: Uros Bizjak Cc: "Jason A. Donenfeld" , "Peter Zijlstra (Intel)" , "Theodore Ts'o" , =?UTF-8?Q?Thomas_Wei=C3=9Fschuh?= , Xin Li , Andrew Cooper , Andy Lutomirski , Ard Biesheuvel , Borislav Petkov , Brian Gerst , Dave Hansen , Ingo Molnar , James Morse , Jarkko Sakkinen , Josh Poimboeuf , Kees Cook , Nam Cao , Oleg Nesterov , Perry Yuan , Thomas Gleixner , Thomas Huth , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-sgx@vger.kernel.org, x86@kernel.org References: <20251112043730.992152-1-hpa@zytor.com> <20251112043730.992152-8-hpa@zytor.com> Content-Language: en-US, sv-SE From: "H. Peter Anvin" In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 2025-11-12 02:31, Uros Bizjak wrote: > > Unfortunately, %ebp is still special with -fno-omit-frame-pointer, so > using "ebp" as _sys_arg6 on 32-bit targets will result in: > > error: bp cannot be used in ‘asm’ here > > Please see how %ebp register is handled in > arch/x86/include/asm/vmware.h, vmware_hypercall_hb_out() and > vmware_hypercall_hb_in(). > #ifdef CONFIG_X86_64 #define VMW_BP_CONSTRAINT "r" #else #define VMW_BP_CONSTRAINT "m" #endif asm_inline volatile ( UNWIND_HINT_SAVE "push %%" _ASM_BP "\n\t" UNWIND_HINT_UNDEFINED "mov %[in6], %%" _ASM_BP "\n\t" "rep outsb\n\t" "pop %%" _ASM_BP "\n\t" UNWIND_HINT_RESTORE : "=a" (out0), "=b" (*out1) : "a" (VMWARE_HYPERVISOR_MAGIC), "b" (cmd), "c" (in2), "d" (in3 | VMWARE_HYPERVISOR_PORT_HB), "S" (in4), "D" (in5), [in6] VMW_BP_CONSTRAINT (in6) : "cc", "memory"); return out0; That code is actually incorrect, in at least two ways: 1. It should be conditioned on frame pointers enabled, not x86-64 vs i386. 2. The compiler is perfectly within its right to emit an %esp-relative reference for the "m"-constrained [in6]. This is particularly likely when *not* compiled with frame pointers, see #1. A better sequence might be: pushl %[in6] push %ebp mov 4(%esp),%ebp pop %ebp pop %[junk] Then %[in6] can even safely be a "g" constraint (hence pushl). -hpa