Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753367AbbHMQTW (ORCPT ); Thu, 13 Aug 2015 12:19:22 -0400 Received: from mail-io0-f169.google.com ([209.85.223.169]:35105 "EHLO mail-io0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752122AbbHMQTV (ORCPT ); Thu, 13 Aug 2015 12:19:21 -0400 MIME-Version: 1.0 In-Reply-To: References: <55CA90B4.2010205@list.ru> Date: Thu, 13 Aug 2015 09:19:20 -0700 X-Google-Sender-Auth: P9esr2ov2M0lqYllwLpLKvTprFo Message-ID: Subject: Re: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu From: Linus Torvalds To: Andy Lutomirski Cc: Stas Sergeev , Linux kernel Content-Type: multipart/mixed; boundary=001a113f89fa9f1df5051d33b2bb Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4709 Lines: 90 --001a113f89fa9f1df5051d33b2bb Content-Type: text/plain; charset=UTF-8 On Thu, Aug 13, 2015 at 8:43 AM, Andy Lutomirski wrote: > > I'm trying to fix it without reverting. If that doesn't work, then we > revert. Yesterday, I thought I had a reasonably clean fix, but it > turned out that it only solved half of the problem. The thing is, I actually think that the current situation is crazy. Especially given that we don't restore any of the other segment registers on x86-64 (except CS, of course) So how about this "alternate" minimal patch instead. The difference is: - we actually leave the regs->ss = __USER_DS; in __setup_rt_frame, to guarantee that when we take a signal, we do take it with a valid SS - but it removes all the other games with SS (and treats it exactly the same as FS/GS). So now we don't play games with the actual sigcontext, and hopefully dosemu is happier. Hmm? That actually makes the code look better, and doesn't re-introduce that annoying CONFIG_X86_32 case (because it now does it in obviously the same place as fs/gs). So the code is cleaner, and closer to what we used to do. Stas, can you test this one too? I, like Luto, don't actually have a dosemu test-case. Linus --001a113f89fa9f1df5051d33b2bb Content-Type: text/plain; charset=US-ASCII; name="patch-really-minimal.diff" Content-Disposition: attachment; filename="patch-really-minimal.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_idaeoyio0 IGFyY2gveDg2L2luY2x1ZGUvYXNtL3NpZ2NvbnRleHQuaCAgICAgIHwgMiArLQogYXJjaC94ODYv aW5jbHVkZS91YXBpL2FzbS9zaWdjb250ZXh0LmggfCAzICstLQogYXJjaC94ODYva2VybmVsL3Np Z25hbC5jICAgICAgICAgICAgICAgfCA0ICsrLS0KIDMgZmlsZXMgY2hhbmdlZCwgNCBpbnNlcnRp b25zKCspLCA1IGRlbGV0aW9ucygtKQoKZGlmZiAtLWdpdCBhL2FyY2gveDg2L2luY2x1ZGUvYXNt L3NpZ2NvbnRleHQuaCBiL2FyY2gveDg2L2luY2x1ZGUvYXNtL3NpZ2NvbnRleHQuaAppbmRleCA2 ZmU2YjE4MmM5OTguLjJjZWZjZTliNTJiZCAxMDA2NDQKLS0tIGEvYXJjaC94ODYvaW5jbHVkZS9h c20vc2lnY29udGV4dC5oCisrKyBiL2FyY2gveDg2L2luY2x1ZGUvYXNtL3NpZ2NvbnRleHQuaApA QCAtNTksNyArNTksNyBAQCBzdHJ1Y3Qgc2lnY29udGV4dCB7CiAJdW5zaWduZWQgc2hvcnQgY3M7 CiAJdW5zaWduZWQgc2hvcnQgX19wYWQyOwkvKiBXYXMgY2FsbGVkIGdzLCBidXQgd2FzIGFsd2F5 cyB6ZXJvLiAqLwogCXVuc2lnbmVkIHNob3J0IF9fcGFkMTsJLyogV2FzIGNhbGxlZCBmcywgYnV0 IHdhcyBhbHdheXMgemVyby4gKi8KLQl1bnNpZ25lZCBzaG9ydCBzczsKKwl1bnNpZ25lZCBzaG9y dCBfX3BhZDA7CiAJdW5zaWduZWQgbG9uZyBlcnI7CiAJdW5zaWduZWQgbG9uZyB0cmFwbm87CiAJ dW5zaWduZWQgbG9uZyBvbGRtYXNrOwpkaWZmIC0tZ2l0IGEvYXJjaC94ODYvaW5jbHVkZS91YXBp L2FzbS9zaWdjb250ZXh0LmggYi9hcmNoL3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DYgQEAgaW50IHJlc3RvcmVfc2lnY29udGV4dChzdHJ1Y3QgcHRf cmVncyAqcmVncywgc3RydWN0IHNpZ2NvbnRleHQgX191c2VyICpzYykKICNlbmRpZiAvKiBDT05G SUdfWDg2XzY0ICovCiAKIAkJQ09QWV9TRUdfQ1BMMyhjcyk7Ci0JCUNPUFlfU0VHX0NQTDMoc3Mp OwogCiAJCWdldF91c2VyX2V4KHRtcGZsYWdzLCAmc2MtPmZsYWdzKTsKIAkJcmVncy0+ZmxhZ3Mg PSAocmVncy0+ZmxhZ3MgJiB+RklYX0VGTEFHUykgfCAodG1wZmxhZ3MgJiBGSVhfRUZMQUdTKTsK QEAgLTE1Niw3ICsxNTYsNyBAQCBpbnQgc2V0dXBfc2lnY29udGV4dChzdHJ1Y3Qgc2lnY29udGV4 dCBfX3VzZXIgKnNjLCB2b2lkIF9fdXNlciAqZnBzdGF0ZSwKIAkJcHV0X3VzZXJfZXgocmVncy0+ Y3MsICZzYy0+Y3MpOwogCQlwdXRfdXNlcl9leCgwLCAmc2MtPl9fcGFkMik7CiAJCXB1dF91c2Vy X2V4KDAsICZzYy0+X19wYWQxKTsKLQkJcHV0X3VzZXJfZXgocmVncy0+c3MsICZzYy0+c3MpOwor CQlwdXRfdXNlcl9leCgwLCAmc2MtPl9fcGFkMCk7CiAjZW5kaWYgLyogQ09ORklHX1g4Nl8zMiAq LwogCiAJCXB1dF91c2VyX2V4KGZwc3RhdGUsICZzYy0+ZnBzdGF0ZSk7Cg== --001a113f89fa9f1df5051d33b2bb-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/