From nobody Fri May 17 03:39:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1620792362; cv=none; d=zohomail.com; s=zohoarc; b=ewhf39xcDMk1L3sz3MWLBYKe89PoGmoj8XeoVjTfLWFpN+kcbqwF5jT4xNb3G8fLqqkxEzaLcN7xT1rT/XyQ5NS0XHCinqxJSSwqH/rgnx9vbonZyDGXhj3QRMBrvABJgk27Omoaa9Rm+BdYoLkVjswaBEylsjftaQMPolFpgNA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620792362; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ad6BTCzQppU9ibCkg2phnv+by9Ufg5a1X6zGILRwD2I=; b=ECK4MFs7OrWXOue+u6+UnAN0jnrwsA8RQ9sxYYVPIh+F6HRMUOVloGSDlEb1SSloWE3u89scoI+gjN9UqUy4OBlkrDFJ4uXBYS01FX+nD6IZrUcYiUdXM5+cjFmZlkbAK73tA3aTxJkqrHBFoGNMFMcmyBrq8mVNIIDwmHrwmVM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1620792362688998.9976269353106; Tue, 11 May 2021 21:06:02 -0700 (PDT) Received: from localhost ([::1]:51262 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lgg8H-0001wT-Nc for importer@patchew.org; Wed, 12 May 2021 00:06:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47984) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lgg5S-0006VF-I9 for qemu-devel@nongnu.org; Wed, 12 May 2021 00:03:06 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:25920) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lgg5P-0007qw-5Z for qemu-devel@nongnu.org; Wed, 12 May 2021 00:03:06 -0400 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 14C3XfMP161503; Wed, 12 May 2021 00:03:00 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 38g6gd1bx4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 May 2021 00:03:00 -0400 Received: from m0098404.ppops.net (m0098404.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 14C3Xpav162432; Wed, 12 May 2021 00:03:00 -0400 Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0a-001b2d01.pphosted.com with ESMTP id 38g6gd1bw8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 May 2021 00:02:59 -0400 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 14C3v68d008404; Wed, 12 May 2021 04:02:57 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma06fra.de.ibm.com with ESMTP id 38dhwh12j8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 May 2021 04:02:57 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 14C42seW29229370 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 May 2021 04:02:54 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 856BE52052; Wed, 12 May 2021 04:02:54 +0000 (GMT) Received: from vm.lan (unknown [9.145.157.105]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 1834752054; Wed, 12 May 2021 04:02:54 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=ad6BTCzQppU9ibCkg2phnv+by9Ufg5a1X6zGILRwD2I=; b=DKaNu2g3jrIh5hC8hq8BmqoF3qfoNxSlkCO+HfcsjBMkU9wUsA3xABBIrOckBGhtSt51 S3+oXHN1+R0zvXHF8g/AQWOjC7eg/7WuNt5wsr+51/tSRCCGEYuek9cxMN1kSr2hKf5/ RYMNSia2W+dP6lsxtOrCFnweEPWR2RpFFhMsDmXoVYxUm3PNiLTZUkhP0Ti9X7jKmE+1 38GV6yWD4g+7WmQ39yT2w67koXgJk98oWp4Xp8ht7rOusgSz+K3UEIzqDUmRB6jkQ97u 1aqTRm708wFzR11jheiyrO6q9LY3MpNMuNuruoUUQdbjoVsZ8MVk6CPlQXp/15EMIG1L Mg== From: Ilya Leoshkevich To: Cornelia Huck , Peter Maydell , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [PATCH 1/2] target/i386: Make sure that vsyscall's tb->size != 0 Date: Wed, 12 May 2021 06:02:49 +0200 Message-Id: <20210512040250.203953-2-iii@linux.ibm.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210512040250.203953-1-iii@linux.ibm.com> References: <20210512040250.203953-1-iii@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: s91yypgJhrYVG9zRB5QVzr6-lu0vlU0r X-Proofpoint-GUID: qHA_SZhd-baVH2BAn1V-NUBJO8RTY8wq X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.761 definitions=2021-05-12_01:2021-05-11, 2021-05-12 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 lowpriorityscore=0 mlxscore=0 bulkscore=0 adultscore=0 phishscore=0 mlxlogscore=999 impostorscore=0 clxscore=1015 suspectscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105120025 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=148.163.156.1; envelope-from=iii@linux.ibm.com; helo=mx0a-001b2d01.pphosted.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Christian Borntraeger , qemu-devel@nongnu.org, Ilya Leoshkevich Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" tb_gen_code() assumes that tb->size must never be zero, otherwise it may produce spurious exceptions. For x86_64 this may happen when creating a translation block for the vsyscall page. Fix by pretending that vsyscall translation blocks have at least one instruction. Signed-off-by: Ilya Leoshkevich Reviewed-by: Richard Henderson --- target/i386/tcg/translate.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 880bc45561..b5a2b981e2 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -8572,6 +8572,7 @@ static void i386_tr_translate_insn(DisasContextBase *= dcbase, CPUState *cpu) */ if ((dc->base.pc_next & TARGET_PAGE_MASK) =3D=3D TARGET_VSYSCALL_PAGE)= { gen_exception(dc, EXCP_VSYSCALL, dc->base.pc_next); + dc->base.pc_next =3D dc->pc + 1; return; } #endif --=20 2.29.2 From nobody Fri May 17 03:39:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1620792273; cv=none; d=zohomail.com; s=zohoarc; b=OiYxHH4oVrlRNnMIvRk0pVZ71jE9mnK7NoO19qdVeGMJBEh0AqiDTq/SvzCnEKICU/0y8nZKHZe5txhHkdfekL4FGSoQNb7jlMN9o/W+u+rMaEpfJci0vNZ4WyZJ/WGoAeI2ytXcf+70TBAypiVLXxMxY0ieGJNb90kf38iAOFY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620792273; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rJ2YhXERCmL0wbMFmtYfumdty5klx0JNrg177VFfq7s=; b=an/3Nb4M+udXixheHVm4+xXVNqMas7TfpJb8J8hwuZENf1Tnp4R+4NCT5WqyHDL0KnI/uAvi4gHJutIJiMvcQJ9hjelZYyZoPACkgf1aHLafkHHyZimGQoxLCc1Sibjb/BFznOhGFRwjl4V/s72A9YliA9KEGJL7cE9UqDOCLkU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1620792273618695.1159534855321; Tue, 11 May 2021 21:04:33 -0700 (PDT) Received: from localhost ([::1]:47514 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lgg6q-0007rN-EF for importer@patchew.org; Wed, 12 May 2021 00:04:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47982) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lgg5R-0006Tt-6n for qemu-devel@nongnu.org; Wed, 12 May 2021 00:03:05 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:8484 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lgg5N-0007q4-UW for qemu-devel@nongnu.org; Wed, 12 May 2021 00:03:04 -0400 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 14C3XCTf187231; Wed, 12 May 2021 00:03:01 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 38g68qsmf1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 May 2021 00:03:00 -0400 Received: from m0098416.ppops.net (m0098416.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 14C3XEiS187407; Wed, 12 May 2021 00:03:00 -0400 Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0b-001b2d01.pphosted.com with ESMTP id 38g68qsmed-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 May 2021 00:03:00 -0400 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 14C3wOkG004827; Wed, 12 May 2021 04:02:58 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma04fra.de.ibm.com with ESMTP id 38ef37guv3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 May 2021 04:02:58 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 14C42tn029032920 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 May 2021 04:02:55 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6D3F252051; Wed, 12 May 2021 04:02:55 +0000 (GMT) Received: from vm.lan (unknown [9.145.157.105]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 0886E52052; Wed, 12 May 2021 04:02:54 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=rJ2YhXERCmL0wbMFmtYfumdty5klx0JNrg177VFfq7s=; b=pUkwfUswZaHhv1tebAYiWpXE03yO7x2secuA4qa3N1Bt3JxseqMASbH615I2+t7Yk86n Wf2bbEV6FMPtUoYklCBv/We8JBmuTCY4mMid/tEsPRi38ye4CQAaWR5KOndT7Bw+FCkU PPoyAaI4MThQgs2zMXFtO1JF+GNvq6pbqDLupjKhWQcCV6pUsuu9caVekwINbew2p0Vy bbiJ95IyxdelA3k4gV73qDpZglDI2WruabTxfgC36dKq08PDi5VLBnQVFmdWjYGq4dd0 /1JEZAy11pFxsI4EHI/i8L0yygoFZc1901Zh7P/6P8ySpnFiHtwyfpBvCAl62V5uoez+ Kw== From: Ilya Leoshkevich To: Cornelia Huck , Peter Maydell , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [PATCH 2/2] tests/tcg/x86_64: add vsyscall smoke test Date: Wed, 12 May 2021 06:02:50 +0200 Message-Id: <20210512040250.203953-3-iii@linux.ibm.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210512040250.203953-1-iii@linux.ibm.com> References: <20210512040250.203953-1-iii@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-GUID: iyTwJ5HuoPPIa_YSu4-nTKPCkar7C9nI X-Proofpoint-ORIG-GUID: 3kk3Ri5Ar1UF14kHqJUTGiONa1MpMpDe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.761 definitions=2021-05-12_01:2021-05-11, 2021-05-12 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 clxscore=1015 phishscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 suspectscore=0 adultscore=0 priorityscore=1501 impostorscore=0 spamscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105120025 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=148.163.158.5; envelope-from=iii@linux.ibm.com; helo=mx0a-001b2d01.pphosted.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Christian Borntraeger , qemu-devel@nongnu.org, Ilya Leoshkevich Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Having a small test will prevent trivial regressions in the future. Signed-off-by: Ilya Leoshkevich Reviewed-by: Richard Henderson --- tests/tcg/x86_64/Makefile.target | 6 +++++- tests/tcg/x86_64/vsyscall.c | 11 +++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 tests/tcg/x86_64/vsyscall.c diff --git a/tests/tcg/x86_64/Makefile.target b/tests/tcg/x86_64/Makefile.t= arget index 20bf96202a..2151ea6302 100644 --- a/tests/tcg/x86_64/Makefile.target +++ b/tests/tcg/x86_64/Makefile.target @@ -3,14 +3,18 @@ # x86_64 tests - included from tests/tcg/Makefile.target # # Currently we only build test-x86_64 and test-i386-ssse3 from -# $(SRC)/tests/tcg/i386/ +# $(SRC_PATH)/tests/tcg/i386/ # =20 include $(SRC_PATH)/tests/tcg/i386/Makefile.target =20 +X86_64_TESTS +=3D vsyscall TESTS=3D$(MULTIARCH_TESTS) $(X86_64_TESTS) test-x86_64 QEMU_OPTS +=3D -cpu max =20 test-x86_64: LDFLAGS+=3D-lm -lc test-x86_64: test-i386.c test-i386.h test-i386-shift.h test-i386-muldiv.h $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS) + +vsyscall: $(SRC_PATH)/tests/tcg/x86_64/vsyscall.c + $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS) diff --git a/tests/tcg/x86_64/vsyscall.c b/tests/tcg/x86_64/vsyscall.c new file mode 100644 index 0000000000..b9b7f87459 --- /dev/null +++ b/tests/tcg/x86_64/vsyscall.c @@ -0,0 +1,11 @@ +#include +#include + +#define VSYSCALL_PAGE 0xffffffffff600000 +#define TIME_OFFSET 0x400 +typedef time_t (*time_func)(time_t *); + +int main(void) +{ + printf("%ld\n", ((time_func)(VSYSCALL_PAGE + TIME_OFFSET))(NULL)); +} --=20 2.29.2