Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1205516 > unrolled thread

[regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu

Started byStas Sergeev <stsp@list.ru>
First post2015-08-12 02:20 +0200
Last post2015-08-13 22:10 +0200
Articles 20 on this page of 105 — 8 participants

Back to article view | Back to linux.kernel


Contents

  [regression] x86/signal/64: Fix SS handling for signals delivered to  64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-12 02:20 +0200
    Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Andy Lutomirski <luto@amacapital.net> - 2015-08-12 02:40 +0200
      Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-12 10:30 +0200
        Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Andy Lutomirski <luto@amacapital.net> - 2015-08-12 18:20 +0200
          Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-12 19:10 +0200
            Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Andy Lutomirski <luto@amacapital.net> - 2015-08-12 20:30 +0200
              Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-12 21:00 +0200
                Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Andy Lutomirski <luto@amacapital.net> - 2015-08-12 21:30 +0200
                  Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-12 22:00 +0200
                    Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Andy Lutomirski <luto@amacapital.net> - 2015-08-12 22:10 +0200
                      Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-12 22:20 +0200
                        Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Andy Lutomirski <luto@amacapital.net> - 2015-08-12 22:30 +0200
                          Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Andy Lutomirski <luto@amacapital.net> - 2015-08-12 22:50 +0200
                            Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-12 23:00 +0200
                              Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Andy Lutomirski <luto@amacapital.net> - 2015-08-12 23:40 +0200
                                Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-13 00:00 +0200
                                  Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Andy Lutomirski <luto@amacapital.net> - 2015-08-13 00:10 +0200
                                    Re: [regression] x86/signal/64: Fix SS handling for signals  delivered to 64-bit programs breaks dosemu Ingo Molnar <mingo@kernel.org> - 2015-08-13 10:50 +0200
                                      Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-13 12:20 +0200
                                      Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-13 14:50 +0200
                                        Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Andy Lutomirski <luto@amacapital.net> - 2015-08-13 17:00 +0200
                                          Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-13 17:30 +0200
                                            Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Andy Lutomirski <luto@amacapital.net> - 2015-08-13 17:40 +0200
                                              Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-13 18:10 +0200
                                                Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Andy Lutomirski <luto@amacapital.net> - 2015-08-13 18:20 +0200
                                                  Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Andy Lutomirski <luto@amacapital.net> - 2015-08-13 18:30 +0200
                                                    Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-13 18:40 +0200
                                                      Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Andy Lutomirski <luto@amacapital.net> - 2015-08-13 18:50 +0200
                                                        Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-13 18:50 +0200
                                                          Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Andy Lutomirski <luto@amacapital.net> - 2015-08-13 19:10 +0200
                                                            Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-13 19:20 +0200
                                                              Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Andy Lutomirski <luto@amacapital.net> - 2015-08-13 19:20 +0200
                                                                Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-13 20:10 +0200
                                                                  Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Andy Lutomirski <luto@amacapital.net> - 2015-08-13 20:10 +0200
                                                                    Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Andy Lutomirski <luto@amacapital.net> - 2015-08-13 20:30 +0200
                                                                      Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-13 20:40 +0200
                                                                    Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-13 20:30 +0200
                                                  Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-13 18:30 +0200
                                    Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-13 13:10 +0200
                          Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-12 22:50 +0200
    Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Linus Torvalds <torvalds@linux-foundation.org> - 2015-08-13 17:40 +0200
      Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Andy Lutomirski <luto@amacapital.net> - 2015-08-13 17:50 +0200
        Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Linus Torvalds <torvalds@linux-foundation.org> - 2015-08-13 18:20 +0200
          Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Andy Lutomirski <luto@amacapital.net> - 2015-08-13 18:30 +0200
            Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Linus Torvalds <torvalds@linux-foundation.org> - 2015-08-13 18:40 +0200
              Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Andy Lutomirski <luto@amacapital.net> - 2015-08-13 18:50 +0200
              Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Linus Torvalds <torvalds@linux-foundation.org> - 2015-08-13 18:50 +0200
        Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Brian Gerst <brgerst@gmail.com> - 2015-08-13 19:10 +0200
          Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-18 08:40 +0200
            Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Andy Lutomirski <luto@amacapital.net> - 2015-08-19 00:50 +0200
              Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-19 11:40 +0200
                Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Andy Lutomirski <luto@amacapital.net> - 2015-08-19 17:50 +0200
                  Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-19 18:40 +0200
            Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Andy Lutomirski <luto@amacapital.net> - 2015-08-19 00:50 +0200
              Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-19 12:20 +0200
                Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Andy Lutomirski <luto@amacapital.net> - 2015-08-19 17:40 +0200
        Re: [regression] x86/signal/64: Fix SS handling for signals  delivered to 64-bit programs breaks dosemu Cyrill Gorcunov <gorcunov@gmail.com> - 2015-08-14 10:20 +0200
      Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-13 20:00 +0200
        Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Linus Torvalds <torvalds@linux-foundation.org> - 2015-08-13 20:40 +0200
          Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Andy Lutomirski <luto@amacapital.net> - 2015-08-13 20:50 +0200
            Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-13 21:10 +0200
              Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Andy Lutomirski <luto@amacapital.net> - 2015-08-13 21:50 +0200
                Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-13 22:20 +0200
            Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Linus Torvalds <torvalds@linux-foundation.org> - 2015-08-13 22:00 +0200
              Re: [regression] x86/signal/64: Fix SS handling for signals  delivered to 64-bit programs breaks dosemu Cyrill Gorcunov <gorcunov@gmail.com> - 2015-08-13 22:10 +0200
                Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Linus Torvalds <torvalds@linux-foundation.org> - 2015-08-13 22:10 +0200
                  Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Raymond Jennings <shentino@gmail.com> - 2015-08-13 23:50 +0200
                    Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Linus Torvalds <torvalds@linux-foundation.org> - 2015-08-13 23:50 +0200
                      Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Raymond Jennings <shentino@gmail.com> - 2015-08-14 00:10 +0200
                        Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-14 00:10 +0200
                        Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Linus Torvalds <torvalds@linux-foundation.org> - 2015-08-14 01:10 +0200
                          Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Linus Torvalds <torvalds@linux-foundation.org> - 2015-08-14 01:20 +0200
                            Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Raymond Jennings <shentino@gmail.com> - 2015-08-14 01:40 +0200
                            Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-14 01:50 +0200
                              Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Linus Torvalds <torvalds@linux-foundation.org> - 2015-08-14 02:10 +0200
                      Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-14 00:10 +0200
                        Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Andy Lutomirski <luto@amacapital.net> - 2015-08-14 00:20 +0200
                          Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-14 00:30 +0200
                            Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Andy Lutomirski <luto@amacapital.net> - 2015-08-14 00:40 +0200
                              Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-14 01:00 +0200
                                Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Andy Lutomirski <luto@amacapital.net> - 2015-08-14 01:10 +0200
                                  Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-14 01:20 +0200
                                  Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Andy Lutomirski <luto@amacapital.net> - 2015-08-14 02:10 +0200
                                    Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-14 02:20 +0200
                                      Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Linus Torvalds <torvalds@linux-foundation.org> - 2015-08-14 02:30 +0200
                                        Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-14 03:00 +0200
                                          Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Andy Lutomirski <luto@amacapital.net> - 2015-08-14 03:30 +0200
                                            Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Andy Lutomirski <luto@amacapital.net> - 2015-08-14 03:40 +0200
                                              Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-14 04:10 +0200
                                              Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-18 08:30 +0200
                                            Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-14 03:40 +0200
                                  Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Linus Torvalds <torvalds@linux-foundation.org> - 2015-08-14 02:10 +0200
                                    Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Andy Lutomirski <luto@amacapital.net> - 2015-08-14 02:30 +0200
                                      Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Linus Torvalds <torvalds@linux-foundation.org> - 2015-08-14 02:50 +0200
                                  Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-14 02:10 +0200
                  Re: [regression] x86/signal/64: Fix SS handling for signals  delivered to 64-bit programs breaks dosemu Cyrill Gorcunov <gorcunov@gmail.com> - 2015-08-14 09:30 +0200
                    Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Pavel Emelyanov <xemul@parallels.com> - 2015-08-14 12:10 +0200
                      Re: [regression] x86/signal/64: Fix SS handling for signals  delivered to 64-bit programs breaks dosemu Cyrill Gorcunov <gorcunov@gmail.com> - 2015-08-14 13:00 +0200
          Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-13 21:00 +0200
            Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Andy Lutomirski <luto@amacapital.net> - 2015-08-13 21:10 +0200
              Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-13 21:20 +0200
                Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Linus Torvalds <torvalds@linux-foundation.org> - 2015-08-13 21:50 +0200
                  Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Linus Torvalds <torvalds@linux-foundation.org> - 2015-08-13 22:10 +0200
                    Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-18 08:50 +0200
                  Re: [regression] x86/signal/64: Fix SS handling for signals delivered  to 64-bit programs breaks dosemu Stas Sergeev <stsp@list.ru> - 2015-08-13 22:10 +0200

Page 3 of 6 — ← Prev page 1 2 [3] 4 5 6  Next page →


#1206920 — Re: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu

FromLinus Torvalds <torvalds@linux-foundation.org>
Date2015-08-13 17:40 +0200
SubjectRe: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu
Message-ID<pX2LL-7qM-5@gated-at.bofh.it>
In reply to#1205516

[Multipart message — attachments visible in raw view] — view raw

On Tue, Aug 11, 2015 at 5:17 PM, Stas Sergeev <stsp@list.ru> wrote:
>
> I realize this patch may be good to have in general, but
> breaking userspace without a single warning is a bit
> discouraging. Seems like the old "we don't break userspace"
> rule have gone.

That rule hasn't gone anywhere.

Does a plain revert just fix everything? Because if so, that's the
right thing to do, and we can just re-visit this later.

I don't understand why Andy and Ingo are even discussing this. What
the f*ck, guys?

Stas, can you verify that this actually fixes it? There's two
different versions here: one that reverts *just* that one commit, and
one that reverts the fs/gs changes too. Can you test them both?

                          Linus

[toc] | [prev] | [next] | [standalone]


#1206926 — Re: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu

FromAndy Lutomirski <luto@amacapital.net>
Date2015-08-13 17:50 +0200
SubjectRe: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu
Message-ID<pX2Vs-7C5-5@gated-at.bofh.it>
In reply to#1206920
On Thu, Aug 13, 2015 at 8:37 AM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
> On Tue, Aug 11, 2015 at 5:17 PM, Stas Sergeev <stsp@list.ru> wrote:
>>
>> I realize this patch may be good to have in general, but
>> breaking userspace without a single warning is a bit
>> discouraging. Seems like the old "we don't break userspace"
>> rule have gone.
>
> That rule hasn't gone anywhere.
>
> Does a plain revert just fix everything? Because if so, that's the
> right thing to do, and we can just re-visit this later.
>
> I don't understand why Andy and Ingo are even discussing this. What
> the f*ck, guys?
>

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.

If we revert, I think I need to check what will break due to the
revert.  I need to check at least Wine, and we'll have to do something
about all the selftests that will start failing.  I also need to check
CRIU, and IIRC CRIU has started using the new sigcontext SS in new
versions.

And, damnit, those selftests are *useful*.  They've smoked out all
kinds of problems.  That's part of the reason I'd prefer not to revert
if there's a better option.

--Andy
--
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/

[toc] | [prev] | [next] | [standalone]


#1206939 — Re: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu

FromLinus Torvalds <torvalds@linux-foundation.org>
Date2015-08-13 18:20 +0200
SubjectRe: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu
Message-ID<pX3ou-8pv-5@gated-at.bofh.it>
In reply to#1206926

[Multipart message — attachments visible in raw view] — view raw

On Thu, Aug 13, 2015 at 8:43 AM, Andy Lutomirski <luto@amacapital.net> 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

[toc] | [prev] | [next] | [standalone]


#1206947 — Re: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu

FromAndy Lutomirski <luto@amacapital.net>
Date2015-08-13 18:30 +0200
SubjectRe: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu
Message-ID<pX3ya-92-13@gated-at.bofh.it>
In reply to#1206939
On Thu, Aug 13, 2015 at 9:19 AM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
> On Thu, Aug 13, 2015 at 8:43 AM, Andy Lutomirski <luto@amacapital.net> 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

That by itself is enough to break DOSEMU.  I think we may be stuck
with my hack to only replace regs->ss if the old one was invalid.

>
>  - 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.

You mean that we always set ss to __USER_DS on sigreturn?  The problem
is that user code *can't* program SS when calling sigreturn because
the SYSCALL instruction zaps it.

I'll try to implement something.

If this regression were new in 4.2-rc, then I'd say revert first and
ask questions later, but the regression is in 4.1 as well :(

--Andy
--
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/

[toc] | [prev] | [next] | [standalone]


#1206955 — Re: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu

FromLinus Torvalds <torvalds@linux-foundation.org>
Date2015-08-13 18:40 +0200
SubjectRe: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu
Message-ID<pX3HQ-kx-31@gated-at.bofh.it>
In reply to#1206947
On Thu, Aug 13, 2015 at 9:23 AM, Andy Lutomirski <luto@amacapital.net> wrote:
> On Thu, Aug 13, 2015 at 9:19 AM, Linus Torvalds
> <torvalds@linux-foundation.org> wrote:
>>
>> 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
>
> That by itself is enough to break DOSEMU.  I think we may be stuck
> with my hack to only replace regs->ss if the old one was invalid.

Are you sure? From the description by Stas, the problem is literally
the *restoring* action of the sigcontext, and trying to restore a SS
value that is no longer valid.

 "The crash happens when DOS program terminates.
  At that point dosemu subverts the execution flow by
  replacing segregs and cs/ip ss/sp in sigcontext with its own.
  But __pad0 still has DOS SS, which crash because (presumably)
  the DOS LDT have been just removed"

and my "truly-minimal" patch removes all of the sigcontext games.

> You mean that we always set ss to __USER_DS on sigreturn?

No. We never touch SS at sigreturn time at all. Only when entering the
signal *handler* do we reset things to a known state. The signal
handler can do anything it wants, and sigreturn won't touch it (which
will obviously _leave_ it as __USER_DS, but avoids the problem with
sigreturn trying to load an SS that is no longer valid)

> If this regression were new in 4.2-rc, then I'd say revert first and
> ask questions later, but the regression is in 4.1 as well :(

Big deal. That's why we have the "cc stable". Distributions that ship
with 4.1 are still fairly few (but it's a LTS release so it will grow)
but they all pick up stable kernels.

And even if they temporarily have a broken situation, it's still
better to make sure that broken situation gets fixed, rather than say
"oh well, too late to do anything about it now".

                 Linus
--
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/

[toc] | [prev] | [next] | [standalone]


#1206965 — Re: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu

FromAndy Lutomirski <luto@amacapital.net>
Date2015-08-13 18:50 +0200
SubjectRe: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu
Message-ID<pX3Rw-w6-19@gated-at.bofh.it>
In reply to#1206955
On Thu, Aug 13, 2015 at 9:43 AM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
> On Thu, Aug 13, 2015 at 9:34 AM, Linus Torvalds
> <torvalds@linux-foundation.org> wrote:
>>
>> Are you sure? From the description by Stas, the problem is literally
>> the *restoring* action of the sigcontext, and trying to restore a SS
>> value that is no longer valid.
>>
>>  "The crash happens when DOS program terminates.
>>   At that point dosemu subverts the execution flow by
>>   replacing segregs and cs/ip ss/sp in sigcontext with its own.
>>   But __pad0 still has DOS SS, which crash because (presumably)
>>   the DOS LDT have been just removed"
>
> Side note: if this is the main issue, and the problem is the "iret"
> faulting when trying to restore SS (and causing an unexpected SIGSEGV
> that dosemu crashes on), then an alternate model might be to keep the
> save/restore SS code, but do a "VERW" on the SS descriptor in
> restore_sigcontext(), and silently just replacing it with __USER_DS if
> that fails.
>

I have a patch to do approximately that (using LAR instead of VERW to
rule out DPL < 3.

I'm 90% sure that the regs->ss = __USER_DS thing is a problem.  Read
farther up in the thread.

I'm leaning toward saying we should revert, cc: stable, and fix it
better for 4.3.

--Andy
--
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/

[toc] | [prev] | [next] | [standalone]


#1206968 — Re: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu

FromLinus Torvalds <torvalds@linux-foundation.org>
Date2015-08-13 18:50 +0200
SubjectRe: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu
Message-ID<pX3Rw-w6-21@gated-at.bofh.it>
In reply to#1206955
On Thu, Aug 13, 2015 at 9:34 AM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
> Are you sure? From the description by Stas, the problem is literally
> the *restoring* action of the sigcontext, and trying to restore a SS
> value that is no longer valid.
>
>  "The crash happens when DOS program terminates.
>   At that point dosemu subverts the execution flow by
>   replacing segregs and cs/ip ss/sp in sigcontext with its own.
>   But __pad0 still has DOS SS, which crash because (presumably)
>   the DOS LDT have been just removed"

Side note: if this is the main issue, and the problem is the "iret"
faulting when trying to restore SS (and causing an unexpected SIGSEGV
that dosemu crashes on), then an alternate model might be to keep the
save/restore SS code, but do a "VERW" on the SS descriptor in
restore_sigcontext(), and silently just replacing it with __USER_DS if
that fails.

                       Linus
--
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/

[toc] | [prev] | [next] | [standalone]


#1206994 — Re: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu

FromBrian Gerst <brgerst@gmail.com>
Date2015-08-13 19:10 +0200
SubjectRe: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu
Message-ID<pX4aS-18m-17@gated-at.bofh.it>
In reply to#1206926
On Thu, Aug 13, 2015 at 11:43 AM, Andy Lutomirski <luto@amacapital.net> wrote:
> On Thu, Aug 13, 2015 at 8:37 AM, Linus Torvalds
> <torvalds@linux-foundation.org> wrote:
>> On Tue, Aug 11, 2015 at 5:17 PM, Stas Sergeev <stsp@list.ru> wrote:
>>>
>>> I realize this patch may be good to have in general, but
>>> breaking userspace without a single warning is a bit
>>> discouraging. Seems like the old "we don't break userspace"
>>> rule have gone.
>>
>> That rule hasn't gone anywhere.
>>
>> Does a plain revert just fix everything? Because if so, that's the
>> right thing to do, and we can just re-visit this later.
>>
>> I don't understand why Andy and Ingo are even discussing this. What
>> the f*ck, guys?
>>
>
> 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.
>
> If we revert, I think I need to check what will break due to the
> revert.  I need to check at least Wine, and we'll have to do something
> about all the selftests that will start failing.  I also need to check
> CRIU, and IIRC CRIU has started using the new sigcontext SS in new
> versions.

I don't think Wine will be a problem, at least how it is currently set
up.  16-bit support is only in the 32-bit build.  The 64-bit build
only supports Win64 apps, and will call the 32-bit version (installed
in parallel) to run 32 and 16-bit apps.

--
Brian Gerst
--
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/

[toc] | [prev] | [next] | [standalone]


#1209070 — Re: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu

FromStas Sergeev <stsp@list.ru>
Date2015-08-18 08:40 +0200
SubjectRe: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu
Message-ID<pYIIW-6B0-3@gated-at.bofh.it>
In reply to#1206994
13.08.2015 20:00, Brian Gerst пишет:
> On Thu, Aug 13, 2015 at 11:43 AM, Andy Lutomirski <luto@amacapital.net> wrote:
>> On Thu, Aug 13, 2015 at 8:37 AM, Linus Torvalds
>> <torvalds@linux-foundation.org> wrote:
>>> On Tue, Aug 11, 2015 at 5:17 PM, Stas Sergeev <stsp@list.ru> wrote:
>>>> I realize this patch may be good to have in general, but
>>>> breaking userspace without a single warning is a bit
>>>> discouraging. Seems like the old "we don't break userspace"
>>>> rule have gone.
>>> That rule hasn't gone anywhere.
>>>
>>> Does a plain revert just fix everything? Because if so, that's the
>>> right thing to do, and we can just re-visit this later.
>>>
>>> I don't understand why Andy and Ingo are even discussing this. What
>>> the f*ck, guys?
>>>
>> 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.
>>
>> If we revert, I think I need to check what will break due to the
>> revert.  I need to check at least Wine, and we'll have to do something
>> about all the selftests that will start failing.  I also need to check
>> CRIU, and IIRC CRIU has started using the new sigcontext SS in new
>> versions.
> I don't think Wine will be a problem, at least how it is currently set
> up.  16-bit support is only in the 32-bit build.  The 64-bit build
> only supports Win64 apps, and will call the 32-bit version (installed
> in parallel) to run 32 and 16-bit apps.
Is this also because of the lack of the proper 32/16bit support in
a 64bit kernels? If so, dosemu's work-arounds do not look like the
too bad thing compared to that. :)
--
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/

[toc] | [prev] | [next] | [standalone]


#1209525 — Re: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu

FromAndy Lutomirski <luto@amacapital.net>
Date2015-08-19 00:50 +0200
SubjectRe: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu
Message-ID<pYXRD-41k-1@gated-at.bofh.it>
In reply to#1209070
On Mon, Aug 17, 2015 at 11:19 PM, Stas Sergeev <stsp@list.ru> wrote:
> 14.08.2015 04:37, Andy Lutomirski пишет:
>
>> On Thu, Aug 13, 2015 at 6:32 PM, Stas Sergeev <stsp@list.ru> wrote:
>>>
>>> 14.08.2015 04:21, Andy Lutomirski пишет:
>>>
>>>> On Thu, Aug 13, 2015 at 5:50 PM, Stas Sergeev <stsp@list.ru> wrote:
>>>>>
>>>>> 14.08.2015 03:27, Linus Torvalds пишет:
>>>>>>
>>>>>> On Thu, Aug 13, 2015 at 5:17 PM, Stas Sergeev <stsp@list.ru> wrote:
>>>>>>>
>>>>>>> For example because you can as well do:
>>>>>>> prctl(ARCH_SET_SIGNAL_SS, 0)
>>>>>>> which will mean "restore ss in sighandler to its current value",
>>>>>>
>>>>>> I really think a prctl() is the wrong thing to do.
>>>>>>
>>>>>> If you want a signal handler to save/restore segments, I think it
>>>>>> should be a SA_xyz flag to sigaction() (the way we have SA_RESTART
>>>>>
>>>>> Yes, I was proposing the new sigaction() flag in this thread
>>>>> already too. But at the end, prctl() looks better to me because
>>>>> it allows to pass the TLS value to use when restoring FS.
>>>>> The thing is that I am trying to find the similar treatment for
>>>>> both the SS and FS problems. If you don't think they need a
>>>>> similar treatment, then perhaps the Andy's patch is enough.
>>>>>
>>>>>> etc).  And off by default because of the obvious compatibility issues.
>>>>>
>>>>> Of course.
>>>>>
>>>>> So, what we have right now (in the latest Andy's patch) is:
>>>>> 1. lar heuristics
>>>>> 2. new uc_flags flag
>>>>>
>>>>> What it solves: dosemu's regression.
>>>>>
>>>>> What prctl() can give:
>>>>> - fix to dosemu's regression
>>>>> - fix to the TLS problem in the future
>>>>> - no hack and heuristics
>>>>>
>>>>> With SA_xyz you can only solve the SS problem, so it is
>>>>> probably not any better than the uc_flags things coded
>>>>> up by Andy.
>>>>
>>>> I'm leaning slightly toward LAR heuristic + SA_SAVE_SS.
>>>
>>> Stop right here, doesn't the SA_xyz allow to avoid the
>>> lar heuristic? Why would you still need the lar heuristic then?
>>> Just call it SA_RESTORE_SS instead of SA_SAVE_SS, and
>>> the lar heuristic is gone.
>>
>> The LAR heuristic is about five lines of code, and it makes signal
>> delivery more reliable.
>
> Why more reliable? In what case?
>
>>    Sure, we could gate the "regs->ss =
>> __USER_DS" line on a flag, but why?
>
> A few things I can think of why:
> - nested signals (usual for dosemu)

What's the issue with nested signals?

> - using siglongjmp() to return to dosemu (rather than to DOS code)
> Both cases look very scare when using SS from just freed LDT entry.
> How would you even justify and changelog the patch that adds a lar
> heuristic code that no one uses or wants? Since SA_hyz flag allows
> you to do without, why not to just keep things safe and simple?

The LAR heuristic is just for compatibility.

ISTM what DOSEMU should want (on new kernels, anyway) is the ability
to save and restore SS just like any other register, which is what my
patch did.  The issue is that it broke old DOSEMU.  I want to find a
way to keep old DOSEMU working while making things work better for new
code that's aware of new behavior.  That means we want some way
(opt-in or magically compatible with old DOSEMU) to get SS saved and
restored.

Incidentally, I tried implementing the sigaction flag approach.  I
think it's no good.  When we return from a signal, there's no concept
of sigaction -- it's just sigreturn.  Sigreturn can't look up the
sigaction flags -- what if the signal handler calls sigaction itself.
So we either need a per-task flag, a per-sighand flag, or a sigcontext
flag indicating what we should do.

(Yes, I suspect we really might want some way to get FS, GS, and their
bases saved and restored, but I still think we should do that
separately.)

-- 
Andy Lutomirski
AMA Capital Management, LLC
--
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/

[toc] | [prev] | [next] | [standalone]


#1209748 — Re: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu

FromStas Sergeev <stsp@list.ru>
Date2015-08-19 11:40 +0200
SubjectRe: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu
Message-ID<pZ80H-1Xp-33@gated-at.bofh.it>
In reply to#1209525
19.08.2015 01:47, Andy Lutomirski пишет:
> On Mon, Aug 17, 2015 at 11:19 PM, Stas Sergeev <stsp@list.ru> wrote:
>> 14.08.2015 04:37, Andy Lutomirski пишет:
>>
>>> On Thu, Aug 13, 2015 at 6:32 PM, Stas Sergeev <stsp@list.ru> wrote:
>>>>
>>>> 14.08.2015 04:21, Andy Lutomirski пишет:
>>>>
>>>>> On Thu, Aug 13, 2015 at 5:50 PM, Stas Sergeev <stsp@list.ru> wrote:
>>>>>>
>>>>>> 14.08.2015 03:27, Linus Torvalds пишет:
>>>>>>>
>>>>>>> On Thu, Aug 13, 2015 at 5:17 PM, Stas Sergeev <stsp@list.ru> wrote:
>>>>>>>>
>>>>>>>> For example because you can as well do:
>>>>>>>> prctl(ARCH_SET_SIGNAL_SS, 0)
>>>>>>>> which will mean "restore ss in sighandler to its current value",
>>>>>>>
>>>>>>> I really think a prctl() is the wrong thing to do.
>>>>>>>
>>>>>>> If you want a signal handler to save/restore segments, I think it
>>>>>>> should be a SA_xyz flag to sigaction() (the way we have SA_RESTART
>>>>>>
>>>>>> Yes, I was proposing the new sigaction() flag in this thread
>>>>>> already too. But at the end, prctl() looks better to me because
>>>>>> it allows to pass the TLS value to use when restoring FS.
>>>>>> The thing is that I am trying to find the similar treatment for
>>>>>> both the SS and FS problems. If you don't think they need a
>>>>>> similar treatment, then perhaps the Andy's patch is enough.
>>>>>>
>>>>>>> etc).  And off by default because of the obvious compatibility issues.
>>>>>>
>>>>>> Of course.
>>>>>>
>>>>>> So, what we have right now (in the latest Andy's patch) is:
>>>>>> 1. lar heuristics
>>>>>> 2. new uc_flags flag
>>>>>>
>>>>>> What it solves: dosemu's regression.
>>>>>>
>>>>>> What prctl() can give:
>>>>>> - fix to dosemu's regression
>>>>>> - fix to the TLS problem in the future
>>>>>> - no hack and heuristics
>>>>>>
>>>>>> With SA_xyz you can only solve the SS problem, so it is
>>>>>> probably not any better than the uc_flags things coded
>>>>>> up by Andy.
>>>>>
>>>>> I'm leaning slightly toward LAR heuristic + SA_SAVE_SS.
>>>>
>>>> Stop right here, doesn't the SA_xyz allow to avoid the
>>>> lar heuristic? Why would you still need the lar heuristic then?
>>>> Just call it SA_RESTORE_SS instead of SA_SAVE_SS, and
>>>> the lar heuristic is gone.
>>>
>>> The LAR heuristic is about five lines of code, and it makes signal
>>> delivery more reliable.
>>
>> Why more reliable? In what case?
>>
>>>    Sure, we could gate the "regs->ss =
>>> __USER_DS" line on a flag, but why?
>>
>> A few things I can think of why:
>> - nested signals (usual for dosemu)
> 
> What's the issue with nested signals?
If nested signal is async and SS is from LDT just freed, then
the nested signal will silently change the SS value. So if you
are saving it somewhere, you'll save it by luck.
Now this is unlikely to happen, as the async signals in dosemu
are all blocked inside any sighandler. So the siglongjmp() case
is more expressive: if dosemu jumped via siglongjmp() and as such
unblocked the async signals, it will likely want to save its
registers before doing a new switch. Now, since SS is invalid
and will be therefore changed by a sighandler, what it will save
depends on a luck.
Not that dosemu uses siglongjmp() right now, but I am just asking
to please not implement the unreliable interfaces _if possible_.

>> - using siglongjmp() to return to dosemu (rather than to DOS code)
>> Both cases look very scare when using SS from just freed LDT entry.
>> How would you even justify and changelog the patch that adds a lar
>> heuristic code that no one uses or wants? Since SA_hyz flag allows
>> you to do without, why not to just keep things safe and simple?
> 
> The LAR heuristic is just for compatibility.
> 
> ISTM what DOSEMU should want (on new kernels, anyway) is the ability
> to save and restore SS just like any other register, which is what my
> patch did.  The issue is that it broke old DOSEMU.  I want to find a
> way to keep old DOSEMU working while making things work better for new
> code that's aware of new behavior.  That means we want some way
> (opt-in or magically compatible with old DOSEMU) to get SS saved and
> restored.
> 
> Incidentally, I tried implementing the sigaction flag approach.  I
> think it's no good.  When we return from a signal, there's no concept
> of sigaction -- it's just sigreturn.  Sigreturn can't look up the
> sigaction flags -- what if the signal handler calls sigaction itself.
How about the SA_hyz flag that does the following:
- Saves SS into sigcontext
- Forces SS to USER_DS on signal delivery
- Sets the uc_flags flag for sigreturn() to take care of the rest.
You'll have both the control on every bit of action, and a simple
detection logic: if SA_hyz didn't set the uc flag - it didn't work.
You can even employ your lar heuristic here for the case when the
aforementioned SA_hyz is not set. But please, please not when it is
set! In fact, I wonder if you had in mind exactly that: using the
lar heuristic only if the SA_hyz is not set. If so - I misunderstood.
Just please don't add it when it is set.

> So we either need a per-task flag, a per-sighand flag, or a sigcontext
> flag indicating what we should do.
> 
> (Yes, I suspect we really might want some way to get FS, GS, and their
> bases saved and restored, but I still think we should do that
> separately.)
In fact, I have already convinced myself that SA_hyz can take
care of both cases. :) Maybe you'll just need to extend the struct sigaction
to pass the TLS address, but this doesn't look absolutely impossible...
--
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/

[toc] | [prev] | [next] | [standalone]


#1209917 — Re: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu

FromAndy Lutomirski <luto@amacapital.net>
Date2015-08-19 17:50 +0200
SubjectRe: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu
Message-ID<pZdMJ-1OT-9@gated-at.bofh.it>
In reply to#1209748
On Wed, Aug 19, 2015 at 2:35 AM, Stas Sergeev <stsp@list.ru> wrote:
> 19.08.2015 01:47, Andy Lutomirski пишет:
>> On Mon, Aug 17, 2015 at 11:19 PM, Stas Sergeev <stsp@list.ru> wrote:
>>> 14.08.2015 04:37, Andy Lutomirski пишет:
>>>
>>>> On Thu, Aug 13, 2015 at 6:32 PM, Stas Sergeev <stsp@list.ru> wrote:
>>>>>
>>>>> 14.08.2015 04:21, Andy Lutomirski пишет:
>>>>>
>>>>>> On Thu, Aug 13, 2015 at 5:50 PM, Stas Sergeev <stsp@list.ru> wrote:
>>>>>>>
>>>>>>> 14.08.2015 03:27, Linus Torvalds пишет:
>>>>>>>>
>>>>>>>> On Thu, Aug 13, 2015 at 5:17 PM, Stas Sergeev <stsp@list.ru> wrote:
>>>>>>>>>
>>>>>>>>> For example because you can as well do:
>>>>>>>>> prctl(ARCH_SET_SIGNAL_SS, 0)
>>>>>>>>> which will mean "restore ss in sighandler to its current value",
>>>>>>>>
>>>>>>>> I really think a prctl() is the wrong thing to do.
>>>>>>>>
>>>>>>>> If you want a signal handler to save/restore segments, I think it
>>>>>>>> should be a SA_xyz flag to sigaction() (the way we have SA_RESTART
>>>>>>>
>>>>>>> Yes, I was proposing the new sigaction() flag in this thread
>>>>>>> already too. But at the end, prctl() looks better to me because
>>>>>>> it allows to pass the TLS value to use when restoring FS.
>>>>>>> The thing is that I am trying to find the similar treatment for
>>>>>>> both the SS and FS problems. If you don't think they need a
>>>>>>> similar treatment, then perhaps the Andy's patch is enough.
>>>>>>>
>>>>>>>> etc).  And off by default because of the obvious compatibility issues.
>>>>>>>
>>>>>>> Of course.
>>>>>>>
>>>>>>> So, what we have right now (in the latest Andy's patch) is:
>>>>>>> 1. lar heuristics
>>>>>>> 2. new uc_flags flag
>>>>>>>
>>>>>>> What it solves: dosemu's regression.
>>>>>>>
>>>>>>> What prctl() can give:
>>>>>>> - fix to dosemu's regression
>>>>>>> - fix to the TLS problem in the future
>>>>>>> - no hack and heuristics
>>>>>>>
>>>>>>> With SA_xyz you can only solve the SS problem, so it is
>>>>>>> probably not any better than the uc_flags things coded
>>>>>>> up by Andy.
>>>>>>
>>>>>> I'm leaning slightly toward LAR heuristic + SA_SAVE_SS.
>>>>>
>>>>> Stop right here, doesn't the SA_xyz allow to avoid the
>>>>> lar heuristic? Why would you still need the lar heuristic then?
>>>>> Just call it SA_RESTORE_SS instead of SA_SAVE_SS, and
>>>>> the lar heuristic is gone.
>>>>
>>>> The LAR heuristic is about five lines of code, and it makes signal
>>>> delivery more reliable.
>>>
>>> Why more reliable? In what case?
>>>
>>>>    Sure, we could gate the "regs->ss =
>>>> __USER_DS" line on a flag, but why?
>>>
>>> A few things I can think of why:
>>> - nested signals (usual for dosemu)
>>
>> What's the issue with nested signals?
> If nested signal is async and SS is from LDT just freed, then
> the nested signal will silently change the SS value. So if you
> are saving it somewhere, you'll save it by luck.
> Now this is unlikely to happen, as the async signals in dosemu
> are all blocked inside any sighandler. So the siglongjmp() case
> is more expressive: if dosemu jumped via siglongjmp() and as such
> unblocked the async signals, it will likely want to save its
> registers before doing a new switch. Now, since SS is invalid
> and will be therefore changed by a sighandler, what it will save
> depends on a luck.
> Not that dosemu uses siglongjmp() right now, but I am just asking
> to please not implement the unreliable interfaces _if possible_.

Ok, I think I get it.

I'm not proposing the LAR thing as something that anyone should
intentionally use going forward.  It would only be for compatbility
with old code if needed.  We certainly should save SS somewhere.

>> Incidentally, I tried implementing the sigaction flag approach.  I
>> think it's no good.  When we return from a signal, there's no concept
>> of sigaction -- it's just sigreturn.  Sigreturn can't look up the
>> sigaction flags -- what if the signal handler calls sigaction itself.
> How about the SA_hyz flag that does the following:
> - Saves SS into sigcontext
> - Forces SS to USER_DS on signal delivery
> - Sets the uc_flags flag for sigreturn() to take care of the rest.
> You'll have both the control on every bit of action, and a simple
> detection logic: if SA_hyz didn't set the uc flag - it didn't work.
> You can even employ your lar heuristic here for the case when the
> aforementioned SA_hyz is not set. But please, please not when it is
> set! In fact, I wonder if you had in mind exactly that: using the
> lar heuristic only if the SA_hyz is not set. If so - I misunderstood.
> Just please don't add it when it is set.

Hmm, interesting.  Maybe that would work for everything.  How's this
to make it concrete?

Add a sigaction flag SA_RESTORE_SS.

On signal delivery, always save SS into sigcontext->ss. if
SA_RESTORE_SS is set, then unconditionally switch HW SS to __USER_DS
and set UC_RESTORE_SS.  If SA_RESTORE_SS is clear, then leave HW SS
alone (i.e. preserve the old behavior).

On signal return, if UC_RESTORE_SS is set, then restore
sigcontext->ss.  If not, then set SS to __USER_DS (as old kernels
did).

This should change nothing at all (except the initial value of
sigcontext->ss / __pad0) on old kernels.

>
>> So we either need a per-task flag, a per-sighand flag, or a sigcontext
>> flag indicating what we should do.
>>
>> (Yes, I suspect we really might want some way to get FS, GS, and their
>> bases saved and restored, but I still think we should do that
>> separately.)
> In fact, I have already convinced myself that SA_hyz can take
> care of both cases. :) Maybe you'll just need to extend the struct sigaction
> to pass the TLS address, but this doesn't look absolutely impossible...

I think that should be a separate SA_ flag down the road, if for no
other reason than that the SS thing can be done more or less
immediately, whereas getting FS and GS right needs to wait.

Also, it occurs to me that FS and GS could become more complicated.
There are some proposals to allow tasks to opt in to having a per-cpu
GS.  If that happens, then figuring out how it would interact with
signals could be complicated.

--Andy
--
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/

[toc] | [prev] | [next] | [standalone]


#1209947 — Re: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu

FromStas Sergeev <stsp@list.ru>
Date2015-08-19 18:40 +0200
SubjectRe: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu
Message-ID<pZez9-2Yu-39@gated-at.bofh.it>
In reply to#1209917
19.08.2015 18:46, Andy Lutomirski пишет:
> On Wed, Aug 19, 2015 at 2:35 AM, Stas Sergeev <stsp@list.ru> wrote:
>>> Incidentally, I tried implementing the sigaction flag approach.  I
>>> think it's no good.  When we return from a signal, there's no concept
>>> of sigaction -- it's just sigreturn.  Sigreturn can't look up the
>>> sigaction flags -- what if the signal handler calls sigaction itself.
>> How about the SA_hyz flag that does the following:
>> - Saves SS into sigcontext
>> - Forces SS to USER_DS on signal delivery
>> - Sets the uc_flags flag for sigreturn() to take care of the rest.
>> You'll have both the control on every bit of action, and a simple
>> detection logic: if SA_hyz didn't set the uc flag - it didn't work.
>> You can even employ your lar heuristic here for the case when the
>> aforementioned SA_hyz is not set. But please, please not when it is
>> set! In fact, I wonder if you had in mind exactly that: using the
>> lar heuristic only if the SA_hyz is not set. If so - I misunderstood.
>> Just please don't add it when it is set.
> 
> Hmm, interesting.  Maybe that would work for everything.  How's this
> to make it concrete?
> 
> Add a sigaction flag SA_RESTORE_SS.
> 
> On signal delivery, always save SS into sigcontext->ss. if
> SA_RESTORE_SS is set, then unconditionally switch HW SS to __USER_DS
> and set UC_RESTORE_SS.  If SA_RESTORE_SS is clear, then leave HW SS
> alone (i.e. preserve the old behavior).
Either that, or employ the lar heuristic for the "not set" case
(I think its not needed).

> On signal return, if UC_RESTORE_SS is set, then restore
> sigcontext->ss.  If not, then set SS to __USER_DS (as old kernels
> did).
> 
> This should change nothing at all (except the initial value of
> sigcontext->ss / __pad0) on old kernels.
Agreed.

>>> So we either need a per-task flag, a per-sighand flag, or a sigcontext
>>> flag indicating what we should do.
>>>
>>> (Yes, I suspect we really might want some way to get FS, GS, and their
>>> bases saved and restored, but I still think we should do that
>>> separately.)
>> In fact, I have already convinced myself that SA_hyz can take
>> care of both cases. :) Maybe you'll just need to extend the struct sigaction
>> to pass the TLS address, but this doesn't look absolutely impossible...
> 
> I think that should be a separate SA_ flag down the road,
Of course separate.
I only wanted to get a "somewhat similar" solution, so if the
TLS case can also be covered by the (different) SA_ flag (plus
perhaps a struct sigaction extension), then its just excellent.
What I was afraid of is to get an SS-specific fix, like your
initial uc_flags+lar_heuristic solution. Such fix can't be
extended to the TLS case, reducing the chances for the TLS case
to be ever re-visited.

> Also, it occurs to me that FS and GS could become more complicated.
> There are some proposals to allow tasks to opt in to having a per-cpu
> GS.  If that happens, then figuring out how it would interact with
> signals could be complicated.
Is this a problem?
At least on 86_64, according to this:
http://wiki.osdev.org/Thread_Local_Storage#x86-64
we only need FS.
In any case, since what you say about GS is optional and should
be explicitly requested by the task, it can just disable the use
of the new SA_TLS flag, making the sigaction() to return error for
example. I think the amount of the supported combinations should
be limited by the practical needs, and I don't think someone will
need per-cpu GS with sighandler re-setting it to something non-per-cpu.
--
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/

[toc] | [prev] | [next] | [standalone]


#1209529 — Re: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu

FromAndy Lutomirski <luto@amacapital.net>
Date2015-08-19 00:50 +0200
SubjectRe: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu
Message-ID<pYXRD-41k-3@gated-at.bofh.it>
In reply to#1209070
On Mon, Aug 17, 2015 at 11:29 PM, Stas Sergeev <stsp@list.ru> wrote:
> 13.08.2015 20:00, Brian Gerst пишет:
>
>> On Thu, Aug 13, 2015 at 11:43 AM, Andy Lutomirski <luto@amacapital.net>
>> wrote:
>>>
>>> On Thu, Aug 13, 2015 at 8:37 AM, Linus Torvalds
>>> <torvalds@linux-foundation.org> wrote:
>>>>
>>>> On Tue, Aug 11, 2015 at 5:17 PM, Stas Sergeev <stsp@list.ru> wrote:
>>>>>
>>>>> I realize this patch may be good to have in general, but
>>>>> breaking userspace without a single warning is a bit
>>>>> discouraging. Seems like the old "we don't break userspace"
>>>>> rule have gone.
>>>>
>>>> That rule hasn't gone anywhere.
>>>>
>>>> Does a plain revert just fix everything? Because if so, that's the
>>>> right thing to do, and we can just re-visit this later.
>>>>
>>>> I don't understand why Andy and Ingo are even discussing this. What
>>>> the f*ck, guys?
>>>>
>>> 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.
>>>
>>> If we revert, I think I need to check what will break due to the
>>> revert.  I need to check at least Wine, and we'll have to do something
>>> about all the selftests that will start failing.  I also need to check
>>> CRIU, and IIRC CRIU has started using the new sigcontext SS in new
>>> versions.
>>
>> I don't think Wine will be a problem, at least how it is currently set
>> up.  16-bit support is only in the 32-bit build.  The 64-bit build
>> only supports Win64 apps, and will call the 32-bit version (installed
>> in parallel) to run 32 and 16-bit apps.
>
> Is this also because of the lack of the proper 32/16bit support in
> a 64bit kernels? If so, dosemu's work-arounds do not look like the
> too bad thing compared to that. :)

What do you mean lack of proper 32/16 bit support?

--Andy
--
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/

[toc] | [prev] | [next] | [standalone]


#1209762 — Re: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu

FromStas Sergeev <stsp@list.ru>
Date2015-08-19 12:20 +0200
SubjectRe: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu
Message-ID<pZ8Dn-2VW-1@gated-at.bofh.it>
In reply to#1209529
19.08.2015 01:42, Andy Lutomirski пишет:
> On Mon, Aug 17, 2015 at 11:29 PM, Stas Sergeev <stsp@list.ru> wrote:
>> 13.08.2015 20:00, Brian Gerst пишет:
>>
>>> On Thu, Aug 13, 2015 at 11:43 AM, Andy Lutomirski <luto@amacapital.net>
>>> wrote:
>>>>
>>>> On Thu, Aug 13, 2015 at 8:37 AM, Linus Torvalds
>>>> <torvalds@linux-foundation.org> wrote:
>>>>>
>>>>> On Tue, Aug 11, 2015 at 5:17 PM, Stas Sergeev <stsp@list.ru> wrote:
>>>>>>
>>>>>> I realize this patch may be good to have in general, but
>>>>>> breaking userspace without a single warning is a bit
>>>>>> discouraging. Seems like the old "we don't break userspace"
>>>>>> rule have gone.
>>>>>
>>>>> That rule hasn't gone anywhere.
>>>>>
>>>>> Does a plain revert just fix everything? Because if so, that's the
>>>>> right thing to do, and we can just re-visit this later.
>>>>>
>>>>> I don't understand why Andy and Ingo are even discussing this. What
>>>>> the f*ck, guys?
>>>>>
>>>> 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.
>>>>
>>>> If we revert, I think I need to check what will break due to the
>>>> revert.  I need to check at least Wine, and we'll have to do something
>>>> about all the selftests that will start failing.  I also need to check
>>>> CRIU, and IIRC CRIU has started using the new sigcontext SS in new
>>>> versions.
>>>
>>> I don't think Wine will be a problem, at least how it is currently set
>>> up.  16-bit support is only in the 32-bit build.  The 64-bit build
>>> only supports Win64 apps, and will call the 32-bit version (installed
>>> in parallel) to run 32 and 16-bit apps.
>>
>> Is this also because of the lack of the proper 32/16bit support in
>> a 64bit kernels? If so, dosemu's work-arounds do not look like the
>> too bad thing compared to that. :)
> 
> What do you mean lack of proper 32/16 bit support?
At least the following:

1. vm86().
There was a patch:
http://v86-64.sourceforge.net/
Afaik rejected by Andi Kleen (likely for a good reason - too complex).
There is some kvm-based alternative which IIRC was called by dosemu authors
as "too slow", and so they started to use a jit-compiler. Wine have started
to use dosbox for the DOS progs AFAIK. So both projects have a work-arounds
to this limitation with which they are happy, and so it probably not worth
the re-visiting.

2. espfix64.
Its there since 3.16, but dosemu have lots of work-arounds in its code.
The iret trampoline, for example, uses the carefully aligned stack page,
where the high word of ESP is zero.
Another part of the work-around is in a sighandler to decode the
instruction to figure out what register caused a fault (corrupted esp
value usually goes into ebp first, then to other regs) and zero out
the high word of that, plus the high word of esp. There are also other
bits of the work-around spread around the dosemu code, and I am surprised
it actually even works!

3. SS problem. Was fixed in some versions of 4.1; not fixed any more. ;)
dosemu did a glorious iret work-around.

4. FS problem.
Worked around by autoconf checks to ban some gcc options, plus some
special care when accessing thread-local vars in a sighandler.
While your suggestion is to write an asm handlers, to the date I don't
think anyone did that. It is easier to work-around it by other means.
Maybe if you show an example of such handler, the things will change,
but it is simpler to just wait for a kernel fix IMHO.

This is what I called a 32/16bit support, and in fact, when I installed
dosemu on a 64bit machine, started win31 and it just worked, I
immediately wrote my regards to Bart Oldeman, so much I was impressed -
I thought it is absolutely impossible to make this whole mess working
reliably.
I guess wine authors just were not as brave and decided to wait for
the kernel functionality in place.
--
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/

[toc] | [prev] | [next] | [standalone]


#1209900 — Re: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu

FromAndy Lutomirski <luto@amacapital.net>
Date2015-08-19 17:40 +0200
SubjectRe: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu
Message-ID<pZdD4-1Du-7@gated-at.bofh.it>
In reply to#1209762
On Wed, Aug 19, 2015 at 3:10 AM, Stas Sergeev <stsp@list.ru> wrote:
> 19.08.2015 01:42, Andy Lutomirski пишет:
>> What do you mean lack of proper 32/16 bit support?
> At least the following:
>
> 1. vm86().
> There was a patch:
> http://v86-64.sourceforge.net/
> Afaik rejected by Andi Kleen (likely for a good reason - too complex).
> There is some kvm-based alternative which IIRC was called by dosemu authors
> as "too slow", and so they started to use a jit-compiler. Wine have started
> to use dosbox for the DOS progs AFAIK. So both projects have a work-arounds
> to this limitation with which they are happy, and so it probably not worth
> the re-visiting.
>

Wow!

Yeah, that's quite a hack.  EFI mixed mode support used to play
similar tricks.  Unfortunately, switching in and out of long mode at
runtime works very poorly and has terrible interactions with perf, so
EFI stopped doing that.

> 2. espfix64.
> Its there since 3.16, but dosemu have lots of work-arounds in its code.
> The iret trampoline, for example, uses the carefully aligned stack page,
> where the high word of ESP is zero.
> Another part of the work-around is in a sighandler to decode the
> instruction to figure out what register caused a fault (corrupted esp
> value usually goes into ebp first, then to other regs) and zero out
> the high word of that, plus the high word of esp. There are also other
> bits of the work-around spread around the dosemu code, and I am surprised
> it actually even works!

Wow, no kidding!  At least this is fixed now.

>
> 3. SS problem. Was fixed in some versions of 4.1; not fixed any more. ;)
> dosemu did a glorious iret work-around.
>
> 4. FS problem.
> Worked around by autoconf checks to ban some gcc options, plus some
> special care when accessing thread-local vars in a sighandler.
> While your suggestion is to write an asm handlers, to the date I don't
> think anyone did that. It is easier to work-around it by other means.
> Maybe if you show an example of such handler, the things will change,
> but it is simpler to just wait for a kernel fix IMHO.
>

Something like:

mov $__NR_arch_prctl, %rax
mov $ARCH_GET_FS, %rdi
mov [wherever you safe fsbase], %rsi
syscall
mov $ARCH_SET_FS, %rdi
mov (wherever you stashed glibc's value), %rsi
syscall
pushq $0
call real_signal_handler
popq %rax
mov $__NR_arch_prctl, %rax
mov $ARCH_SET_FS, %rdi
mov (saved value), %rsi
syscall
ret

Yeah, it's ugly.  It may very well be worth changing this once the
FSBASE stuff happens.

--Andy
--
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/

[toc] | [prev] | [next] | [standalone]


#1207395 — Re: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu

FromCyrill Gorcunov <gorcunov@gmail.com>
Date2015-08-14 10:20 +0200
SubjectRe: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu
Message-ID<pXinw-4Rh-9@gated-at.bofh.it>
In reply to#1206926
On Thu, Aug 13, 2015 at 08:43:24AM -0700, Andy Lutomirski wrote:
...
> >
> > That rule hasn't gone anywhere.
> >
> > Does a plain revert just fix everything? Because if so, that's the
> > right thing to do, and we can just re-visit this later.
> >
> > I don't understand why Andy and Ingo are even discussing this. What
> > the f*ck, guys?
> >
> 
> 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.
> 
> If we revert, I think I need to check what will break due to the
> revert.  I need to check at least Wine, and we'll have to do something
> about all the selftests that will start failing.  I also need to check
> CRIU, and IIRC CRIU has started using the new sigcontext SS in new
> versions.

Yes, we've tuned up our sigcontext structure and put ss into the place
where previously __pad0 were. After the revert the kernel simply ignores
this field again. But we never did any "weird" gaming over segment registers
for testing purposes, neither we note any application (in containers) which
does some weird things like dosemu.

> 
> And, damnit, those selftests are *useful*.  They've smoked out all
> kinds of problems.  That's part of the reason I'd prefer not to revert
> if there's a better option.
--
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/

[toc] | [prev] | [next] | [standalone]


#1207026 — Re: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu

FromStas Sergeev <stsp@list.ru>
Date2015-08-13 20:00 +0200
SubjectRe: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu
Message-ID<pX4Xf-23o-3@gated-at.bofh.it>
In reply to#1206920
13.08.2015 18:37, Linus Torvalds пишет:
> On Tue, Aug 11, 2015 at 5:17 PM, Stas Sergeev <stsp@list.ru> wrote:
>> I realize this patch may be good to have in general, but
>> breaking userspace without a single warning is a bit
>> discouraging. Seems like the old "we don't break userspace"
>> rule have gone.
> That rule hasn't gone anywhere.
>
> Does a plain revert just fix everything? Because if so, that's the
> right thing to do, and we can just re-visit this later.
>
> I don't understand why Andy and Ingo are even discussing this. What
> the f*ck, guys?
>
> Stas, can you verify that this actually fixes it? There's two
> different versions here: one that reverts *just* that one commit, and
> one that reverts the fs/gs changes too. Can you test them both?
Hello Linus, I verified that patch-minimal.diff is enough
to fix the problem, BUT! dosemu is in fact using the .fs and
.gs fields of sigcontext as a placeholders. Why the minimal
patch alone helps is simply because the kernel headers
installed in a system do not yet represent the newer kernel
developments and have the .fs and .gs fields in.
So, to allow the pre-compiled dosemu binary to run, patch-minimal
is enough. To allow re-compiling it, you'd need patch.diff.
Although I guess compilation is not the point, and the
fact that the pre-compiled binary works, is enough.

Now my PC is dying of overheat, I am struggling to even
boot it. I am not sure I'll test the "really-minimal" patch,
but it will unlikely to help because dosemu expects unmodified
ss in a sighandler, which "really-minimal" patch doesn't seem
to give.
--
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/

[toc] | [prev] | [next] | [standalone]


#1207059 — Re: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu

FromLinus Torvalds <torvalds@linux-foundation.org>
Date2015-08-13 20:40 +0200
SubjectRe: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu
Message-ID<pX5zY-32e-19@gated-at.bofh.it>
In reply to#1207026
On Thu, Aug 13, 2015 at 10:51 AM, Stas Sergeev <stsp@list.ru> wrote:
>
> Hello Linus, I verified that patch-minimal.diff is enough
> to fix the problem, BUT! dosemu is in fact using the .fs and
> .gs fields of sigcontext as a placeholders. Why the minimal
> patch alone helps is simply because the kernel headers
> installed in a system do not yet represent the newer kernel
> developments and have the .fs and .gs fields in.

Ok. So I'm inclined to do the bigger revert, just to fix the compile
issue. It would be crazy to force some silly autoconf script for
random header info.

Of course, we could also just let the uabi version go out of sync with
the internal version, but that sounds even worse. I think we'd be
better off just leaving the old names, and just having big comments
about this..

Andy? I agree that we should strive to improve in this area, and this
should be worked on, but that would seem to be a 4.3 issue (and mark
that too for stable once it actually works). No?

                    Linus
--
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/

[toc] | [prev] | [next] | [standalone]


#1207064 — Re: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu

FromAndy Lutomirski <luto@amacapital.net>
Date2015-08-13 20:50 +0200
SubjectRe: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu
Message-ID<pX5JD-3dG-7@gated-at.bofh.it>
In reply to#1207059
On Thu, Aug 13, 2015 at 11:35 AM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
> On Thu, Aug 13, 2015 at 10:51 AM, Stas Sergeev <stsp@list.ru> wrote:
>>
>> Hello Linus, I verified that patch-minimal.diff is enough
>> to fix the problem, BUT! dosemu is in fact using the .fs and
>> .gs fields of sigcontext as a placeholders. Why the minimal
>> patch alone helps is simply because the kernel headers
>> installed in a system do not yet represent the newer kernel
>> developments and have the .fs and .gs fields in.
>
> Ok. So I'm inclined to do the bigger revert, just to fix the compile
> issue. It would be crazy to force some silly autoconf script for
> random header info.
>
> Of course, we could also just let the uabi version go out of sync with
> the internal version, but that sounds even worse. I think we'd be
> better off just leaving the old names, and just having big comments
> about this..
>
> Andy? I agree that we should strive to improve in this area, and this
> should be worked on, but that would seem to be a 4.3 issue (and mark
> that too for stable once it actually works). No?

Yeah, probably makes sense, but one of us should explicitly test CRIU
(both new and old versions) on the result.  CRIU does interesting
things involving sigcontext and protocol buffers.

We can do something a bit silly wrt UABI in the long run:

union { unsigned long __pad0; unsigned long ss; };

I have half-written patches to do better, but I don't think they're
4.2 material.  I'm already vastly over my quota for late-arriving 4.2
things.

Stas: I think uc_flags is okay.  We don't currently read it during
sigreturn, but I see no reason that we can't start reading it.

--Andy
--
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/

[toc] | [prev] | [next] | [standalone]


Page 3 of 6 — ← Prev page 1 2 [3] 4 5 6  Next page →

Back to top | Article view | linux.kernel


csiph-web