From patchwork Mon Nov 13 15:07:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Smith X-Patchwork-Id: 118810 Delivered-To: patch@linaro.org Received: by 10.80.225.132 with SMTP id k4csp1153875edl; Mon, 13 Nov 2017 07:07:41 -0800 (PST) X-Google-Smtp-Source: AGs4zMZxzv31lTmL/qe8/mb/A7gBttJjzXXQHSH522XCPFYed6PzFV6e/xJK8rnV2eUma/lZ3OKm X-Received: by 10.84.135.129 with SMTP id 1mr9452086plj.47.1510585661630; Mon, 13 Nov 2017 07:07:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510585661; cv=none; d=google.com; s=arc-20160816; b=f4uLxolwIZj4bUqf49JvgjtkLnKeOXynQtUZENuFRVEYlkz6ahjUB0/6VytfXUpy6M UZ+N1oDnzR84O4nqLDL0+9GiBSVCojj38MREV3+blfTogRvaourOaHopAvRFLlu3SW5R nmOJgsaCxRPc+dBZUAQ+F5a9PkcrQEaUp+4UpnUydXGOdJyYE5yPj7eL9KLbbA4gTsbV ctOfN2COFtjZhfVcxWKy8zG+mpT/C04/hF2VmnypWjV3Wt+5SYnyT3Zcw0dQdthyCLEF wUkuoHRKRQe596KYVRDe1bCnOl4s5bSKdEADqaXj3IfPs1hN5VT6e5GCJuyRy/Oh15Rc Jm8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:subject:message-id:date:from:mime-version:delivered-to:sender :list-help:list-post:list-archive:list-subscribe:list-unsubscribe :list-id:precedence:mailing-list:dkim-signature:domainkey-signature :arc-authentication-results; bh=Y7cpIQEZ9eH25txc/6VJQ8oazYT/dVTRCncKRpVs6cw=; b=mceY0QNKPALZ5q0m3I9S1xRFJpziykBrNLL3ugrgvmsDUwLc6eOzJJoomnKLZRElyE itbwEUlllefV4ld70hcR0Ie3mAwAZUiYVK1S+lfK7D5luRfUgmXDy0syuEnSbRY1x7p+ Ie1LpubGHBZQqC8p8KvyWRp7ZP46XVj5shN+cx0TAiC/SY63UzdTdg8w3qoqHfOt6F9N ZdgDp4ci1ztfygtH1+AwSksqrjjeYT6rjLcvg+jd929Uew4uNhERqpGLG6wUzo4tk8Bi 6d/ZElAQSL8I07tNlScQEc5sKyDjzQe4qUFFvmShoUMW4/qNN4kCMU3KgAgeUZ7e69oK AOlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=lA8iHUY3; spf=pass (google.com: domain of binutils-return-99230-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=binutils-return-99230-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id h7si11003661pgq.512.2017.11.13.07.07.41 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Nov 2017 07:07:41 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-return-99230-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=lA8iHUY3; spf=pass (google.com: domain of binutils-return-99230-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=binutils-return-99230-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:from:date:message-id:subject:to :content-type; q=dns; s=default; b=YiODRYjZJMo72A1fHBUkB+ZfSGhyH sZNPRFMjvuGGTAgy5B8ZL2mFasui0QpoF2Z9D5FxXedx/VNbmReCVGIGUz1Y12vd 9FFY0KY0gHP3ABVSGI7dy4zINmMwY6lyaS5wsn8fxSIY9k4rGzg4gjKn9/lWy/Kt YcKlzRd7OokwZc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:from:date:message-id:subject:to :content-type; s=default; bh=glfXt3N+OsRRWaOg+PRbdL5Pn2g=; b=lA8 iHUY3/WkQ8XGyim40LJWXjtMB4aKEb2uthSkhR/zB37GZl1wlSs7RnidLGNdVTjT LLvuP8QORyMFMQh5QUF27jMmy7WPEyGG9gACjIT1OkH1j3CrLWEXcfeoe//CU+Wp FOe93bYG6I22fy77TsL20PQBwVpXSsuN4J0my45Q= Received: (qmail 85652 invoked by alias); 13 Nov 2017 15:07:26 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Delivered-To: mailing list binutils@sourceware.org Received: (qmail 85642 invoked by uid 89); 13 Nov 2017 15:07:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=apologies, HX-Envelope-From:sk:peter.s, lucky X-HELO: mail-wr0-f172.google.com Received: from mail-wr0-f172.google.com (HELO mail-wr0-f172.google.com) (209.85.128.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 13 Nov 2017 15:07:20 +0000 Received: by mail-wr0-f172.google.com with SMTP id u40so14690130wrf.10 for ; Mon, 13 Nov 2017 07:07:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=mQ9W1iEXS/MQqF2/Q9Krhe4hbGRoeuIgM/cE39UgsjU=; b=kstx1m5jYAQqKlXPvCOxbSNMlqBBGNqAteb+1o8VGw4Fp7a4jU5oDkIe05PEq7gnyr oSEjKfjEjDbLlRN7A6iI9RDOhbpzF7Vrr7hoAFZFPGL55zJ8b5jaCQv3sOuMtumslvYJ Ei7vyCs1bAsHv56CS/5HOWrgzFQsQ19m6dGok7OJTCcBXWpoVDfN6a1AJtjWso820Frn 9l9TG5lWIuCY2G4PN3eHqg1me+T7Q0XHEaTaMg5CMlVK98e7RPMmzndBrL3uMrWRC9g6 z0i48AM1VqrHZdj8PVtXnj83V6dPDSC2ka2MIazAoQvByKCZx5MyP0Rxr7nObc2qGEYl qt1Q== X-Gm-Message-State: AJaThX5aTLdw8WFZZeaghvzs4jDNO+wZfnQCewehbpjYDDCT2ii/93Jt hSpqOUP7RxYnkhW/jPeHe323D9wFAqfsiOqRLrBoqm1sfdk= X-Received: by 10.223.153.100 with SMTP id x91mr7248777wrb.189.1510585637574; Mon, 13 Nov 2017 07:07:17 -0800 (PST) MIME-Version: 1.0 Received: by 10.223.156.207 with HTTP; Mon, 13 Nov 2017 07:07:16 -0800 (PST) From: Peter Smith Date: Mon, 13 Nov 2017 15:07:16 +0000 Message-ID: Subject: [PATCH][GOLD] Fix PR22233 gold segfault in relocate_erratum_stub on aarch64-linux-gnu To: binutils@sourceware.org Hello, I've recently investigated https://sourceware.org/bugzilla/show_bug.cgi?id=22233 which is a segfault in gold with the --fix-cortex-a53-843419 applied. The full details are in the PR, to summarise: - The fix for PR21868 (an internal error when --fix-cortex-a53-843419 is applied) has a small mistake in it. - When the stub_owner section needs an erratum fix an incorrect address for the stubs for the section is given to relocate_erratum_stub. - If we are lucky we will get a segfault, if we aren't an incorrect patch or data corruption is possible. The error is visible in PR21868, but the side-effects aren't fatal. - The fix is a one line change to add the view_offset to pview.address when doing the calculation to find the stub address. This is a first time posting a fix to this mailing list so my apologies for missing anything out. Peter diff --git a/gold/aarch64.cc b/gold/aarch64.cc index 4c6e920..c9c1b33 100644 --- a/gold/aarch64.cc +++ b/gold/aarch64.cc @@ -2041,7 +2041,8 @@ AArch64_relobj::fix_errata_and_relocate_erratum_stubs( // executed. stub_table->relocate_erratum_stub( stub, - pview.view + view_offset + (stub_table->address() - pview.address)); + pview.view + view_offset + (stub_table->address() - + (pview.address + view_offset))); // Next erratum stub. ++p;