From patchwork Fri Apr 14 10:10:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Safonov X-Patchwork-Id: 9681127 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2A82F60326 for ; Fri, 14 Apr 2017 10:45:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1B48428664 for ; Fri, 14 Apr 2017 10:45:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0E18328676; Fri, 14 Apr 2017 10:45:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 679C728664 for ; Fri, 14 Apr 2017 10:45:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=dEh5N9knJLN8mzv9kTAQXUiFlWqkKUF8TdqMZD2Waiw=; b=QKEKuxFdpCDRNG XdTedh3pwUkYmPnG2E9eznl3aoOS6utA/WOIRI1dosthAkgtGzVtstRhSYF62QbQC0z42CXzSs5bk UfBp3xcv2sv8Jd7h/8kJUiHHNCLYN1GbAMQyOljWko4+APXFFsaesLer9v2R48Wc5kt9Sd6YzHhff 01DdzALqMfvIE0SUP2olyuws+As49nGSB4DRgsjDXyXvCzTczXEfaUrsrjqN1jtlFkqrQDT9Jri6R xsEYFfkX7pzKJeuuk7JM0YvjT9nid0+6w6c/CMbntyXaMYtppUFQadzA1+6norAzuhA5E+eNemNeJ sJQ24mLoO6tAX8LztaYg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cyyjZ-0000f3-Sc; Fri, 14 Apr 2017 10:45:45 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cyyig-000634-P8 for linux-arm-kernel@bombadil.infradead.org; Fri, 14 Apr 2017 10:44:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Type:MIME-Version:Message-ID: Date:Subject:CC:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=RSQqeajpgu/CWyyIMwjvKRATMvO4YsruNTu8p0uuK3g=; b=r7pw4f+W/F5rv9uoqUQhahUEiE 2+zSF8hVkmQEa9wU0+nh2yi7Q6ogb2E4yGu26KTZG/+tIBCOdkQX3CHFh3bbiokbJ54qSq4YPKybn yJQf7xcYPi9VluFybCeksCJRp2idJ0PYwYp2FsNmU/Cl/IAgn4DAlQeqCrwVlmGp+ppIdKJRpRCOz U6WggGVeQQ5aXnujJ4LUOJu4FJCopn4s9z6MuA4C/a2577eLVRs0KalTuDxEVkPinWruwVCO7/VqB CjA5rvDD3VVpzerJ4IyYNdqtxz4XaUnpINt9oRQS2e206LSpvKswiSKEC/lKqVfs3klbG6xkjgmC1 l+BYNycg==; Received: from mail-db5eur01on0111.outbound.protection.outlook.com ([104.47.2.111] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cyyI2-0005WO-4z for linux-arm-kernel@lists.infradead.org; Fri, 14 Apr 2017 10:17:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=RSQqeajpgu/CWyyIMwjvKRATMvO4YsruNTu8p0uuK3g=; b=KdN2+EBW5BrWcmZ3FP2b34EL9JxXfjFA1TEERbmiqYH0nIOJuG/3U1MgZR09JtZvrq2PUareCoTsyrjYh5Umy02l9+wTM8YqkQ5qFs4O4JZiz6nTx+Fj1pwz4dAjpSCfSMqO05apEtlklzY5ZmgZ1e9QetoKAuYANKj8R3swrCw= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=virtuozzo.com; Received: from dsafonov.sw.ru (195.214.232.6) by VI1PR0801MB1741.eurprd08.prod.outlook.com (10.168.67.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.10; Fri, 14 Apr 2017 10:14:38 +0000 From: Dmitry Safonov To: Subject: [PATCH] ARM32: Support mremap() for sigpage/vDSO Date: Fri, 14 Apr 2017 13:10:33 +0300 Message-ID: <20170414101033.4780-1-dsafonov@virtuozzo.com> X-Mailer: git-send-email 2.12.2 MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: DB5PR08CA0050.eurprd08.prod.outlook.com (10.166.166.146) To VI1PR0801MB1741.eurprd08.prod.outlook.com (10.168.67.19) X-MS-Office365-Filtering-Correlation-Id: 2330174e-378c-4c6f-d22d-08d4831f0fc5 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:VI1PR0801MB1741; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1741; 3:zDgn7i1hEnK2TidLd/EYx35nDsCq6f2vVe+j6HBN1znE871Y2McXXzwYT7JTdsCLMpU9ucBXkeezkVELNIA6eoZhk3E/jgEmb4/h9EpF9iRcwlTIa9Rx8h8ZyTeV6BS9tvNtr6mIcE3ot7/vMzfsNug0HUaXIEh8/zU9FelTdmYMerHwiOxerNNjnYCOvBuTQ9u1k39kOzjLMIWn4W1N5SQDaC0b7f4guZJp2ixkevUa/1LS+D7IsVUiDkjJU+buwtPciJNgsvJKSu6zdO1rIGVE2lp5QJD8o5b+Cf7/OVuRduFPLldYO2b950RAeL6816OTKQ1pEss7aHt6zSUypA==; 25:r+O+I8OdCyKXkKxz7fbQHT/74T0WAtOpLrnvwZY4DxevXb2VXe9G5KX3n+m2/MOHuOoOMP8LWiquSIUrnpS/a0akvcsH7rfNnikmMSciRPRia2slZWwM7kD9HNzartPrLtM8VaGfyLfo4hSI6PTVC2YZaqq2Vt3gvOrCz89FO4GyPUT55dJ5W1FR/iTjDgGpLLhuKPCLd+EEuxijAHxqFH6qvVtPg64ch+yia7kAXT/391BtHqFCh+T9fB5yVF9zeSAnMIMVq62l4pCNOw4GdOxs38ldI4LmXADWZxL6T5e3LcBaa4IfMXah36dNRkNC/8f5lHxcEcKF8PLUv6vFDEcGOnRhWFm+5+8PlTqXazM2GnAdVQwgEcyIMt5VBMvGnxmFOONvk7N1lbQO/CIua5swCaQAXfSCvfoConxUi0q/USPNRZs6b6oisfE8yHAjmwWqTXL7tSw1Yimdn9w50A== X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1741; 31:iAK+XN2+8+IUpUw2AS+mRXy+SIMEjBQDrEqgAhIDXXUXTk8Q5JB+srvMcMx5mJ8iVvNJjG8UqqGMpZ+9verdU+Hsf4tmXOph6mcORx7CsLOarls773UFTGbkmG9HJRMiZIZ9VDq1H2f8X+BN5sv3B5Wr2IHDR5EO3x2dt2OCbpU5gY+d5RG96alNzuVMp5rE01HQPXOT5QC6QIgbinOWKLH5ssm4+cTrArXAKiUPe8t+QsB5BZo2y2Yr/V/euIcZLEo2fHqRilx3fag+DdEp3g==; 20:i0u4KoB8K0/vDyD2zw9sXGbY5qHoAkZz9Hcm6ijqhFnb5Vr2yYEIWuCsXOP3F/Sq0jbL2wZjuYi0jOq9Aaq0m6u2yFjOGnOLDvEsps9ipbPfKHD/x2u9fRiU1gwTZFO3cEPGWhGhwAuQ247Ay2ezR5wKHPRDEFYnaPea5A5ZeeG6VYsTglB+WB4L2Wd+bzYvQOWgJwurIF2mrpEM8s7Hufv+5+FOqp57MmkjcLtiUlEzJTY4vL74bBEZZxtHjEDdWXNakLFi1rOhgEclUuccgXDxGV0QqGak6SN4O6rJeq3CGsC0q9xLlIzxASSB97Ck5Cf2mwsnmSA4OsEW1c7GmoasQi0k0UKu3ktLzOJJdX6iBT5hDnJWaoB3vGv2GVhrCGF7B0nIDuIeF/FB/CZZbKvMzXh/d0QzWWY8B6Xtm9g= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917)(258649278758335); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93001095)(6041248)(20161123562025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(20161123560025)(20161123555025)(6072148); SRVR:VI1PR0801MB1741; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0801MB1741; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1741; 4:hvtfJr51rM+ESHYXEUJPB/htjfaAKLYLQg8oUoXYukxp/SDsr0wFl43qF10J/4GUuRtyHaMKV0gGbW4Joa+H1YgpDpvgIeBC3RGOvrreWSsofo2QAIfneQx5t2kjVckIujI9Wl7q2JHwAngCdSMXVvQj79UbSY1n+xaDSDYv/tVGJhYY6kCK7S2Ugp37kRRnkTcpTocb9mfZsFVk6GbJxzik9TISjYx3UAs6RnxdH8SM6OadPPOlYjcd6jQYhiA+Q2efqzDAzw0vxWjVYoVY6yOK+EpHqXgZuaVLQoTKwDRSz4CXldWhN8iGNPQkePjWYTHEQyzIGeh4WIWSv3LHNfB0H7pnfOgm/rAr7IkfP1cIY7F5u/D0VC/KpyxEx3ShCK+Z4QEKjBDvCVZr1H6OrZ6VfF7y7AR0ltWNfMvAW6/xx6HiO2wRiI0rP6n4PprrG9Y9cmMJMWwmnwlLDM3RXZqz/9GqmOf3SXvrqSErPL9kpQG/bO4WJwUplFiVpzk4jefTKGg1JUhk3sdRSfQvpllZnOfpRqk4+I3KllMCnDK8Mwrh/cdWnhVoHDfLCg1zKDstmywul/SFece+1GWjoH8fgkWqvfiFSirRxvAMTSi9JxN++ZpbirWetSSyP/wkuhksHvCA6j12R+Ywpf6Z23gyPxWPLVGCLtMrUaAN3lFmA9xfUKuM7rmlZqtrqJckGhQ9+DXlUWO86AlTGxaFeN3bGP1vwDwUuGvu9vcyYJl7X7zbS3tXFvYaXG1XkifRpxU1n0sjqauzm2KCzc2TlDhgaR+ZDOOFCRHgwFMnRc0= X-Forefront-PRVS: 02778BF158 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(39400400002)(39830400002)(39450400003)(39410400002)(66066001)(6916009)(42186005)(5660300001)(50466002)(81166006)(50986999)(8676002)(50226002)(6666003)(53416004)(47776003)(2351001)(189998001)(2906002)(25786009)(33646002)(6512007)(38730400002)(6116002)(3846002)(4326008)(305945005)(86362001)(6506006)(36756003)(48376002)(110136004)(7736002)(53936002)(1076002)(6486002); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR0801MB1741; H:dsafonov.sw.ru; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0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d+UyfCjimm6hoySFCGXbw==; 20:NUr3c/DIXa6TxQt0dbfmYovRqnamQ0tXcjeyJqTRMHb6Locy+uYldGQNeWOrNpNtQVTdNZgrWCL8pA1fziDBCMhXNtldqFKn9WrDYlj8Y5A7TQmgvhS4QDE2ud/zNuAHhMOmSNLWJDE9d9D1P8WhZdDzI1Io43Sr/l0InEFzs60= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Apr 2017 10:14:38.5069 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB1741 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170414_061718_515736_6F59592C X-CRM114-Status: GOOD ( 16.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dmitry Safonov , Will Deacon , Russell King , Andy Lutomirski , Christopher Covington , 0x7f454c46@gmail.com, Cyrill Gorcunov , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Pavel Emelyanov Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP CRIU restores application mappings on the same place where they were before Checkpoint. That means, that we need to move vDSO and sigpage during restore on exactly the same place where they were before C/R. Make mremap() code update mm->context.{sigpage,vdso} pointers during VMA move. Sigpage is used for landing after handling a signal - if the pointer is not updated during moving, the application might crash on any signal after mremap(). vDSO pointer on ARM32 is used only for setting auxv at this moment, update it during mremap() in case of future usage. Without those updates, current work of CRIU on ARM32 is not reliable. Historically, we error Checkpointing if we find vDSO page on ARM32 and suggest user to disable CONFIG_VDSO. But that's not correct - it goes from x86 where signal processing is ended in vDSO blob. For arm32 it's sigpage, which is not disabled with `CONFIG_VDSO=n'. Looks like C/R was working by luck - because userspace on ARM32 at this moment always sets SA_RESTORER (and sigpage is not used in that case). Cc: linux-arm-kernel@lists.infradead.org Cc: Russell King Cc: Will Deacon Cc: Andy Lutomirski Cc: Thomas Gleixner Cc: Cyrill Gorcunov Cc: Pavel Emelyanov Cc: Christopher Covington Signed-off-by: Dmitry Safonov --- arch/arm/kernel/process.c | 8 ++++++++ arch/arm/kernel/vdso.c | 18 ++++++++++++++++++ arch/x86/entry/vdso/vma.c | 3 --- mm/mmap.c | 4 ++++ 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index 939e8b58c59d..1e6039cac68d 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c @@ -404,9 +404,17 @@ static unsigned long sigpage_addr(const struct mm_struct *mm, static struct page *signal_page; extern struct page *get_signal_page(void); +static int sigpage_mremap(const struct vm_special_mapping *sm, + struct vm_area_struct *new_vma) +{ + current->mm->context.sigpage = new_vma->vm_start; + return 0; +} + static const struct vm_special_mapping sigpage_mapping = { .name = "[sigpage]", .pages = &signal_page, + .mremap = sigpage_mremap, }; int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) diff --git a/arch/arm/kernel/vdso.c b/arch/arm/kernel/vdso.c index 53cf86cf2d1a..27777d26aeac 100644 --- a/arch/arm/kernel/vdso.c +++ b/arch/arm/kernel/vdso.c @@ -54,8 +54,26 @@ static const struct vm_special_mapping vdso_data_mapping = { .pages = &vdso_data_page, }; +static int vdso_mremap(const struct vm_special_mapping *sm, + struct vm_area_struct *new_vma) +{ + unsigned long new_size = new_vma->vm_end - new_vma->vm_start; + unsigned long vdso_size; + + /* without VVAR page */ + vdso_size = (vdso_total_pages - 1) << PAGE_SHIFT; + + if (vdso_size != new_size) + return -EINVAL; + + current->mm->context.vdso = (void __user *)new_vma->vm_start; + + return 0; +} + static struct vm_special_mapping vdso_text_mapping __ro_after_init = { .name = "[vdso]", + .mremap = vdso_mremap, }; struct elfinfo { diff --git a/arch/x86/entry/vdso/vma.c b/arch/x86/entry/vdso/vma.c index 226ca70dc6bd..363730caa60e 100644 --- a/arch/x86/entry/vdso/vma.c +++ b/arch/x86/entry/vdso/vma.c @@ -77,9 +77,6 @@ static int vdso_mremap(const struct vm_special_mapping *sm, if (image->size != new_size) return -EINVAL; - if (WARN_ON_ONCE(current->mm != new_vma->vm_mm)) - return -EFAULT; - vdso_fix_landing(image, new_vma); current->mm->context.vdso = (void __user *)new_vma->vm_start; diff --git a/mm/mmap.c b/mm/mmap.c index bfbe8856d134..534aef99cfe9 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -3152,8 +3152,12 @@ static int special_mapping_mremap(struct vm_area_struct *new_vma) { struct vm_special_mapping *sm = new_vma->vm_private_data; + if (WARN_ON_ONCE(current->mm != new_vma->vm_mm)) + return -EFAULT; + if (sm->mremap) return sm->mremap(sm, new_vma); + return 0; }