Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1828426ybb; Sat, 4 Apr 2020 13:39:12 -0700 (PDT) X-Google-Smtp-Source: APiQypLlMM8SCQPdaJB1XEA5WE+IFRa7ulVSIjDa7E0O6JEKxkkziUUdHMn+Xbv2Wo0N2XlXIgZn X-Received: by 2002:a9d:37c9:: with SMTP id x67mr11473061otb.207.1586032752372; Sat, 04 Apr 2020 13:39:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586032752; cv=none; d=google.com; s=arc-20160816; b=jdT8cGQOoRlT6slIDkpIAjJ8S5kTn/02gxJGvaSg0faxfAhT+dT1gSCRFJvhGPw4eO izFAfuOnIlennz585FQP3UhHyGSr9+40csUrtZeTj3UJibftEfF/v7nsd6UnO2h4549H sNwcUGjQ9Pio2ESjyLP59rtcaT6CW2BL+WNKBYpqFO811OZe2cUThg988OQJOr4btht8 tFuij6gwctYykMvayf5BBb5ZGm0HzY3C5wX4Z+fHAGAG1PurdfyGrX8Zh+F8fHwnH27m HkIYp+NI6nCkvK/2rfwgQ2wyvq6XxY9q7STQoD9joYC7v2bOBFoYlHbox55aI31E54k7 oUhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=YOLlkSNv8gBB9vPWUVwzPQbiIm4FLvLKqLKjlEHhDPE=; b=W4Qd/sGSGB/DomAnAoeZpD/ri7/T4TdjwXRmGC28U77PLH1UoLlDI17M2Q186ZE/l8 yrr12CPQVBkK8Ck3MsWlFhHgSb1KaRKLatJg2+8sXI8++3JuyjfEqCAA0wi3ku8qIom2 0ZLh6NiPIuBuNHXhAZNDoU0yQxAQQFqTNO9xdIWuIjmmE++U61pje+qMKlwuKDBbB0hA kHHtL5D6wUBuwXjKiyXeowDz6dGsw6zm6flBsgiTTmkiF8Fec96V4qIaZ0oOMSXL2i42 vLdT4XP0IhgeyIyAJ1IbAQ/gh9melja8G9EsygLWbJX3km9afOPewHTIaLc+jqzEBbvf yjYQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n5si5744180oof.46.2020.04.04.13.38.59; Sat, 04 Apr 2020 13:39:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726436AbgDDUhm (ORCPT + 99 others); Sat, 4 Apr 2020 16:37:42 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:17628 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726302AbgDDUhl (ORCPT ); Sat, 4 Apr 2020 16:37:41 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 034KY5CA128816 for ; Sat, 4 Apr 2020 16:37:40 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 306pr79wne-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sat, 04 Apr 2020 16:37:40 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 4 Apr 2020 21:37:16 +0100 Received: from b06avi18878370.portsmouth.uk.ibm.com (9.149.26.194) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Sat, 4 Apr 2020 21:37:12 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 034KbXCW29360514 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 4 Apr 2020 20:37:33 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5613BAE053; Sat, 4 Apr 2020 20:37:33 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 44897AE051; Sat, 4 Apr 2020 20:37:33 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Sat, 4 Apr 2020 20:37:33 +0000 (GMT) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 55390) id D72D3E0193; Sat, 4 Apr 2020 22:37:32 +0200 (CEST) From: Sven Schnelle To: Shuah Khan Cc: svens@stackframe.org, Thomas Gleixner , Steve Winslow , Alexios Zavras , Allison Randal , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Sven Schnelle Subject: [PATCH 1/2] selftests/vDSO: prevent SIGFPE if vdso_info.nbucket is zero Date: Sat, 4 Apr 2020 22:37:03 +0200 X-Mailer: git-send-email 2.17.1 X-TM-AS-GCONF: 00 x-cbid: 20040420-0020-0000-0000-000003C1A6A6 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20040420-0021-0000-0000-0000221A5B3D Message-Id: <20200404203704.69412-1-svens@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.676 definitions=2020-04-04_17:2020-04-03,2020-04-04 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 spamscore=0 lowpriorityscore=0 impostorscore=0 phishscore=0 bulkscore=0 adultscore=0 mlxlogscore=860 priorityscore=1501 clxscore=1015 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004040185 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If vdso_info can't be parsed correctly, vdso_info.nbucket might contain zero. Add a check and return NULL which will fail the symbol lookup. Signed-off-by: Sven Schnelle --- tools/testing/selftests/vDSO/parse_vdso.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/testing/selftests/vDSO/parse_vdso.c b/tools/testing/selftests/vDSO/parse_vdso.c index 1dbb4b87268f..8e5a70a24d9a 100644 --- a/tools/testing/selftests/vDSO/parse_vdso.c +++ b/tools/testing/selftests/vDSO/parse_vdso.c @@ -226,6 +226,9 @@ void *vdso_sym(const char *version, const char *name) return 0; ver_hash = elf_hash(version); + if (!vdso_info.nbucket) + return NULL; + ELF(Word) chain = vdso_info.bucket[elf_hash(name) % vdso_info.nbucket]; for (; chain != STN_UNDEF; chain = vdso_info.chain[chain]) { -- 2.17.1