From owner-svn-src-head@freebsd.org Wed Apr 25 14:30:24 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 54347FA7661 for ; Wed, 25 Apr 2018 14:30:24 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: from mail-yb0-x22d.google.com (mail-yb0-x22d.google.com [IPv6:2607:f8b0:4002:c09::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DBDFC72CB2 for ; Wed, 25 Apr 2018 14:30:23 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: by mail-yb0-x22d.google.com with SMTP id c10-v6so8323942ybn.7 for ; Wed, 25 Apr 2018 07:30:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=0j6smAf1b+f/Scpt6Pw2auaPnW9uwBqJN1108oo+218=; b=Edxzu+DRFVuHqRg+i36fcvk0yhKnrKh/EuXdM83+KVO853S+GC4KXRXxgt/BTM1doO R5Krgirt1IiPaDDXiL2SYdhpCqnuAC7ywaTyXzoT+a16DWbEiwQGtaUNZEHbmXfR1/GQ d+8lx48MJB32OkgfycH8nkDpVkfvX45bTZiTc5u4Fp2qx674r+n3WBNqodHKPj6tHhyw 58TnbG7MwC/4ssZi0zUCF6HZf7ZlUlS6k/6HToKSXL4ACoRmJaVGjTKrtaBg6wc+B46c Ae46HoUHsMDely/pZH/OtoIUshYhijSsWTpN9lzoQKF/7v8WpcaB58PZxrdsb2xXeJRa 7tNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=0j6smAf1b+f/Scpt6Pw2auaPnW9uwBqJN1108oo+218=; b=EFC4uzdz1mN/TSkTazVgARxfrvWsBhb7f4n0MSdkHmC6GuuWvOv0Nz6RqIOLNL8icn cboRSX5v2z3kHqSYdnUK4pTxpvKocDnC8FU+GHPMBY8kdxcqdpcG2SjW6sAARRGkF3JW 8Y5G1UB2nZM+AUXDI/OGfxCMtC7F/vGMcAGZK4ytXxC3H/jbLr9sE6MdSDmN8EZdM/Dz odu14MvJtAE26o5R3d7wWFL3IJlSZDMJqycHYFwbNvQOjD9MwcM9uOpeb+lBQ76jNfHQ iYo86tKGEDKx1ZJdleT+DXMaDjugtxrUDCNNA6+cdIpJ7aiBXp0TQBY8SaBZXJNlbrXE 0sUw== X-Gm-Message-State: ALQs6tAJVOmPaMwdqyMa3KlJ7P8xxIMRkexMqvugY1//xJ4nj9yb4Sw9 HOnW+9yZ2+fTv8AqIvDkmbTuZUOPAapubPO6zGMW8Q== X-Google-Smtp-Source: AB8JxZpyGvs637o0umTuB7FJiVJOPI9ZJrD9Fd4odRL8NtJTJDC741B2Hr1fECYbrB72hdqeB9dpsKNxNYn9jiwmKlE= X-Received: by 2002:a25:8709:: with SMTP id a9-v6mr2347811ybl.371.1524666623193; Wed, 25 Apr 2018 07:30:23 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:ae64:0:0:0:0:0 with HTTP; Wed, 25 Apr 2018 07:30:22 -0700 (PDT) In-Reply-To: <201804251421.w3PELDIn066396@repo.freebsd.org> References: <201804251421.w3PELDIn066396@repo.freebsd.org> From: Oliver Pinter Date: Wed, 25 Apr 2018 16:30:22 +0200 Message-ID: Subject: Re: svn commit: r332994 - head/sys/amd64/amd64 To: Tycho Nightingale Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Apr 2018 14:30:24 -0000 On Wednesday, April 25, 2018, Tycho Nightingale wrote: > Author: tychon > Date: Wed Apr 25 14:21:13 2018 > New Revision: 332994 > URL: https://svnweb.freebsd.org/changeset/base/332994 > > Log: > If a trap is encountered upon executing iretq from within doreti() the > hardware will ensure the stack pointer is aligned to a 16-byte > boundary before saving the fault state on the stack. > > In the PTI case, handle this potential alignment adjustment by copying > both frames independently while unwinding the stack in between. > > Reviewed by: kib > Sponsored by: Dell EMC Isilon > Differential Revision: https://reviews.freebsd.org/D15183 Is there any plan to MFC this commit? > > Modified: > head/sys/amd64/amd64/exception.S > > Modified: head/sys/amd64/amd64/exception.S > ============================================================ > ================== > --- head/sys/amd64/amd64/exception.S Wed Apr 25 13:23:58 2018 > (r332993) > +++ head/sys/amd64/amd64/exception.S Wed Apr 25 14:21:13 2018 > (r332994) > @@ -341,6 +341,9 @@ page_cr2: > * On the stack, we have the hardware interrupt frame to return > * to usermode (faulted) and another frame with error code, for > * fault. For PTI, copy both frames to the main thread stack. > + * Handle the potential 16-byte alignment adjustment incurred > + * during the second fault by copying both frames independently > + * while unwinding the stack in between. > */ > .macro PROTF_ENTRY name,trapno > \name\()_pti_doreti: > @@ -351,7 +354,11 @@ page_cr2: > movq %rax,%cr3 > movq PCPU(RSP0),%rax > subq $2*PTI_SIZE-3*8,%rax /* no err, %rax, %rdx in faulted > frame */ > - MOVE_STACKS (PTI_SIZE / 4 - 3) > + MOVE_STACKS (PTI_SIZE / 8) > + addq $PTI_SIZE,%rax > + movq PTI_RSP(%rsp),%rsp > + MOVE_STACKS (PTI_SIZE / 8 - 3) > + subq $PTI_SIZE,%rax > movq %rax,%rsp > popq %rdx > popq %rax > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" >