From patchwork Tue Apr 30 12:21:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Doucha X-Patchwork-Id: 1929473 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=olRsQp56; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=KcUs0nkz; dkim=fail reason="signature verification failed" (1024-bit key) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=olRsQp56; dkim=neutral header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=KcUs0nkz; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=patchwork.ozlabs.org) Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VTKBw3XyMz1ydT for ; Tue, 30 Apr 2024 22:24:40 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 147153CB3BC for ; Tue, 30 Apr 2024 14:24:38 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [IPv6:2001:4b78:1:20::4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 119693CB3BC for ; Tue, 30 Apr 2024 14:23:06 +0200 (CEST) Authentication-Results: in-4.smtp.seeweb.it; spf=pass (sender SPF authorized) smtp.mailfrom=suse.cz (client-ip=2a07:de40:b251:101:10:150:64:2; helo=smtp-out2.suse.de; envelope-from=mdoucha@suse.cz; receiver=lists.linux.it) Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-4.smtp.seeweb.it (Postfix) with ESMTPS id 2B6761000998 for ; Tue, 30 Apr 2024 14:23:05 +0200 (CEST) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (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) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id B224A1F7D6 for ; Tue, 30 Apr 2024 12:23:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1714479784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TA7oPB/IDU9+cpmzLEeDB+Bm85wlNVBliIUpkV/KRmE=; b=olRsQp56Ig7LgG1yXisf7k14jKOyp7Mm270qbjEysDfPmTlK/d7sFWwLhzbJKooyF/ryJd tcWOUU6D05YQr4RxkUJYVxRyxSy39GcYCBwYF6WViSveS/tKlzgxpOrN17nmTL4scDzCl4 0vibdkQZgOU2AlVj1CAQc7mfXQydSEY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1714479784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TA7oPB/IDU9+cpmzLEeDB+Bm85wlNVBliIUpkV/KRmE=; b=KcUs0nkzv6B2yY+y2ieqSCbamSJTBfpd2OytOQY9ZZJPsqdFnOs93e8uMWH3LzaVbcWceD LA0OyFP8z36RWFDQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1714479784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TA7oPB/IDU9+cpmzLEeDB+Bm85wlNVBliIUpkV/KRmE=; b=olRsQp56Ig7LgG1yXisf7k14jKOyp7Mm270qbjEysDfPmTlK/d7sFWwLhzbJKooyF/ryJd tcWOUU6D05YQr4RxkUJYVxRyxSy39GcYCBwYF6WViSveS/tKlzgxpOrN17nmTL4scDzCl4 0vibdkQZgOU2AlVj1CAQc7mfXQydSEY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1714479784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TA7oPB/IDU9+cpmzLEeDB+Bm85wlNVBliIUpkV/KRmE=; b=KcUs0nkzv6B2yY+y2ieqSCbamSJTBfpd2OytOQY9ZZJPsqdFnOs93e8uMWH3LzaVbcWceD LA0OyFP8z36RWFDQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (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) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id AB9EC137BA for ; Tue, 30 Apr 2024 12:23:04 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap1.dmz-prg2.suse.org with ESMTPSA id 4Fu4KajiMGaQHAAAD6G6ig (envelope-from ) for ; Tue, 30 Apr 2024 12:23:04 +0000 From: Martin Doucha To: ltp@lists.linux.it Date: Tue, 30 Apr 2024 14:21:57 +0200 Message-ID: <20240430122208.13043-2-mdoucha@suse.cz> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240430122208.13043-1-mdoucha@suse.cz> References: <20240430122208.13043-1-mdoucha@suse.cz> MIME-Version: 1.0 X-Spam-Score: -1.33 X-Spam-Level: X-Spamd-Result: default: False [-1.33 / 50.00]; BAYES_HAM(-1.53)[91.95%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.cz:email]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[ltp@lists.linux.it]; RCVD_TLS_ALL(0.00)[] X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-4.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-4.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH 1/9] KVM: Disable EBP register use in 32bit code X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" The EBP register points to the stack segment by default but GCC uses it to access data segment without the proper prefix. This works fine on most systems because the stack and data segments are usually identical. However, KVM environment intentionally enforces strict limits on the stack segment and access to the data segment using unprefixed EBP would trigger stack segment fault exception in 32bit LTP builds (stack segment limits are ignored in 64bit mode). Signed-off-by: Martin Doucha Reviewed-by: Petr Vorel --- testcases/kernel/kvm/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testcases/kernel/kvm/Makefile b/testcases/kernel/kvm/Makefile index ce4a5ede2..c85790e11 100644 --- a/testcases/kernel/kvm/Makefile +++ b/testcases/kernel/kvm/Makefile @@ -22,7 +22,7 @@ ifeq ($(HOST_CPU),x86_64) endif ifeq ($(HOST_CPU),x86) - GUEST_CFLAGS += -m32 + GUEST_CFLAGS += -m32 -ffixed-ebp ASFLAGS += --32 endif From patchwork Tue Apr 30 12:21:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Doucha X-Patchwork-Id: 1929475 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=XxwwW+PQ; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=TQrpgnRE; dkim=fail reason="signature verification failed" (1024-bit key) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=XxwwW+PQ; dkim=neutral header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=TQrpgnRE; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=patchwork.ozlabs.org) Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VTKCc5l3Lz23jG for ; Tue, 30 Apr 2024 22:25:16 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 656493CB66E for ; Tue, 30 Apr 2024 14:25:14 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [217.194.8.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 177763CB3DC for ; Tue, 30 Apr 2024 14:23:07 +0200 (CEST) Authentication-Results: in-5.smtp.seeweb.it; spf=pass (sender SPF authorized) smtp.mailfrom=suse.cz (client-ip=2a07:de40:b251:101:10:150:64:1; helo=smtp-out1.suse.de; envelope-from=mdoucha@suse.cz; receiver=lists.linux.it) Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2a07:de40:b251:101:10:150:64:1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id 6544D6096AB for ; Tue, 30 Apr 2024 14:23:06 +0200 (CEST) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (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) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id BA94134027 for ; Tue, 30 Apr 2024 12:23:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1714479784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Q7hDB+Pli+R8oTq/6OjXX3jJvQ6OjxEE8ZErS4P3D7I=; b=XxwwW+PQwVdCLrRJhAR5krVcaxXwPBaRSRh/jPPi/GJkcGkPlTIDoGsqTrfk1DQFGWeVgu qFYe0EyKSvXa09yoVklXcKCNO8MAjYLOYql61pFLbwK86EuyJhuJ8Pqzvs4sHtsAvmi+v2 FDgFWBZhqFg0H+NhmK6J1JqNoNFxaro= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1714479784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Q7hDB+Pli+R8oTq/6OjXX3jJvQ6OjxEE8ZErS4P3D7I=; b=TQrpgnRE7+kYP0z9kzeuM9uazWFluFp/r5AicnYMZRl2MumKAficL7eT6YZlp7XyMBzrpz p3BmiJ3OmypAWqDw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=XxwwW+PQ; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=TQrpgnRE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1714479784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Q7hDB+Pli+R8oTq/6OjXX3jJvQ6OjxEE8ZErS4P3D7I=; b=XxwwW+PQwVdCLrRJhAR5krVcaxXwPBaRSRh/jPPi/GJkcGkPlTIDoGsqTrfk1DQFGWeVgu qFYe0EyKSvXa09yoVklXcKCNO8MAjYLOYql61pFLbwK86EuyJhuJ8Pqzvs4sHtsAvmi+v2 FDgFWBZhqFg0H+NhmK6J1JqNoNFxaro= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1714479784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Q7hDB+Pli+R8oTq/6OjXX3jJvQ6OjxEE8ZErS4P3D7I=; b=TQrpgnRE7+kYP0z9kzeuM9uazWFluFp/r5AicnYMZRl2MumKAficL7eT6YZlp7XyMBzrpz p3BmiJ3OmypAWqDw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (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) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id AF2A213991 for ; Tue, 30 Apr 2024 12:23:04 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap1.dmz-prg2.suse.org with ESMTPSA id yNGfKqjiMGaQHAAAD6G6ig (envelope-from ) for ; Tue, 30 Apr 2024 12:23:04 +0000 From: Martin Doucha To: ltp@lists.linux.it Date: Tue, 30 Apr 2024 14:21:58 +0200 Message-ID: <20240430122208.13043-3-mdoucha@suse.cz> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240430122208.13043-1-mdoucha@suse.cz> References: <20240430122208.13043-1-mdoucha@suse.cz> MIME-Version: 1.0 X-Spam-Score: -3.01 X-Rspamd-Action: no action X-Rspamd-Queue-Id: BA94134027 X-Spam-Level: X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_COUNT_TWO(0.00)[2]; ARC_NA(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; FROM_EQ_ENVFROM(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.cz:dkim,suse.cz:email,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; RCVD_TLS_ALL(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[ltp@lists.linux.it]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; DKIM_TRACE(0.00)[suse.cz:+] X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-5.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-5.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH 2/9] KVM: Implement strchr() and basic sprintf() X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Add basic implementation of sprintf() that supports string, pointer and integer arguments but without advanced formatting options like field alignment and padding. Signed-off-by: Martin Doucha --- testcases/kernel/kvm/include/kvm_guest.h | 11 + testcases/kernel/kvm/lib_guest.c | 312 +++++++++++++++++++++++ 2 files changed, 323 insertions(+) diff --git a/testcases/kernel/kvm/include/kvm_guest.h b/testcases/kernel/kvm/include/kvm_guest.h index 96f246155..f19bacc39 100644 --- a/testcases/kernel/kvm/include/kvm_guest.h +++ b/testcases/kernel/kvm/include/kvm_guest.h @@ -39,9 +39,15 @@ typedef unsigned int uint32_t; typedef long long int64_t; typedef unsigned long long uint64_t; typedef unsigned long uintptr_t; +typedef __builtin_va_list va_list; #define NULL ((void *)0) +#define va_start __builtin_va_start +#define va_arg __builtin_va_arg +#define va_end __builtin_va_end +#define va_copy __builtin_va_copy + void *memset(void *dest, int val, size_t size); void *memzero(void *dest, size_t size); void *memcpy(void *dest, const void *src, size_t size); @@ -49,6 +55,11 @@ void *memcpy(void *dest, const void *src, size_t size); char *strcpy(char *dest, const char *src); char *strcat(char *dest, const char *src); size_t strlen(const char *str); +char *strchr(const char *s, int c); +char *strrchr(const char *s, int c); + +int vsprintf(char *dest, const char *fmt, va_list ap); +int sprintf(char *dest, const char *fmt, ...); /* Exit the VM by looping on a HLT instruction forever */ void kvm_exit(void) __attribute__((noreturn)); diff --git a/testcases/kernel/kvm/lib_guest.c b/testcases/kernel/kvm/lib_guest.c index f3e21d3d6..73a76ccb1 100644 --- a/testcases/kernel/kvm/lib_guest.c +++ b/testcases/kernel/kvm/lib_guest.c @@ -76,6 +76,74 @@ size_t strlen(const char *str) return ret; } +char *strchr(const char *s, int c) +{ + for (; *s; s++) { + if (*s == c) + return (char *)s; + } + + return NULL; +} + +char *strrchr(const char *s, int c) +{ + const char *ret = NULL; + + for (; *s; s++) { + if (*s == c) + ret = s; + } + + return (char *)ret; +} + +#if defined(__x86_64__) && !defined(__ILP32__) +uint64_t u64divu16(uint64_t a, uint16_t b) +{ + return a / b; +} + +unsigned int u64modu16(uint64_t a, uint16_t b) +{ + return a % b; +} + +#else /* defined(__x86_64__) && !defined(__ILP32__) */ + +/* u64 short division helpers to avoid need to link libgcc on 32bit archs */ +uint64_t u64divu16(uint64_t a, uint16_t b) +{ + uint64_t ret = 0; + uint32_t tmp = a >> 32; + + ret = tmp / b; + ret <<= 32; + tmp %= b; + tmp <<= 16; + tmp |= (a >> 16) & 0xffff; + ret |= (tmp / b) << 16; + tmp %= b; + tmp <<= 16; + tmp |= a & 0xffff; + ret |= tmp / b; + return ret; +} + +unsigned int u64modu16(uint64_t a, uint16_t b) +{ + uint32_t tmp = a >> 32; + + tmp %= b; + tmp <<= 16; + tmp |= (a >> 16) & 0xffff; + tmp %= b; + tmp <<= 16; + tmp |= a & 0xffff; + return tmp % b; +} +#endif /* defined(__x86_64__) && !defined(__ILP32__) */ + char *ptr2hex(char *dest, uintptr_t val) { unsigned int i; @@ -95,6 +163,250 @@ char *ptr2hex(char *dest, uintptr_t val) return ret; } +char *u64tostr(char *dest, uint64_t val, uint16_t base, int caps) +{ + unsigned int i; + uintptr_t tmp = u64divu16(val, base); + char hex = caps ? 'A' : 'a'; + char *ret = dest; + + for (i = 1; tmp; i++, tmp = u64divu16(tmp, base)) + ; + + dest[i] = '\0'; + + do { + tmp = u64modu16(val, base); + dest[--i] = tmp + (tmp >= 10 ? hex - 10 : '0'); + val = u64divu16(val, base); + } while (i); + + return ret; +} + +char *i64tostr(char *dest, int64_t val) +{ + if (val < 0) { + dest[0] = '-'; + u64tostr(dest + 1, -val, 10, 0); + return dest; + } + + return u64tostr(dest, val, 10, 0); +} + +int vsprintf(char *dest, const char *fmt, va_list ap) +{ + va_list args; + int ret = 0; + char conv; + uint64_t u64val = 0; + int64_t i64val = 0; + const char * const uint_conv = "ouxX"; + + va_copy(args, ap); + + for (; *fmt; fmt++) { + if (*fmt != '%') { + dest[ret++] = *fmt; + continue; + } + + conv = 0; + fmt++; + + switch (*fmt) { + case '%': + dest[ret++] = *fmt; + break; + + case 'c': + dest[ret++] = va_arg(args, int); + break; + + case 's': + strcpy(dest + ret, va_arg(args, const char *)); + ret += strlen(dest + ret); + break; + + case 'p': + strcpy(dest + ret, "0x"); + ptr2hex(dest + ret + 2, + (uintptr_t)va_arg(args, void *)); + ret += strlen(dest + ret); + break; + + case 'l': + fmt++; + + switch (*fmt) { + case 'l': + fmt++; + + if (*fmt == 'd' || *fmt == 'i') { + i64val = va_arg(args, long long); + conv = *fmt; + break; + } + + if (strchr(uint_conv, *fmt)) { + u64val = va_arg(args, + unsigned long long); + conv = *fmt; + break; + } + + va_end(args); + return -1; + + case 'd': + case 'i': + i64val = va_arg(args, long); + conv = *fmt; + break; + + default: + if (strchr(uint_conv, *fmt)) { + u64val = va_arg(args, + unsigned long); + conv = *fmt; + break; + } + + va_end(args); + return -1; + } + break; + + case 'h': + fmt++; + + switch (*fmt) { + case 'h': + fmt++; + + if (*fmt == 'd' || *fmt == 'i') { + i64val = (signed char)va_arg(args, int); + conv = *fmt; + break; + } + + if (strchr(uint_conv, *fmt)) { + u64val = (unsigned char)va_arg(args, + unsigned int); + conv = *fmt; + break; + } + + va_end(args); + return -1; + + case 'd': + case 'i': + i64val = (short int)va_arg(args, int); + conv = *fmt; + break; + + default: + if (strchr(uint_conv, *fmt)) { + u64val = (unsigned short int)va_arg( + args, unsigned int); + conv = *fmt; + break; + } + + va_end(args); + return -1; + } + break; + + case 'z': + fmt++; + + if (*fmt == 'd' || *fmt == 'i') { + i64val = va_arg(args, ssize_t); + conv = *fmt; + break; + } + + if (strchr(uint_conv, *fmt)) { + u64val = va_arg(args, size_t); + conv = *fmt; + break; + } + + va_end(args); + return -1; + + case 'd': + case 'i': + i64val = va_arg(args, int); + conv = *fmt; + break; + + default: + if (strchr(uint_conv, *fmt)) { + u64val = va_arg(args, unsigned int); + conv = *fmt; + break; + } + + va_end(args); + return -1; + } + + switch (conv) { + case 0: + continue; + + case 'd': + case 'i': + i64tostr(dest + ret, i64val); + ret += strlen(dest + ret); + break; + + case 'o': + u64tostr(dest + ret, u64val, 8, 0); + ret += strlen(dest + ret); + break; + + case 'u': + u64tostr(dest + ret, u64val, 10, 0); + ret += strlen(dest + ret); + break; + + case 'x': + u64tostr(dest + ret, u64val, 16, 0); + ret += strlen(dest + ret); + break; + + case 'X': + u64tostr(dest + ret, u64val, 16, 1); + ret += strlen(dest + ret); + break; + + default: + va_end(args); + return -1; + } + } + + va_end(args); + dest[ret++] = '\0'; + return ret; +} + +int sprintf(char *dest, const char *fmt, ...) +{ + va_list args; + int ret; + + va_start(args, fmt); + ret = vsprintf(dest, fmt, args); + va_end(args); + return ret; +} + void *tst_heap_alloc_aligned(size_t size, size_t align) { uintptr_t addr = (uintptr_t)heap_end; From patchwork Tue Apr 30 12:21:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Doucha X-Patchwork-Id: 1929469 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=sVp/UV50; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=2aU+PI7M; dkim=fail reason="signature verification failed" (1024-bit key) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=sVp/UV50; dkim=neutral header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=2aU+PI7M; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=patchwork.ozlabs.org) Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VTK9x1FPhz1ydT for ; Tue, 30 Apr 2024 22:23:49 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id CCB653CB42F for ; Tue, 30 Apr 2024 14:23:46 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-2.smtp.seeweb.it (in-2.smtp.seeweb.it [217.194.8.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 1E6263CB3E0 for ; Tue, 30 Apr 2024 14:23:07 +0200 (CEST) Authentication-Results: in-2.smtp.seeweb.it; spf=pass (sender SPF authorized) smtp.mailfrom=suse.cz (client-ip=2a07:de40:b251:101:10:150:64:1; helo=smtp-out1.suse.de; envelope-from=mdoucha@suse.cz; receiver=lists.linux.it) Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2a07:de40:b251:101:10:150:64:1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-2.smtp.seeweb.it (Postfix) with ESMTPS id 70CE26177C3 for ; Tue, 30 Apr 2024 14:23:06 +0200 (CEST) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (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) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id D42E73402C for ; Tue, 30 Apr 2024 12:23:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1714479784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QH4KW/xq5SPnprgSog0udCFFYWoGJpk7tqh9rpVlk/0=; b=sVp/UV50SgDVCALQe6OFBQGqwHMaB+JcjSBWEsXM9LOyWem0AWmNOi5Q+Wf1zM0n5uVz+l o2zlN24agpIr7J6Uxqwh+YXxJC56ZPsJhjC4fEQNJ06VIrGN57HuTC0GcZXirYZBxoYN/x FTQPkvYyAZVs4mwMFyeA41L00P68+TU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1714479784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QH4KW/xq5SPnprgSog0udCFFYWoGJpk7tqh9rpVlk/0=; b=2aU+PI7MyW0Lt4hnQ5I8UmtNzOxgQW8oJz3slAek1a053Mv2KANwI4HxJEGt4nzflBIcUG xm1Wb0H1fP3dmXDA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1714479784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QH4KW/xq5SPnprgSog0udCFFYWoGJpk7tqh9rpVlk/0=; b=sVp/UV50SgDVCALQe6OFBQGqwHMaB+JcjSBWEsXM9LOyWem0AWmNOi5Q+Wf1zM0n5uVz+l o2zlN24agpIr7J6Uxqwh+YXxJC56ZPsJhjC4fEQNJ06VIrGN57HuTC0GcZXirYZBxoYN/x FTQPkvYyAZVs4mwMFyeA41L00P68+TU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1714479784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QH4KW/xq5SPnprgSog0udCFFYWoGJpk7tqh9rpVlk/0=; b=2aU+PI7MyW0Lt4hnQ5I8UmtNzOxgQW8oJz3slAek1a053Mv2KANwI4HxJEGt4nzflBIcUG xm1Wb0H1fP3dmXDA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (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) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id B43B2139B3 for ; Tue, 30 Apr 2024 12:23:04 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap1.dmz-prg2.suse.org with ESMTPSA id kFrfK6jiMGaQHAAAD6G6ig (envelope-from ) for ; Tue, 30 Apr 2024 12:23:04 +0000 From: Martin Doucha To: ltp@lists.linux.it Date: Tue, 30 Apr 2024 14:21:59 +0200 Message-ID: <20240430122208.13043-4-mdoucha@suse.cz> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240430122208.13043-1-mdoucha@suse.cz> References: <20240430122208.13043-1-mdoucha@suse.cz> MIME-Version: 1.0 X-Spam-Level: X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.cz:email,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[ltp@lists.linux.it]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-2.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-2.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH 3/9] KVM: Implement printf-like formatting for tst_res() and tst_brk() X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Signed-off-by: Martin Doucha --- testcases/kernel/kvm/include/kvm_guest.h | 12 +++++--- testcases/kernel/kvm/lib_guest.c | 36 +++++++++++++++++++++--- 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/testcases/kernel/kvm/include/kvm_guest.h b/testcases/kernel/kvm/include/kvm_guest.h index f19bacc39..080d0ac2b 100644 --- a/testcases/kernel/kvm/include/kvm_guest.h +++ b/testcases/kernel/kvm/include/kvm_guest.h @@ -68,12 +68,16 @@ void kvm_exit(void) __attribute__((noreturn)); void kvm_yield(void); void tst_res_(const char *file, const int lineno, int result, - const char *message); -#define tst_res(result, msg) tst_res_(__FILE__, __LINE__, (result), (msg)) + const char *fmt, ...) + __attribute__ ((format (printf, 4, 5))); +#define tst_res(result, fmt, ...) \ + tst_res_(__FILE__, __LINE__, (result), (fmt), ##__VA_ARGS__) void tst_brk_(const char *file, const int lineno, int result, - const char *message) __attribute__((noreturn)); -#define tst_brk(result, msg) tst_brk_(__FILE__, __LINE__, (result), (msg)) + const char *fmt, ...) __attribute__((noreturn)) + __attribute__ ((format (printf, 4, 5))); +#define tst_brk(result, fmt, ...) \ + tst_brk_(__FILE__, __LINE__, (result), (fmt), ##__VA_ARGS__) /* * Send asynchronous notification to host without stopping VM execution and diff --git a/testcases/kernel/kvm/lib_guest.c b/testcases/kernel/kvm/lib_guest.c index 73a76ccb1..2e3e9cb6e 100644 --- a/testcases/kernel/kvm/lib_guest.c +++ b/testcases/kernel/kvm/lib_guest.c @@ -443,6 +443,7 @@ static void tst_fatal_error(const char *file, const int lineno, test_result->result = TBROK; test_result->lineno = lineno; test_result->file_addr = (uintptr_t)file; + /* Avoid sprintf() here in case of bugs */ strcpy(test_result->message, message); strcat(test_result->message, " at address 0x"); ptr2hex(test_result->message + strlen(test_result->message), ip); @@ -451,19 +452,46 @@ static void tst_fatal_error(const char *file, const int lineno, } void tst_res_(const char *file, const int lineno, int result, - const char *message) + const char *fmt, ...) { + va_list args; + int ret; + + va_start(args, fmt); test_result->result = result; test_result->lineno = lineno; test_result->file_addr = (uintptr_t)file; - strcpy(test_result->message, message); + ret = vsprintf(test_result->message, fmt, args); + va_end(args); + + if (ret < 0) { + tst_brk_(file, lineno, TBROK, "Invalid tst_res() format: %s", + fmt); + } + kvm_yield(); } void tst_brk_(const char *file, const int lineno, int result, - const char *message) + const char *fmt, ...) { - tst_res_(file, lineno, result, message); + va_list args; + int ret; + + va_start(args, fmt); + test_result->result = result; + test_result->lineno = lineno; + test_result->file_addr = (uintptr_t)file; + ret = vsprintf(test_result->message, fmt, args); + va_end(args); + + if (ret < 0) { + test_result->result = TBROK; + strcpy(test_result->message, "Invalid tst_brk() format: "); + strcat(test_result->message, fmt); + } + + kvm_yield(); kvm_exit(); } From patchwork Tue Apr 30 12:22:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Doucha X-Patchwork-Id: 1929467 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=YVlZPDtx; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=4GkueORB; dkim=fail reason="signature verification failed" (1024-bit key) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=YVlZPDtx; dkim=neutral header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=4GkueORB; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=patchwork.ozlabs.org) Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VTK9J39kJz1ydT for ; Tue, 30 Apr 2024 22:23:13 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id DE5D03CB3E0 for ; Tue, 30 Apr 2024 14:23:09 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-7.smtp.seeweb.it (in-7.smtp.seeweb.it [217.194.8.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 9EE973C88E3 for ; Tue, 30 Apr 2024 14:23:06 +0200 (CEST) Authentication-Results: in-7.smtp.seeweb.it; spf=pass (sender SPF authorized) smtp.mailfrom=suse.cz (client-ip=195.135.223.130; helo=smtp-out1.suse.de; envelope-from=mdoucha@suse.cz; receiver=lists.linux.it) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-7.smtp.seeweb.it (Postfix) with ESMTPS id 1E528200C18 for ; Tue, 30 Apr 2024 14:23:05 +0200 (CEST) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (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) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id CBE6A3402B for ; Tue, 30 Apr 2024 12:23:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1714479784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=A9lcW4E//q+U168SqvJeCBa9DmrnsSTOXTISJtmRyD0=; b=YVlZPDtx0SPa3aK7FkakFV8HGdAtIbldmXl7HtGUhzRE7tmGr/pipRQDzxfBL3siJwM5fS g0M/Kzm8ZMIz9SvQW9zRjVkH/ZBkz5oGqNHH9IA+eInKh9o9XKKuEnnitBsAKdYxYQ4FJD j7br0SMcvQ6L1pUSIchibws+eqMiiKI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1714479784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=A9lcW4E//q+U168SqvJeCBa9DmrnsSTOXTISJtmRyD0=; b=4GkueORBLO52A1iss2OXzIvrI8QrtHkIh1OcguLXkIK7pP08Mp/kFsldUhlPlBvrdCUm0H UqFFP95KmhlusHAw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1714479784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=A9lcW4E//q+U168SqvJeCBa9DmrnsSTOXTISJtmRyD0=; b=YVlZPDtx0SPa3aK7FkakFV8HGdAtIbldmXl7HtGUhzRE7tmGr/pipRQDzxfBL3siJwM5fS g0M/Kzm8ZMIz9SvQW9zRjVkH/ZBkz5oGqNHH9IA+eInKh9o9XKKuEnnitBsAKdYxYQ4FJD j7br0SMcvQ6L1pUSIchibws+eqMiiKI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1714479784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=A9lcW4E//q+U168SqvJeCBa9DmrnsSTOXTISJtmRyD0=; b=4GkueORBLO52A1iss2OXzIvrI8QrtHkIh1OcguLXkIK7pP08Mp/kFsldUhlPlBvrdCUm0H UqFFP95KmhlusHAw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (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) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id C280F13A22 for ; Tue, 30 Apr 2024 12:23:04 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap1.dmz-prg2.suse.org with ESMTPSA id uBdbL6jiMGaQHAAAD6G6ig (envelope-from ) for ; Tue, 30 Apr 2024 12:23:04 +0000 From: Martin Doucha To: ltp@lists.linux.it Date: Tue, 30 Apr 2024 14:22:00 +0200 Message-ID: <20240430122208.13043-5-mdoucha@suse.cz> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240430122208.13043-1-mdoucha@suse.cz> References: <20240430122208.13043-1-mdoucha@suse.cz> MIME-Version: 1.0 X-Spam-Level: X-Spamd-Result: default: False [-2.76 / 50.00]; BAYES_HAM(-2.96)[99.81%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.cz:email]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[ltp@lists.linux.it]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.76 X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-7.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-7.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH 4/9] kvm_svm02: Fix saved stack segment index value X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" The VMCB init helper function expects GDT item index while the VMCB segment selector values are byte offsets. Shift the byte offset of saved stack segment selector to get the correct GDT index. Signed-off-by: Martin Doucha --- testcases/kernel/kvm/kvm_svm02.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testcases/kernel/kvm/kvm_svm02.c b/testcases/kernel/kvm/kvm_svm02.c index 5d2e2ce37..f72fb3812 100644 --- a/testcases/kernel/kvm/kvm_svm02.c +++ b/testcases/kernel/kvm/kvm_svm02.c @@ -96,7 +96,7 @@ void main(void) vmsave_buf = kvm_alloc_vmcb(); /* Save allocated stack for later VM reinit */ - ss = vcpu->vmcb->ss.selector; + ss = vcpu->vmcb->ss.selector >> 3; rsp = vcpu->vmcb->rsp; /* Load partial state from vmsave_buf and save it to vcpu->vmcb */ From patchwork Tue Apr 30 12:22:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Doucha X-Patchwork-Id: 1929474 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=p1dD4cUJ; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=emYEALKs; dkim=fail reason="signature verification failed" (1024-bit key) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=p1dD4cUJ; dkim=neutral header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=emYEALKs; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=patchwork.ozlabs.org) Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VTKCC3Kwzz1ydT for ; Tue, 30 Apr 2024 22:24:55 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id F13233CB4C8 for ; Tue, 30 Apr 2024 14:24:52 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [217.194.8.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id AACEC3CB23E for ; Tue, 30 Apr 2024 14:23:06 +0200 (CEST) Authentication-Results: in-4.smtp.seeweb.it; spf=pass (sender SPF authorized) smtp.mailfrom=suse.cz (client-ip=195.135.223.131; helo=smtp-out2.suse.de; envelope-from=mdoucha@suse.cz; receiver=lists.linux.it) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-4.smtp.seeweb.it (Postfix) with ESMTPS id 1F0671000969 for ; Tue, 30 Apr 2024 14:23:05 +0200 (CEST) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (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) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id DFC341F7D7 for ; Tue, 30 Apr 2024 12:23:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1714479784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=spcCpeH1gsuX8FKv1CZsWToPSV4ezHbmXmp+BA6oJ1Q=; b=p1dD4cUJ3Y8HS1rS3gwOjcC0WwLTSYRrBaCqaNxgsftKUeHUYK96Bek2hkYWJmCn//SPK7 sSR4RjhqmNc3O9znaaEu9KQ6HfdA2hco8qyh66yrUzozlt/7Y318WiWCTlKjCi4EC2dTrm 2lrLv5KP1Gur3D4eVHZtiE1Ar3h0TNY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1714479784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=spcCpeH1gsuX8FKv1CZsWToPSV4ezHbmXmp+BA6oJ1Q=; b=emYEALKsJwsiSS42Yi4Yig5s4z8ACSOWDjZKQo0k2Wcw56NrnsoA/WHYlM3CVtKC3djOn6 cP0O7eHk2iq5YrBA== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=p1dD4cUJ; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=emYEALKs DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1714479784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=spcCpeH1gsuX8FKv1CZsWToPSV4ezHbmXmp+BA6oJ1Q=; b=p1dD4cUJ3Y8HS1rS3gwOjcC0WwLTSYRrBaCqaNxgsftKUeHUYK96Bek2hkYWJmCn//SPK7 sSR4RjhqmNc3O9znaaEu9KQ6HfdA2hco8qyh66yrUzozlt/7Y318WiWCTlKjCi4EC2dTrm 2lrLv5KP1Gur3D4eVHZtiE1Ar3h0TNY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1714479784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=spcCpeH1gsuX8FKv1CZsWToPSV4ezHbmXmp+BA6oJ1Q=; b=emYEALKsJwsiSS42Yi4Yig5s4z8ACSOWDjZKQo0k2Wcw56NrnsoA/WHYlM3CVtKC3djOn6 cP0O7eHk2iq5YrBA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (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) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id C590113A23 for ; Tue, 30 Apr 2024 12:23:04 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap1.dmz-prg2.suse.org with ESMTPSA id YEweMKjiMGaQHAAAD6G6ig (envelope-from ) for ; Tue, 30 Apr 2024 12:23:04 +0000 From: Martin Doucha To: ltp@lists.linux.it Date: Tue, 30 Apr 2024 14:22:01 +0200 Message-ID: <20240430122208.13043-6-mdoucha@suse.cz> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240430122208.13043-1-mdoucha@suse.cz> References: <20240430122208.13043-1-mdoucha@suse.cz> MIME-Version: 1.0 X-Spam-Score: -2.90 X-Rspamd-Action: no action X-Rspamd-Queue-Id: DFC341F7D7 X-Spam-Level: X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-2.90 / 50.00]; BAYES_HAM(-2.89)[99.51%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_COUNT_TWO(0.00)[2]; ARC_NA(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; FROM_EQ_ENVFROM(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.cz:dkim,suse.cz:email,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; RCVD_TLS_ALL(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[ltp@lists.linux.it]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; DKIM_TRACE(0.00)[suse.cz:+] X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-4.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-4.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH 5/9] kvm_find_free_descriptor(): Skip descriptor 0 X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" The GDT/LDT descriptor 0 should always be empty. Start search for free descriptor table entry at index 1. Signed-off-by: Martin Doucha --- testcases/kernel/kvm/lib_x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testcases/kernel/kvm/lib_x86.c b/testcases/kernel/kvm/lib_x86.c index 3e6656f11..1c0e629c3 100644 --- a/testcases/kernel/kvm/lib_x86.c +++ b/testcases/kernel/kvm/lib_x86.c @@ -174,7 +174,7 @@ int kvm_find_free_descriptor(const struct segment_descriptor *table, const struct segment_descriptor *ptr; size_t i; - for (i = 0, ptr = table; i < size; i++, ptr++) { + for (i = 1, ptr = table + 1; i < size; i++, ptr++) { if (!(ptr->flags_lo & SEGFLAG_PRESENT)) return i; From patchwork Tue Apr 30 12:22:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Doucha X-Patchwork-Id: 1929476 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=Y0InE+cl; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=tWs8iLYz; dkim=fail reason="signature verification failed" (1024-bit key) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=Y0InE+cl; dkim=neutral header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=tWs8iLYz; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=patchwork.ozlabs.org) Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VTKCx1zbxz23jG for ; Tue, 30 Apr 2024 22:25:33 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id EA6283CB4D9 for ; Tue, 30 Apr 2024 14:25:30 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [IPv6:2001:4b78:1:20::5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 09B543CB38A for ; Tue, 30 Apr 2024 14:23:06 +0200 (CEST) Authentication-Results: in-5.smtp.seeweb.it; spf=pass (sender SPF authorized) smtp.mailfrom=suse.cz (client-ip=2a07:de40:b251:101:10:150:64:2; helo=smtp-out2.suse.de; envelope-from=mdoucha@suse.cz; receiver=lists.linux.it) Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id 23B2E609695 for ; Tue, 30 Apr 2024 14:23:05 +0200 (CEST) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (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) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id E2C141F7D9 for ; Tue, 30 Apr 2024 12:23:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1714479784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NIVp0PQ6/thyZRhb8Ku+RpYFD8jB3xo9jSMP4RRKuCA=; b=Y0InE+clZ1R0YeF4k8NleaN3/3rCB1moFQg27L6qXrC0dP9BoNSz8WBeIEXlJ2SCs5xHYb 4TRt6UzobSg8psLn+WJMvwkxXQ9AascCN5XkcAFFnsrI75EnZM/3rC7PkpC4TonMoCt3p6 0EDGk1XJ7SXiZgJrMAlUv7zWCnoXPYg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1714479784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NIVp0PQ6/thyZRhb8Ku+RpYFD8jB3xo9jSMP4RRKuCA=; b=tWs8iLYzMy6GHqcq82dxjS20BhKpxRvr1sTnQUxWHbq/vbc0Y3s7LDd+VHjir7ODlyATs/ RoN4wt2RK8gXTtBg== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1714479784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NIVp0PQ6/thyZRhb8Ku+RpYFD8jB3xo9jSMP4RRKuCA=; b=Y0InE+clZ1R0YeF4k8NleaN3/3rCB1moFQg27L6qXrC0dP9BoNSz8WBeIEXlJ2SCs5xHYb 4TRt6UzobSg8psLn+WJMvwkxXQ9AascCN5XkcAFFnsrI75EnZM/3rC7PkpC4TonMoCt3p6 0EDGk1XJ7SXiZgJrMAlUv7zWCnoXPYg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1714479784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NIVp0PQ6/thyZRhb8Ku+RpYFD8jB3xo9jSMP4RRKuCA=; b=tWs8iLYzMy6GHqcq82dxjS20BhKpxRvr1sTnQUxWHbq/vbc0Y3s7LDd+VHjir7ODlyATs/ RoN4wt2RK8gXTtBg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (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) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id C8A6C13A24 for ; Tue, 30 Apr 2024 12:23:04 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap1.dmz-prg2.suse.org with ESMTPSA id cGrbMKjiMGaQHAAAD6G6ig (envelope-from ) for ; Tue, 30 Apr 2024 12:23:04 +0000 From: Martin Doucha To: ltp@lists.linux.it Date: Tue, 30 Apr 2024 14:22:02 +0200 Message-ID: <20240430122208.13043-7-mdoucha@suse.cz> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240430122208.13043-1-mdoucha@suse.cz> References: <20240430122208.13043-1-mdoucha@suse.cz> MIME-Version: 1.0 X-Spam-Level: X-Spamd-Result: default: False [0.20 / 50.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; BAYES_HAM(-0.00)[40.89%]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.cz:email]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[ltp@lists.linux.it]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: 0.20 X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-5.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-5.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH 6/9] KVM: Add system control MSR constants X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Signed-off-by: Martin Doucha --- testcases/kernel/kvm/include/kvm_x86.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/testcases/kernel/kvm/include/kvm_x86.h b/testcases/kernel/kvm/include/kvm_x86.h index bc36c0e0f..08d3f6759 100644 --- a/testcases/kernel/kvm/include/kvm_x86.h +++ b/testcases/kernel/kvm/include/kvm_x86.h @@ -68,7 +68,17 @@ /* Model-specific CPU register constants */ +#define MSR_SYSENTER_CS 0x174 +#define MSR_SYSENTER_ESP 0x175 +#define MSR_SYSENTER_EIP 0x176 #define MSR_EFER 0xc0000080 +#define MSR_STAR 0xc0000081 +#define MSR_LSTAR 0xc0000082 +#define MSR_CSTAR 0xc0000083 +#define MSR_SFMASK 0xc0000084 +#define MSR_FS_BASE 0xc0000100 +#define MSR_GS_BASE 0xc0000101 +#define MSR_KERNEL_GS_BASE 0xc0000102 #define MSR_VM_CR 0xc0010114 #define MSR_VM_HSAVE_PA 0xc0010117 From patchwork Tue Apr 30 12:22:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Doucha X-Patchwork-Id: 1929471 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=LFkqsIRt; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=W/u6lPx8; dkim=fail reason="signature verification failed" (1024-bit key) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=LFkqsIRt; dkim=neutral header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=W/u6lPx8; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=patchwork.ozlabs.org) Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VTKBb5LJXz1ydT for ; Tue, 30 Apr 2024 22:24:23 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 55A1F3CB4C8 for ; Tue, 30 Apr 2024 14:24:21 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [217.194.8.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id EB0683CB373 for ; Tue, 30 Apr 2024 14:23:06 +0200 (CEST) Authentication-Results: in-6.smtp.seeweb.it; spf=pass (sender SPF authorized) smtp.mailfrom=suse.cz (client-ip=2a07:de40:b251:101:10:150:64:1; helo=smtp-out1.suse.de; envelope-from=mdoucha@suse.cz; receiver=lists.linux.it) Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2a07:de40:b251:101:10:150:64:1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-6.smtp.seeweb.it (Postfix) with ESMTPS id 6712A1400519 for ; Tue, 30 Apr 2024 14:23:06 +0200 (CEST) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (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) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id E58133402D for ; Tue, 30 Apr 2024 12:23:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1714479784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E9b68l+fDbEAe36EUccjuLBxv0FLXKcSgsL4+Xs32xc=; b=LFkqsIRthq2IXpRmePGAmlAx8TqHO/PFAXOOVsTfsMfDrHe7Ry/PACqQ9bIHRixPGSXSz/ iwEugjaE5tnBjCg2wreKmwBtse/Exe8oPVw7hUyj0wBXW0/D2TqQmxLOKlDUdyEyClSG5N iM9MmP6zUQ3SvjTNVJ0VvcDIT6938DY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1714479784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E9b68l+fDbEAe36EUccjuLBxv0FLXKcSgsL4+Xs32xc=; b=W/u6lPx8BZM+7/5dA2MxAqmgH5hhsJhYnip1cY2k0Xey3Smz70UcbLbPvCSmdMVaHNYpeX 7rgDg9wpJbNBtYAA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1714479784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E9b68l+fDbEAe36EUccjuLBxv0FLXKcSgsL4+Xs32xc=; b=LFkqsIRthq2IXpRmePGAmlAx8TqHO/PFAXOOVsTfsMfDrHe7Ry/PACqQ9bIHRixPGSXSz/ iwEugjaE5tnBjCg2wreKmwBtse/Exe8oPVw7hUyj0wBXW0/D2TqQmxLOKlDUdyEyClSG5N iM9MmP6zUQ3SvjTNVJ0VvcDIT6938DY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1714479784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E9b68l+fDbEAe36EUccjuLBxv0FLXKcSgsL4+Xs32xc=; b=W/u6lPx8BZM+7/5dA2MxAqmgH5hhsJhYnip1cY2k0Xey3Smz70UcbLbPvCSmdMVaHNYpeX 7rgDg9wpJbNBtYAA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (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) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id CBD3513A25 for ; Tue, 30 Apr 2024 12:23:04 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap1.dmz-prg2.suse.org with ESMTPSA id yLGkMajiMGaQHAAAD6G6ig (envelope-from ) for ; Tue, 30 Apr 2024 12:23:04 +0000 From: Martin Doucha To: ltp@lists.linux.it Date: Tue, 30 Apr 2024 14:22:03 +0200 Message-ID: <20240430122208.13043-8-mdoucha@suse.cz> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240430122208.13043-1-mdoucha@suse.cz> References: <20240430122208.13043-1-mdoucha@suse.cz> MIME-Version: 1.0 X-Spam-Score: -2.80 X-Spam-Level: X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.cz:email,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[ltp@lists.linux.it]; RCVD_TLS_ALL(0.00)[] X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-6.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-6.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH 7/9] KVM: Add VMSAVE/VMLOAD functions to x86 SVM library X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Signed-off-by: Martin Doucha --- testcases/kernel/kvm/include/kvm_x86_svm.h | 6 ++++++ testcases/kernel/kvm/kvm_svm02.c | 12 ++---------- testcases/kernel/kvm/lib_x86.c | 18 ++++++++++++++++++ 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/testcases/kernel/kvm/include/kvm_x86_svm.h b/testcases/kernel/kvm/include/kvm_x86_svm.h index b4b1b80e2..73563ed2d 100644 --- a/testcases/kernel/kvm/include/kvm_x86_svm.h +++ b/testcases/kernel/kvm/include/kvm_x86_svm.h @@ -163,4 +163,10 @@ struct kvm_svm_vcpu *kvm_create_svm_vcpu(int (*guest_main)(void), void kvm_svm_vmrun(struct kvm_svm_vcpu *cpu); +/* Load FS, GS, TR and LDTR state from vmsave_buf */ +void kvm_svm_vmload(struct kvm_vmcb *buf); + +/* Save current FS, GS, TR and LDTR state to vmsave_buf */ +void kvm_svm_vmsave(struct kvm_vmcb *buf); + #endif /* KVM_X86_SVM_H_ */ diff --git a/testcases/kernel/kvm/kvm_svm02.c b/testcases/kernel/kvm/kvm_svm02.c index f72fb3812..6914fdcba 100644 --- a/testcases/kernel/kvm/kvm_svm02.c +++ b/testcases/kernel/kvm/kvm_svm02.c @@ -33,22 +33,14 @@ static void *vmsave_buf; /* Load FS, GS, TR and LDTR state from vmsave_buf */ static int guest_vmload(void) { - asm ( - "vmload %0\n" - : - : "a" (vmsave_buf) - ); + kvm_svm_vmload(vmsave_buf); return 0; } /* Save current FS, GS, TR and LDTR state to vmsave_buf */ static int guest_vmsave(void) { - asm ( - "vmsave %0\n" - : - : "a" (vmsave_buf) - ); + kvm_svm_vmsave(vmsave_buf); return 0; } diff --git a/testcases/kernel/kvm/lib_x86.c b/testcases/kernel/kvm/lib_x86.c index 1c0e629c3..8db3abd3f 100644 --- a/testcases/kernel/kvm/lib_x86.c +++ b/testcases/kernel/kvm/lib_x86.c @@ -393,3 +393,21 @@ struct kvm_svm_vcpu *kvm_create_svm_vcpu(int (*guest_main)(void), ret->vmcb = vmcb; return ret; } + +void kvm_svm_vmload(struct kvm_vmcb *buf) +{ + asm ( + "vmload %0\n" + : + : "a" (buf) + ); +} + +void kvm_svm_vmsave(struct kvm_vmcb *buf) +{ + asm ( + "vmsave %0\n" + : + : "a" (buf) + ); +} From patchwork Tue Apr 30 12:22:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Doucha X-Patchwork-Id: 1929477 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=lmXEpP/C; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=ctYfab01; dkim=fail reason="signature verification failed" (1024-bit key) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=0bb1PLYs; dkim=neutral header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=QR9RxHwP; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=patchwork.ozlabs.org) Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VTKDM0YK6z23jG for ; Tue, 30 Apr 2024 22:25:55 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id AFC563CB4FF for ; Tue, 30 Apr 2024 14:25:52 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-3.smtp.seeweb.it (in-3.smtp.seeweb.it [217.194.8.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id F14CE3C88E3 for ; Tue, 30 Apr 2024 14:23:07 +0200 (CEST) Authentication-Results: in-3.smtp.seeweb.it; spf=pass (sender SPF authorized) smtp.mailfrom=suse.cz (client-ip=2a07:de40:b251:101:10:150:64:1; helo=smtp-out1.suse.de; envelope-from=mdoucha@suse.cz; receiver=lists.linux.it) Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2a07:de40:b251:101:10:150:64:1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-3.smtp.seeweb.it (Postfix) with ESMTPS id 49CEB1A010F8 for ; Tue, 30 Apr 2024 14:23:07 +0200 (CEST) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (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) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id E79123402E for ; Tue, 30 Apr 2024 12:23:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1714479785; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iwyUfJxkO6sXDdFOv1MPoKNqxntlBa4UQArMbzP7U5I=; b=lmXEpP/CgSWT4CXckGDgTguK2q6SBHmsgkNsb2OqJKxP5pbyJzox/Z5DoUMQ2uZxwh5L4W CC2ZO8EhvRj3podiuQIA0AK4QJxvKZpK2eWioc5Z8xtFHpJRsaMmcwDM3FMlFTvxnj1EiZ XIfIFs5KEKCkmlvFm75QFqU/LeXSssA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1714479785; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iwyUfJxkO6sXDdFOv1MPoKNqxntlBa4UQArMbzP7U5I=; b=ctYfab01GSoSqRpHq2CGWWMZjASqI2CGpHX8eOzcRdsaNAuuwTWMfe21AIxRmrBmhckS+X uMmxgUU/C7Hn15BA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1714479784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iwyUfJxkO6sXDdFOv1MPoKNqxntlBa4UQArMbzP7U5I=; b=0bb1PLYsSH+u12QeJc858JgIzjZ1al5BSYn5A54FwHDN7Z5HLUhjhb9tO8KFsmRWa4Wtt6 sfdU+XzhMgtlW0Ec6Iz9oGAZH82HqzTgR6G1EKr940qUWI8Dr8iE3D4n9t5905469hny3M TUJWeXTLB/Mg8PvuolDQX7U93PDsVxI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1714479784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iwyUfJxkO6sXDdFOv1MPoKNqxntlBa4UQArMbzP7U5I=; b=QR9RxHwPxJcMyZvXJuDwxjZyyyyxfAMPZn8lHDU7QAxZuDggt/hu4ELlVJIcC/eD7cEuxr CigoSxTklhYzA0DA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (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) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id CF4AC13A27 for ; Tue, 30 Apr 2024 12:23:04 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap1.dmz-prg2.suse.org with ESMTPSA id +HV9MqjiMGaQHAAAD6G6ig (envelope-from ) for ; Tue, 30 Apr 2024 12:23:04 +0000 From: Martin Doucha To: ltp@lists.linux.it Date: Tue, 30 Apr 2024 14:22:04 +0200 Message-ID: <20240430122208.13043-9-mdoucha@suse.cz> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240430122208.13043-1-mdoucha@suse.cz> References: <20240430122208.13043-1-mdoucha@suse.cz> MIME-Version: 1.0 X-Spam-Score: -2.80 X-Spam-Level: X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.cz:email]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[ltp@lists.linux.it]; RCVD_TLS_ALL(0.00)[] X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-3.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-3.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH 8/9] KVM: Add functional test for VMSAVE/VMLOAD instructions X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Signed-off-by: Martin Doucha --- runtest/kvm | 1 + testcases/kernel/kvm/.gitignore | 1 + testcases/kernel/kvm/kvm_svm04.c | 307 +++++++++++++++++++++++++++++++ 3 files changed, 309 insertions(+) create mode 100644 testcases/kernel/kvm/kvm_svm04.c diff --git a/runtest/kvm b/runtest/kvm index 4094a21a8..0e1b2e555 100644 --- a/runtest/kvm +++ b/runtest/kvm @@ -2,3 +2,4 @@ kvm_pagefault01 kvm_pagefault01 kvm_svm01 kvm_svm01 kvm_svm02 kvm_svm02 kvm_svm03 kvm_svm03 +kvm_svm04 kvm_svm04 diff --git a/testcases/kernel/kvm/.gitignore b/testcases/kernel/kvm/.gitignore index 9638a6fc7..661472cae 100644 --- a/testcases/kernel/kvm/.gitignore +++ b/testcases/kernel/kvm/.gitignore @@ -2,3 +2,4 @@ /kvm_svm01 /kvm_svm02 /kvm_svm03 +/kvm_svm04 diff --git a/testcases/kernel/kvm/kvm_svm04.c b/testcases/kernel/kvm/kvm_svm04.c new file mode 100644 index 000000000..e69f0d4be --- /dev/null +++ b/testcases/kernel/kvm/kvm_svm04.c @@ -0,0 +1,307 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (C) 2023 SUSE LLC + */ + +/*\ + * [Description] + * + * Functional test for VMSAVE/VMLOAD instructions in KVM environment. Verify + * that both instructions save/load the CPU state according to CPU + * documentation. + */ + +#include "kvm_test.h" + +#ifdef COMPILE_PAYLOAD +#if defined(__i386__) || defined(__x86_64__) + +#include "kvm_x86_svm.h" + +static struct kvm_vmcb *src_vmcb, *dest_vmcb, *msr_vmcb; +static struct kvm_sregs sregs_buf; + +static int check_descriptor(const char *name, + const struct kvm_vmcb_descriptor *data, + const struct kvm_vmcb_descriptor *exp) +{ + int ret = 0; + + if (data->selector != exp->selector) { + tst_res(TFAIL, "%s.selector = %hx (expected %hx)", + name, data->selector, exp->selector); + ret = 1; + } + + if (data->attrib != exp->attrib) { + tst_res(TFAIL, "%s.attrib = 0x%hx (expected 0x%hx)", + name, data->attrib, exp->attrib); + ret = 1; + } + + if (data->limit != exp->limit) { + tst_res(TFAIL, "%s.limit = 0x%x (expected 0x%x)", + name, data->limit, exp->limit); + ret = 1; + } + + if (data->base != exp->base) { + tst_res(TFAIL, "%s.base = 0x%llx (expected 0x%llx)", + name, data->base, exp->base); + ret = 1; + } + + return ret; +} + +static int check_value(const char *name, uint64_t val, uint64_t exp, + uint64_t backup, uint64_t reg, uint64_t nested_val) +{ + int ret = 0; + + if (exp != backup) { + tst_res(TFAIL, "%s source was modified (0x%llx != 0x%llx)", + name, exp, backup); + ret = 1; + } + + if (reg != exp) { + tst_res(TFAIL, "%s was not loaded (0x%llx != 0x%llx)", + name, reg, exp); + ret = 1; + } + + if (val != exp) { + tst_res(TFAIL, "%s was not saved (0x%llx != 0x%llx)", + name, val, exp); + ret = 1; + } + + if (val != nested_val) { + tst_res(TFAIL, "Inconsistent %s on VM exit (0x%llx != 0x%llx)", + name, val, nested_val); + ret = 1; + } + + if (!ret) + tst_res(TPASS, "%s has correct value 0x%llx", name, val); + + return ret; +} + +static int vmsave_copy(void) +{ + kvm_svm_vmload(src_vmcb); + kvm_read_sregs(&sregs_buf); + msr_vmcb->star = kvm_rdmsr(MSR_STAR); + msr_vmcb->lstar = kvm_rdmsr(MSR_LSTAR); + msr_vmcb->cstar = kvm_rdmsr(MSR_CSTAR); + msr_vmcb->sfmask = kvm_rdmsr(MSR_SFMASK); + msr_vmcb->fs.base = kvm_rdmsr(MSR_FS_BASE); + msr_vmcb->gs.base = kvm_rdmsr(MSR_GS_BASE); + msr_vmcb->kernel_gs_base = kvm_rdmsr(MSR_KERNEL_GS_BASE); + msr_vmcb->sysenter_cs = kvm_rdmsr(MSR_SYSENTER_CS); + msr_vmcb->sysenter_esp = kvm_rdmsr(MSR_SYSENTER_ESP); + msr_vmcb->sysenter_eip = kvm_rdmsr(MSR_SYSENTER_EIP); + kvm_svm_vmsave(dest_vmcb); + return 0; +} + +static int check_vmsave_result(struct kvm_vmcb *copy_vmcb, + struct kvm_vmcb *nested_vmcb) +{ + int ret = 0; + + /* Nested VMCB is only compared to dest VMCB, bypass the check */ + if (!nested_vmcb) + nested_vmcb = dest_vmcb; + + ret = check_descriptor("FS", &dest_vmcb->fs, &src_vmcb->fs); + ret = check_value("FS.selector", dest_vmcb->fs.selector, + src_vmcb->fs.selector, copy_vmcb->fs.selector, + sregs_buf.fs, nested_vmcb->fs.selector) || ret; + ret = check_descriptor("GS", &dest_vmcb->gs, &src_vmcb->gs) || ret; + ret = check_value("GS.selector", dest_vmcb->gs.selector, + src_vmcb->gs.selector, copy_vmcb->gs.selector, + sregs_buf.gs, nested_vmcb->gs.selector) || ret; + ret = check_descriptor("LDTR", &dest_vmcb->ldtr, &src_vmcb->ldtr) || + ret; + ret = check_descriptor("TR", &dest_vmcb->tr, &src_vmcb->tr) || ret; + ret = check_value("STAR", dest_vmcb->star, src_vmcb->star, + copy_vmcb->star, msr_vmcb->star, nested_vmcb->star) || ret; + ret = check_value("LSTAR", dest_vmcb->lstar, src_vmcb->lstar, + copy_vmcb->lstar, msr_vmcb->lstar, nested_vmcb->lstar) || ret; + ret = check_value("CSTAR", dest_vmcb->cstar, src_vmcb->cstar, + copy_vmcb->cstar, msr_vmcb->cstar, nested_vmcb->cstar) || ret; + ret = check_value("SFMASK", dest_vmcb->sfmask, src_vmcb->sfmask, + copy_vmcb->sfmask, msr_vmcb->sfmask, nested_vmcb->sfmask) || + ret; + ret = check_value("FS.base", dest_vmcb->fs.base, src_vmcb->fs.base, + copy_vmcb->fs.base, msr_vmcb->fs.base, nested_vmcb->fs.base) || + ret; + ret = check_value("GS.base", dest_vmcb->gs.base, src_vmcb->gs.base, + copy_vmcb->gs.base, msr_vmcb->gs.base, nested_vmcb->gs.base) || + ret; + ret = check_value("KernelGSBase", dest_vmcb->kernel_gs_base, + src_vmcb->kernel_gs_base, copy_vmcb->kernel_gs_base, + msr_vmcb->kernel_gs_base, nested_vmcb->kernel_gs_base) || ret; + ret = check_value("Sysenter_CS", dest_vmcb->sysenter_cs, + src_vmcb->sysenter_cs, copy_vmcb->sysenter_cs, + msr_vmcb->sysenter_cs, nested_vmcb->sysenter_cs) || ret; + ret = check_value("Sysenter_ESP", dest_vmcb->sysenter_esp, + src_vmcb->sysenter_esp, copy_vmcb->sysenter_esp, + msr_vmcb->sysenter_esp, nested_vmcb->sysenter_esp) || ret; + ret = check_value("Sysenter_EIP", dest_vmcb->sysenter_eip, + src_vmcb->sysenter_eip, copy_vmcb->sysenter_eip, + msr_vmcb->sysenter_eip, nested_vmcb->sysenter_eip) || ret; + + return ret; +} + +static int create_segment_descriptor(uint64_t baseaddr, uint32_t limit, + unsigned int flags) +{ + int ret = kvm_find_free_descriptor(kvm_gdt, KVM_GDT_SIZE); + + if (ret < 0) + tst_brk(TBROK, "Descriptor table is full"); + + kvm_set_segment_descriptor(kvm_gdt + ret, baseaddr, limit, flags); + return ret; +} + +static void dirty_vmcb(struct kvm_vmcb *buf) +{ + buf->fs.selector = 0x60; + buf->fs.attrib = SEGTYPE_RWDATA | SEGFLAG_PRESENT; + buf->fs.limit = 0xffff; + buf->fs.base = 0xfff000; + buf->gs.selector = 0x68; + buf->gs.attrib = SEGTYPE_RWDATA | SEGFLAG_PRESENT; + buf->gs.limit = 0xffff; + buf->gs.base = 0xfff000; + buf->ldtr.selector = 0x70; + buf->ldtr.attrib = SEGTYPE_LDT | SEGFLAG_PRESENT; + buf->ldtr.limit = 0xffff; + buf->ldtr.base = 0xfff000; + buf->tr.selector = 0x78; + buf->tr.attrib = SEGTYPE_TSS | SEGFLAG_PRESENT; + buf->tr.limit = 0xffff; + buf->tr.base = 0xfff000; + buf->star = 0xffff; + buf->lstar = 0xffff; + buf->cstar = 0xffff; + buf->sfmask = 0xffff; + buf->fs.base = 0xffff; + buf->gs.base = 0xffff; + buf->kernel_gs_base = 0xffff; + buf->sysenter_cs = 0xffff; + buf->sysenter_esp = 0xffff; + buf->sysenter_eip = 0xffff; +} + +void main(void) +{ + uint16_t ss; + uint64_t rsp; + struct kvm_svm_vcpu *vcpu; + int data_seg1, data_seg2, ldt_seg, task_seg; + struct segment_descriptor *ldt; + struct kvm_vmcb *backup_vmcb, *zero_vmcb; + unsigned int ldt_size = KVM_GDT_SIZE*sizeof(struct segment_descriptor); + + kvm_init_svm(); + + src_vmcb = kvm_alloc_vmcb(); + dest_vmcb = kvm_alloc_vmcb(); + msr_vmcb = kvm_alloc_vmcb(); + backup_vmcb = kvm_alloc_vmcb(); + zero_vmcb = kvm_alloc_vmcb(); + + vcpu = kvm_create_svm_vcpu(vmsave_copy, 1); + kvm_vmcb_set_intercept(vcpu->vmcb, SVM_INTERCEPT_VMLOAD, 0); + kvm_vmcb_set_intercept(vcpu->vmcb, SVM_INTERCEPT_VMSAVE, 0); + /* Save allocated stack for later VM reinit */ + ss = vcpu->vmcb->ss.selector >> 3; + rsp = vcpu->vmcb->rsp; + + ldt = tst_heap_alloc_aligned(ldt_size, 8); + memset(ldt, 0, ldt_size); + data_seg1 = create_segment_descriptor(0xda7a1000, 0x1000, + SEGTYPE_RODATA | SEGFLAG_PRESENT); + data_seg2 = create_segment_descriptor(0xda7a2000, 2, + SEGTYPE_RWDATA | SEGFLAG_PRESENT | SEGFLAG_PAGE_LIMIT); + ldt_seg = create_segment_descriptor((uintptr_t)ldt, ldt_size, + SEGTYPE_LDT | SEGFLAG_PRESENT); + task_seg = create_segment_descriptor(0x7a53000, 0x1000, + SEGTYPE_TSS | SEGFLAG_PRESENT); + kvm_vmcb_copy_gdt_descriptor(&src_vmcb->fs, data_seg1); + kvm_vmcb_copy_gdt_descriptor(&src_vmcb->gs, data_seg2); + kvm_vmcb_copy_gdt_descriptor(&src_vmcb->ldtr, ldt_seg); + kvm_vmcb_copy_gdt_descriptor(&src_vmcb->tr, task_seg); + + src_vmcb->star = 0x5742; + src_vmcb->lstar = 0x15742; + src_vmcb->cstar = 0xc5742; + src_vmcb->sfmask = 0xf731; + src_vmcb->fs.base = 0xf000; + src_vmcb->gs.base = 0x10000; + src_vmcb->kernel_gs_base = 0x20000; + src_vmcb->sysenter_cs = 0x595c5; + src_vmcb->sysenter_esp = 0x595e50; + src_vmcb->sysenter_eip = 0x595e10; + + memcpy(backup_vmcb, src_vmcb, sizeof(struct kvm_vmcb)); + tst_res(TINFO, "VMLOAD/VMSAVE non-zero values"); + vmsave_copy(); + check_vmsave_result(backup_vmcb, NULL); + + memset(src_vmcb, 0, sizeof(struct kvm_vmcb)); + tst_res(TINFO, "VMLOAD/VMSAVE zero values"); + dirty_vmcb(dest_vmcb); + vmsave_copy(); + check_vmsave_result(zero_vmcb, NULL); + + memcpy(src_vmcb, backup_vmcb, sizeof(struct kvm_vmcb)); + tst_res(TINFO, "Nested VMLOAD/VMSAVE non-zero values"); + dirty_vmcb(vcpu->vmcb); + memset(dest_vmcb, 0, sizeof(struct kvm_vmcb)); + kvm_svm_vmrun(vcpu); + + if (vcpu->vmcb->exitcode != SVM_EXIT_HLT) + tst_brk(TBROK, "Nested VM exited unexpectedly"); + + check_vmsave_result(backup_vmcb, vcpu->vmcb); + + memset(src_vmcb, 0, sizeof(struct kvm_vmcb)); + tst_res(TINFO, "Nested VMLOAD/VMSAVE zero values"); + kvm_init_guest_vmcb(vcpu->vmcb, 1, ss, (void *)rsp, vmsave_copy); + kvm_vmcb_set_intercept(vcpu->vmcb, SVM_INTERCEPT_VMLOAD, 0); + kvm_vmcb_set_intercept(vcpu->vmcb, SVM_INTERCEPT_VMSAVE, 0); + dirty_vmcb(vcpu->vmcb); + kvm_svm_vmrun(vcpu); + + if (vcpu->vmcb->exitcode != SVM_EXIT_HLT) + tst_brk(TBROK, "Nested VM exited unexpectedly"); + + check_vmsave_result(zero_vmcb, vcpu->vmcb); +} + +#else /* defined(__i386__) || defined(__x86_64__) */ +TST_TEST_TCONF("Test supported only on x86"); +#endif /* defined(__i386__) || defined(__x86_64__) */ + +#else /* COMPILE_PAYLOAD */ + +static struct tst_test test = { + .test_all = tst_kvm_run, + .setup = tst_kvm_setup, + .cleanup = tst_kvm_cleanup, + .supported_archs = (const char *const []) { + "x86_64", + "x86", + NULL + }, +}; + +#endif /* COMPILE_PAYLOAD */ From patchwork Tue Apr 30 12:22:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Doucha X-Patchwork-Id: 1929470 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=frdetx3R; dkim=fail reason="signature verification failed" header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=SZB5FT3P; dkim=fail reason="signature verification failed" (1024-bit key) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=EEElNLqJ; dkim=neutral header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=yWaBCQKi; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=patchwork.ozlabs.org) Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VTKBG4n5tz1ydT for ; Tue, 30 Apr 2024 22:24:06 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 5C8513CB4C1 for ; Tue, 30 Apr 2024 14:24:04 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-3.smtp.seeweb.it (in-3.smtp.seeweb.it [IPv6:2001:4b78:1:20::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id E44613CB27D for ; Tue, 30 Apr 2024 14:23:06 +0200 (CEST) Authentication-Results: in-3.smtp.seeweb.it; spf=pass (sender SPF authorized) smtp.mailfrom=suse.cz (client-ip=195.135.223.131; helo=smtp-out2.suse.de; envelope-from=mdoucha@suse.cz; receiver=lists.linux.it) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-3.smtp.seeweb.it (Postfix) with ESMTPS id 1DF461A010E1 for ; Tue, 30 Apr 2024 14:23:05 +0200 (CEST) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (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) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id E8CDF1F7DA for ; Tue, 30 Apr 2024 12:23:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1714479785; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Pem4A+QBzmWPpLHqRnvGUBR35AtW9kladuGFt2GSxlM=; b=frdetx3R0vyy6+SsziGkPOE2BADAF6Pr0ZbhqatgkSmR9gnT+1WXPPdaD0+GHEDCvt/8R0 Z1wytET10U/Ey0mte2G8Fz6c8BTg/gP26mHv4z78LeiFmxKA6P1WEQ0fSY9wnRobXmCk9R mKFTnwMdRXF1vOJqAu6BfJu268FjPFI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1714479785; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Pem4A+QBzmWPpLHqRnvGUBR35AtW9kladuGFt2GSxlM=; b=SZB5FT3PrlXt87o4l92WcYKQUgl77ZaLTX9VNk8dnhLhQ3pubM6M6Apyj0MGFKt7oA6CGw O+hyehMjKbN90dAQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1714479784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Pem4A+QBzmWPpLHqRnvGUBR35AtW9kladuGFt2GSxlM=; b=EEElNLqJGpidrYpCkh2kQ7V/mhqAbgJlE/yaLvymVkYfdIo+LKCa4s5V9f22mVmh0hFOYb 9kZaxgJmScIl53OX78pD04Andb6lRmenQu075KKY09FvjhJL2033VPESJdwZOmEc+wLXmq T3QmNuvtdUrfJ2gSpgLQxriaBwXXxcg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1714479784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Pem4A+QBzmWPpLHqRnvGUBR35AtW9kladuGFt2GSxlM=; b=yWaBCQKii3wb6bRATZTI/ZZJi2qDAJF3Bta36uHXyWinnQFSd1zXMyykvlB3vHkIBgd6xm PU0h9jkhYC9an8DA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (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) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id D3F8D13A29 for ; Tue, 30 Apr 2024 12:23:04 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap1.dmz-prg2.suse.org with ESMTPSA id aOqmM6jiMGaQHAAAD6G6ig (envelope-from ) for ; Tue, 30 Apr 2024 12:23:04 +0000 From: Martin Doucha To: ltp@lists.linux.it Date: Tue, 30 Apr 2024 14:22:05 +0200 Message-ID: <20240430122208.13043-10-mdoucha@suse.cz> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240430122208.13043-1-mdoucha@suse.cz> References: <20240430122208.13043-1-mdoucha@suse.cz> MIME-Version: 1.0 X-Spam-Level: X-Spamd-Result: default: False [-0.64 / 50.00]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; BAYES_HAM(-0.84)[85.34%]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.cz:email]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[ltp@lists.linux.it]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -0.64 X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-3.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-3.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH 9/9] KVM: Move kvm_pagefault01 to the end of KVM runfile X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" The kvm_pagefault01 test reloads the KVM module with special parameters which may change kernel code paths and hide open bugs from other KVM tests. Move the test to the end of KVM schedule to prevent interference. Signed-off-by: Martin Doucha Reviewed-by: Petr Vorel --- runtest/kvm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runtest/kvm b/runtest/kvm index 0e1b2e555..74a517add 100644 --- a/runtest/kvm +++ b/runtest/kvm @@ -1,5 +1,6 @@ -kvm_pagefault01 kvm_pagefault01 kvm_svm01 kvm_svm01 kvm_svm02 kvm_svm02 kvm_svm03 kvm_svm03 kvm_svm04 kvm_svm04 +# Tests below may interfere with bug reproducibility +kvm_pagefault01 kvm_pagefault01