From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161295AbcFANQl (ORCPT ); Wed, 1 Jun 2016 09:16:41 -0400 Received: from mail-am1on0102.outbound.protection.outlook.com ([157.56.112.102]:14390 "EHLO emea01-am1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1758158AbcFANQi (ORCPT ); Wed, 1 Jun 2016 09:16:38 -0400 Authentication-Results: virtuozzo.com; dkim=none (message not signed) header.d=none;virtuozzo.com; dmarc=none action=none header.from=virtuozzo.com; Subject: Re: [PATCH 0/6] x86: 32-bit compatible C/R on x86_64 To: , References: <1464786697-20639-1-git-send-email-dsafonov@virtuozzo.com> CC: , , , , <0x7f454c46@gmail.com>, , , , From: Dmitry Safonov Message-ID: <37a5e070-f825-a735-aba0-890ab864a829@virtuozzo.com> Date: Wed, 1 Jun 2016 16:15:14 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <1464786697-20639-1-git-send-email-dsafonov@virtuozzo.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [195.214.232.10] X-ClientProxiedBy: AM4PR0501CA0015.eurprd05.prod.outlook.com (10.167.83.153) To HE1PR0801MB1292.eurprd08.prod.outlook.com (10.167.247.146) X-MS-Office365-Filtering-Correlation-Id: 580bfc11-5c93-4c02-4fa3-08d38a1ef3f6 X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB1292;2:qLO8urkTbi2kVq2ktf6fmdNZh6/AJHsQ5opnJBJms8SGTx97S485RZdRmQTIybRdeyojZK2R8gyolA+p4nZHFNOEfUpyei1XQOWkpmE0jWMcydVl8sFjaImVtXMZ2k1VeathJBnaWCi5lJcZDKh7pFwRTCG2v0tvqopxLORPPznOWWwWmjl4A6ra9kzXRM1q;3:E91GW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report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040130)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6041072)(6043046);SRVR:HE1PR0801MB1292;BCL:0;PCL:0;RULEID:;SRVR:HE1PR0801MB1292; X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB1292;4:6NoVYfzcli1aEe4k6EalWGs8cYWzxaSvrgDlgPs5CPP6wHa2lwBF9dkqu8Yogmgc0voa4PpBLpncnckvEhNaO4k2ohGKCcdWkoz2QwNQqqZ6Xtsxi2JrbXsJl0ozH5gV8XCHhOzyfihMwtohH0EfQXLYvElYR3ZTiISlXrc0K/e1ukRupoVOKV5pLwu0bzF000MWybzYmqN/0sIWZDySS3Ue9BoGBUskNLc8utKRrq0/0wX1w9U+GvUjYz/wjJRmgwhSa9ThCTWxLZgv907mvGBkx5Mgn7iQ4DBus2ADjiTcjEkdRLN6AsNsH21steccVuh7DyjxQUYoDjoASjEvpSOeC+gSpSexzoQqnpE/AQC1vPbM7+tI6sy/nrqoLQouNagB4ldk+TDFO8d5FNS46utgrl0Za/vMq4zBlWKGWc0= X-Forefront-PRVS: 096029FF66 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6049001)(6009001)(24454002)(377454003)(52314003)(76176999)(50986999)(54356999)(92566002)(3846002)(6116002)(33646002)(31686004)(86362001)(81166006)(36756003)(2906002)(4326007)(8676002)(107886002)(42186005)(4001350100001)(189998001)(230700001)(5008740100001)(4001430100002)(50466002)(19580395003)(5001770100001)(586003)(31696002)(23746002)(47776003)(66066001)(65956001)(65806001)(83506001)(15975445007)(77096005)(5004730100002)(2950100001)(65826006);DIR:OUT;SFP:1102;SCL:1;SRVR:HE1PR0801MB1292;H:[10.30.26.154];FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;HE1PR0801MB1292;23:MSiWW4iHZ2AVWXCk+qi76ulPnsJhSDp1DYS?= =?Windows-1252?Q?QB1ndIBuXQLN5Xd7uDs7MaVRQDYwmCPVXhNE+QGPd3hKon1HDV9hrlQS?= =?Windows-1252?Q?T9npsIiBeTs2vox13pOrRR4QNKmkb9f6F2pTob7x05A065gvYlTzvLHg?= =?Windows-1252?Q?ef4If0Ppl82uLw6Fv0hTsHXCrxegN3BxAh5XtAL/pa/Tz+7B3mmKOLFn?= =?Windows-1252?Q?o2UIS98/Bq2WtjyvrG4bBeLRWoYitvEN1dqJQN8swzvthzj93FXBfhIp?= =?Windows-1252?Q?wd0IzaF/xGJOniZEgVnzKEjJdRRhS5/7r0ms4Jw46r0/i4U+cmUKk/u5?= =?Windows-1252?Q?CL3SHvhyiW2+EvdFIRhCKo4xWOylcIn3wl8q0O8ekYX/SjpwknmflL1f?= =?Windows-1252?Q?zWHp6dSaZF39YFUpXI7iKs6aj6Q3gWiqcKzdJwO6+ZrYTFGr9+5R35ay?= =?Windows-1252?Q?FUupmRPnR2zna6lbVZUBy4PEc8Rikr4L3kzLuj2BbDhL510itclTchyB?= =?Windows-1252?Q?7r1AsBXUCGvOzUxgyMJW9cGDUlnUHsuCHdrWNkel+nfViJOt2fC8fVcv?= =?Windows-1252?Q?6Tw2dSBeI2NoSkEiNh9kHoforDai0cY3ehAAQZ082YcQLpv0612g+O+e?= =?Windows-1252?Q?DDPCi8qk4qGZL+uD+myj30+vJLSQUElLCPVBEfIZ9taHKR0Ur4C7Vape?= =?Windows-1252?Q?Mlkc/EbjiZ1dwHaqS5upobRWfZOiMdc1tXQ1EO5AuZAwTKnoyJf+RhWS?= =?Windows-1252?Q?9f8x5mhn4N8S9ffj90VoCQywozR1nzan1IqsWah/fknFf5LTkU5XqbaK?= =?Windows-1252?Q?jhIYF3+81cx92MC5KDW63wq4zk78IzsZUXfQWGwiDv/tuXuTJ8S0TOoa?= =?Windows-1252?Q?PGoMvxAym2KLmMkP+Fr9AnOIdbrAhHBu0WmSACWGYEtOLlDUgZeMv0af?= =?Windows-1252?Q?Nv2cB1mLrcx0ZXKq9A7Fe74gKP5L0OJjFnoushfa1m6ycZ4aiK+6d6dX?= =?Windows-1252?Q?NHNJNB6gLKVZ42l7vy3JozXHHH6GUn8uBl3kiCVJqYrsZaCT3L525vsI?= =?Windows-1252?Q?SacFaRphCXgTWJFdAIOy/6ZILxVmyAmwySWNeaJQpz1zcVtdks6nOjes?= =?Windows-1252?Q?kLlsUTpd20D3aK9Y1dbO/OTlBr78oys7XJlkh4fkracj/pUqpaURllhB?= =?Windows-1252?Q?chzOivZXWzsB0CvkpWKw7PlDTVAf5kIhpWxW81QQS2hnYXG3DOxdz?= X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB1292;5:2J7yPT4MwpWdnMenUQ3XzhunXZE2MK3JW7MbsEpXNcydowOrLZZe54cYV+AjtA8If+DJaPR6GRm0buDatVneBwVxi3PnAuCvKFXOr8q41lP8aZC3qu+c1U2k7ITXJHQwdDTeMvlMcMdCEqcOzfw/3Q==;24:0K+C9fG3U9IyLt1sJW0Kexupc1RuUDy+6Pg2pR5D7kktZFdaGMp5bxk6qZYm3K5643amIyY5URm1wP2r+0iHyq/vLmu0dOeEFvt63ySoBFE=;7:eBGARovq7vbV9SZbES9q7bgdm6nndjfjKDx4hYL8lCYZDbf5DpV/oSxYeBKS9WaRqDrSVwQ2iF/QTC/R2FRVmv6bgTVqa8fDIJcoIHaOOIHdSkjtOngg8NtX/fKQOcZnkoi4SDeOuQOfYSzuo8IZ2CQOCS6fJjhcqIBKcXSJpz1/JJvI5b9GUixmb4rJz7rD;20:71BbDBU/13BRaxscTD87I20SlKgplrTpt+E8qAeIbXR27ZodF5Y67GuKec9IFs6jVIDQuGxbNf/Go6WPZO1bQl/WZS1EwBwGCCa9gS7WPGxs0thg8k2Rpta/QdMFsBo7HBPY8RnDZRJN/3xtMY6VV9KNTQwCJ8/eSDlZ8rSkWtc= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2016 13:16:32.1654 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB1292 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/01/2016 04:11 PM, Dmitry Safonov wrote: > This patches set is an attempt to add checkpoint/restore > for 32-bit tasks in compatibility mode on x86_64 hosts. > > Restore in CRIU starts from one root restoring process, which > reads info for all threads being restored from images files. > This information is used further to to find out which processes > share some resources. Later shared resources are restored only > by one process and all other inherit them. > After that it calls clone() and new threads restore their > properties in parallel. Those threads inherit all parent's > mappings and fetch properties from those mappings > (and do clone themself, if they have children/subthreads). [1] > Then starts restorer blob's play, it's PIE binary, which > unmaps all unneeded for restoring VMAs, maps new VMAs and > finalize restoring with sigreturn syscall. [2] > > To restore of 32-bit task we need three things to do in running > x86_64 restorer blob: > a) set code selector to __USER32_CS (to run 32-bit code); > b) remap vdso blob from 64-bit to 32-bit > This is primary needed because restore may happen on a different > kernel, which has different vDSO image than we had on dump. > c) if 32-bit vDSO differ to dumped image, move it on free place > and add jump trampolines to that place. > d) switch TIF_IA32 flag, so kernel would know that it deals with > compatible 32-bit application. > > From all this: > a) setting CS may be done from userspace, no patches needed; > b) patches 1-3 add ability to map different vDSO blobs on x86 kernel; > c) for remapping/moving 32-bit vDSO blob patches have been send earlier > and seems to be accepted [3] > d) and for swapping TIF_IA32 flag discussion with Andy ended in conclusion > that it's better to remove this flag completely. > Patches 4-6 deletes usage of TIF_IA32 from ptrace, signal and coredump > code. This is rework/resend of RFC [4] > > [1] https://criu.org/Checkpoint/Restore#Restore > [2] https://criu.org/Restorer_context > [3] https://lkml.org/lkml/2016/5/17/243 > [4] https://lkml.org/lkml/2016/4/25/650 > > Dmitry Safonov (6): > x86/vdso: unmap vdso blob on vvar mapping failure > x86/vdso: introduce do_map_vdso() and vdso_type enum > x86/arch_prctl/vdso: add ARCH_MAP_VDSO_* > x86/coredump: use core regs, rather that TIF_IA32 flag > x86/ptrace: down with test_thread_flag(TIF_IA32) > x86/signal: add SA_{X32,IA32}_ABI sa_flags Oh, forgot to mention: this patches set is based on [3], so kernel build bot may be not happy about applying them. Anyway, I hope for the next revisions, the base-patches will be applied to linux-next and build-bot will test them just fine. > > arch/x86/entry/vdso/vma.c | 72 +++++++++++++++++++++----------------- > arch/x86/ia32/ia32_signal.c | 2 +- > arch/x86/include/asm/compat.h | 8 ++--- > arch/x86/include/asm/fpu/signal.h | 6 ++++ > arch/x86/include/asm/vdso.h | 4 +++ > arch/x86/include/uapi/asm/prctl.h | 6 ++++ > arch/x86/include/uapi/asm/signal.h | 6 +++- > arch/x86/kernel/process_64.c | 10 ++++++ > arch/x86/kernel/ptrace.c | 2 +- > arch/x86/kernel/signal.c | 19 +++++----- > arch/x86/kernel/signal_compat.c | 30 ++++++++++++++-- > fs/binfmt_elf.c | 18 +++++----- > kernel/signal.c | 5 +++ > 13 files changed, 129 insertions(+), 59 deletions(-) > -- Regards, Dmitry Safonov