From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53C07C433E0 for ; Fri, 26 Feb 2021 17:24:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D162A64F17 for ; Fri, 26 Feb 2021 17:24:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D162A64F17 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 473A28D0001; Fri, 26 Feb 2021 12:24:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 425846B006E; Fri, 26 Feb 2021 12:24:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 33B118D0001; Fri, 26 Feb 2021 12:24:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0193.hostedemail.com [216.40.44.193]) by kanga.kvack.org (Postfix) with ESMTP id 1D8B46B006C for ; Fri, 26 Feb 2021 12:24:08 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id D45E0824805A for ; Fri, 26 Feb 2021 17:24:07 +0000 (UTC) X-FDA: 77861092134.21.8F1D9F3 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by imf01.hostedemail.com (Postfix) with ESMTP id B7F5D200038F for ; Fri, 26 Feb 2021 17:24:06 +0000 (UTC) Received: by mail-pl1-f169.google.com with SMTP id e9so5647685plh.3 for ; Fri, 26 Feb 2021 09:24:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=GFCixV8jMVFh23XUzlOOrP/f+e7zoLH+LJdWzCiIF/4=; b=IDz2uvRhZ9Qkb622qGfXIXKZPeLO0GaCmx+aoQhKPIWpfMe05mdlqc+rray20ICDaN U76aT+K/SWg6kbZNwg5S5fbQlAnrnXc0oMA7dipJV8a3jXjjGRallZ7aOUrjxsU3gOFS 7SpGAJVmiuIiCXMQNNWVssTdtwTGPfBTYtMmN+a0UdvrLgMdmZBwm9mHtXGUfgQpf6WJ R+5Uf86io+wGqw7fTwtCG30FjqyGTGnyXiqu3RDtZO7JwfFNYywcRlPr6ZrQup9K/Dr2 cyNSuaW42PRwWQ5zyfZQkfTRy3qJ82o1MuazpDf68dCOuX2VpoqiGjY0yfMlsyI7RBml +t6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=GFCixV8jMVFh23XUzlOOrP/f+e7zoLH+LJdWzCiIF/4=; b=szg+WhOT6e5F9KRAiwg0IDNbEdI8i1Rc6Sr8lzL884Pz1FSu/kdb5PhMNjrq2qP97P Kz/BESoU1KYD11fJv+g+pP2zTmCbHa9yecAJ9RGI262HPef5jt+puluLs3lx4XTm9hty oJuSv8Dv3dRk/hkSmYHiq29z3UoXsDPy2tj1eA//CsA+sSCxEFu6Ez5nutUcbluUZeQK e1X1RH7Vcr7jgOzObWLn5WN9Ucz0NJl/2oDm8iVFzQutLSs82rh3JHlNlpi67G3DiQKb o14a0NZ+XAyGOaP9KER7WMjqcQZXNGvPplyQNHnqE3y/lF4QK31mAP7Vm9D1q7Bk8yIb KbNg== X-Gm-Message-State: AOAM532QYaeG6s0HKlX8MeNFCx44C0bSfml3MrpvrLwckRLHuvQUc/hO /2BjOl00vQ7MIg3iPH4ssNc= X-Google-Smtp-Source: ABdhPJyMLOOZPpRPAU7LoIcfVmR1DNC9Jzp3UlL4U/sdRPMDuBiIIgXZUGDhD3ykqusC9nogvphOWg== X-Received: by 2002:a17:90a:ba02:: with SMTP id s2mr4527275pjr.53.1614360246071; Fri, 26 Feb 2021 09:24:06 -0800 (PST) Received: from [192.168.88.245] (c-24-6-216-183.hsd1.ca.comcast.net. [24.6.216.183]) by smtp.gmail.com with ESMTPSA id js2sm9316883pjb.54.2021.02.26.09.24.04 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Feb 2021 09:24:05 -0800 (PST) From: Nadav Amit Message-Id: <2CDFE432-90D3-43EE-BA9F-2CFEB8BB343C@gmail.com> Content-Type: multipart/signed; boundary="Apple-Mail=_C5765D4B-3D28-475A-832A-032E02F03391"; protocol="application/pgp-signature"; micalg=pgp-sha256 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Subject: Re: [RFC 1/6] vdso/extable: fix calculation of base Date: Fri, 26 Feb 2021 09:24:03 -0800 In-Reply-To: Cc: Linux-MM , LKML , Hugh Dickins , Andy Lutomirski , Thomas Gleixner , Peter Zijlstra , Ingo Molnar , Borislav Petkov , Andrew Morton , x86@kernel.org To: Sean Christopherson References: <20210225072910.2811795-1-namit@vmware.com> <20210225072910.2811795-2-namit@vmware.com> X-Mailer: Apple Mail (2.3654.60.0.2.21) X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: B7F5D200038F X-Stat-Signature: nregyxbz159wznprqewig9dg548mwybs Received-SPF: none (gmail.com>: No applicable sender policy available) receiver=imf01; identity=mailfrom; envelope-from=""; helo=mail-pl1-f169.google.com; client-ip=209.85.214.169 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1614360246-105136 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: --Apple-Mail=_C5765D4B-3D28-475A-832A-032E02F03391 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Feb 25, 2021, at 1:16 PM, Sean Christopherson = wrote: >=20 > On Wed, Feb 24, 2021, Nadav Amit wrote: >> From: Nadav Amit >>=20 >> Apparently, the assembly considers __ex_table as the location when = the >> pushsection directive was issued. Therefore when there is more than a >> single entry in the vDSO exception table, the calculations of the = base >> and fixup are wrong. >>=20 >> Fix the calculations of the expected fault IP and new IP by adjusting >> the base after each entry. >>=20 >> Cc: Andy Lutomirski >> Cc: Peter Zijlstra >> Cc: Sean Christopherson >> Cc: Thomas Gleixner >> Cc: Ingo Molnar >> Cc: Borislav Petkov >> Cc: Andrew Morton >> Cc: x86@kernel.org >> Signed-off-by: Nadav Amit >> --- >> arch/x86/entry/vdso/extable.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >>=20 >> diff --git a/arch/x86/entry/vdso/extable.c = b/arch/x86/entry/vdso/extable.c >> index afcf5b65beef..c81e78636220 100644 >> --- a/arch/x86/entry/vdso/extable.c >> +++ b/arch/x86/entry/vdso/extable.c >> @@ -32,7 +32,7 @@ bool fixup_vdso_exception(struct pt_regs *regs, int = trapnr, >> nr_entries =3D image->extable_len / (sizeof(*extable)); >> extable =3D image->extable; >>=20 >> - for (i =3D 0; i < nr_entries; i++) { >> + for (i =3D 0; i < nr_entries; i++, base +=3D sizeof(*extable)) { >=20 > It's been literally years since I wrote this code, but I distinctly = remember the > addresses being relative to the base. I also remember testing = multiple entries, > but again, that was a long time ago. >=20 > Assuming things have changed, or I was flat out wrong, the comment = above the > macro magic should also be updated. >=20 > /* > * Inject exception fixup for vDSO code. Unlike normal exception = fixup, > * vDSO uses a dedicated handler the addresses are relative to the = overall > * exception table, not each individual entry. > */ I will update the comment. I am not very familiar with pushsection = stuff, but the offsets were wrong. Since you say you checked it, I wonder whether it can somehow be caused by having exception table entries defined from multiple object files. Anyhow, this change follows the kernel=E2=80=99s (not vDSO) exception = table scheme. --Apple-Mail=_C5765D4B-3D28-475A-832A-032E02F03391 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEESJL3osl5Ymx/w9I1HaAqSabaD1oFAmA5LrMACgkQHaAqSaba D1rlug//SzVkoxU8j7Sj1Gg9YU/aGpsBFSx5cIZ1+ZOVNTBYzCZ0e1fjEyVGAjig dhmOha7jKdfUntgw/ObJ0QkKqUDTu71GMlr+AfibT6emd3LkrUa7D0O04flkt2qM pswSNzJnEBCbGRNdH9R8YMcJKrCEJodpP28BOOtwFb+OndTAYLmUe9PSKixnGbry Xlb1dJE/crT+5Vp2o5yqfrpZaLD4Mkz84KEO12ALTLKS81FGy0WtyF3cUCaorCLm WMpgpVKwRMZEowSiYTSFBW3TQGQtMce3L3FRYlviPI/fo47M4QJJ+d6zTEV6KWrC 4/64HUXzCO1HziIJkjEvrabB4ZtkEdwCMPl7I4seeUzPWtgae8n1ZUtVwcMnJzKL kxy5sMbxWxoOFOiywWoSa5DIOn99CfT55WLBjFMjaaPQ84SuFXiShBY/o04feAGM +zAM06HHg0r20MASs5qEQvVoJXS5ytVE+h1vdVIrTODCz3S8PR/pcbm7GVx2DEWy hoRRTNYZVQFjOwKpGCvBMVK8V4st9lcRlUhkaeyFGtJ5mcxbQpcB+sn2Qt6YRhBb trUq3H9uLLKTdXWoXCOElLtapejCvHDfvwjuR6Idk7YUB8uqQ4+0S8FhVPQPczcy h8e4TUeRlFsHVRDHa8bvJ6E7CcPNq5ypCPfhaeT/fA0MIkZGYdA= =JShR -----END PGP SIGNATURE----- --Apple-Mail=_C5765D4B-3D28-475A-832A-032E02F03391--