From patchwork Thu Apr 3 16:45:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 27695 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f71.google.com (mail-qa0-f71.google.com [209.85.216.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 376F520490 for ; Thu, 3 Apr 2014 16:45:13 +0000 (UTC) Received: by mail-qa0-f71.google.com with SMTP id j7sf4439656qaq.10 for ; Thu, 03 Apr 2014 09:45:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=35hxaLHilNuP03Jno2OF7JzbP1qUi219bwP7ElSkoRY=; b=cnaL3Md6hfFUfK3ECEerS3G3uqEPSo++05zwpVvXldZLJAbBrT/mBGhAu4/tsm5kmU CtcazzRWnVQ1XEk7Pu11DFN2N9w2YnNMT9yGWulJvB5hF9WFpegVF2p6Zm84NG4/76ed C0qTCJg4O7JXyrAtJ4y0tXmlxChCbbFYlLc+tdzQpNVj16BdSpyiNBt07ccqVdq0u6al rqHD47UDA3K5zBrFvtxpLCDx4bbH7lCtl+bgzZU1FSl1FjXOwWq+x+EKn/2gb8mjImaj hT5OA3VMVmHsNzU52CB0uii6xKi3lPIFhwCYx/z2himFdUer3qtrbhv7eGgnCFahcbgp +E0g== X-Gm-Message-State: ALoCoQkZ/RwsW6MLHiLnzx/VAyqjiPSKDmqg1WTqWNMITO1GKS0q/Gz9hghD36i6D1GiJ4pn1b+F X-Received: by 10.236.99.20 with SMTP id w20mr4120707yhf.50.1396543513001; Thu, 03 Apr 2014 09:45:13 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.27.138 with SMTP id 10ls688807qgx.52.gmail; Thu, 03 Apr 2014 09:45:12 -0700 (PDT) X-Received: by 10.52.128.231 with SMTP id nr7mr7025257vdb.17.1396543512905; Thu, 03 Apr 2014 09:45:12 -0700 (PDT) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id av10si318120ved.36.2014.04.03.09.45.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 03 Apr 2014 09:45:12 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.171; Received: by mail-vc0-f171.google.com with SMTP id lg15so2180311vcb.16 for ; Thu, 03 Apr 2014 09:45:12 -0700 (PDT) X-Received: by 10.220.188.10 with SMTP id cy10mr3644657vcb.36.1396543512843; Thu, 03 Apr 2014 09:45:12 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.12.8 with SMTP id v8csp43623vcv; Thu, 3 Apr 2014 09:45:12 -0700 (PDT) X-Received: by 10.204.245.129 with SMTP id lu1mr346748bkb.149.1396543510781; Thu, 03 Apr 2014 09:45:10 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id db6si2652362bkc.320.2014.04.03.09.45.10 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 03 Apr 2014 09:45:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::1 as permitted sender) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1WVklI-0003Cb-FP; Thu, 03 Apr 2014 17:45:08 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Richard Henderson , "Andrei E. Warkentin" , Riku Voipio Subject: [PATCH for-2.0? 1/2] page_check_range: don't bail out early after unprotecting page Date: Thu, 3 Apr 2014 17:45:07 +0100 Message-Id: <1396543508-12280-2-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1396543508-12280-1-git-send-email-peter.maydell@linaro.org> References: <1396543508-12280-1-git-send-email-peter.maydell@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Andrei Warkentin When checking a page range, if we found that a page was made read-only by QEMU because it contained translated code, we were incorrectly returning immediately after unprotecting that page, rather than continuing to check the entire range, so we might fail to unprotect pages later in the range, or might incorrectly return a "success" result even if later pages were not writable. In particular, this could cause segfaults in a case where signals are delivered back to back on a target architecture which uses trampoline code in the stack frame (as AArch64 currently does). The second signal causes a segfault because the frame cannot be written to (it was protected because we translated and executed the restorer trampoline, and the unprotect logic did not unprotect the whole range). Signed-off-by: Andrei Warkentin Reviewed-by: Richard Henderson --- translate-all.c | 1 - 1 file changed, 1 deletion(-) diff --git a/translate-all.c b/translate-all.c index f243c10..5759974 100644 --- a/translate-all.c +++ b/translate-all.c @@ -1777,7 +1777,6 @@ int page_check_range(target_ulong start, target_ulong len, int flags) return -1; } } - return 0; } } return 0;