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


Groups > linux.kernel > #1265707

Re: [PATCH v2 00/20] Fix handling of compat_siginfo_t

From Oleg Nesterov <oleg@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 00/20] Fix handling of compat_siginfo_t
Date 2015-11-09 15:20 +0100
Message-ID <qsVsD-7v9-27@gated-at.bofh.it> (permalink)
References <qrh4d-7PW-3@gated-at.bofh.it> <qsqoN-438-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 11/07, Andy Lutomirski wrote:
>
> On Wed, Nov 4, 2015 at 4:50 PM, Amanieu d'Antras <amanieu@gmail.com> wrote:
> > One issue that isn't resolved in this series is sending signals between a 32-bit
> > process and 64-bit process. Sending a si_int will work correctly, but a si_ptr
> > value will likely get corrupted due to the different layouts of the 32-bit and
> > 64-bit siginfo_t structures.
>
> This is so screwed up it's not even funny.

Agreed,

> A 64-bit big-endian compat calls rt_sigqueueinfo.  It passes in (among
> other things) a sigval_t.  The kernel can choose to interpret it

I always thought that the kernel should not interpret it at all. And indeed,
copy_siginfo_to_user() does

	if (from->si_code < 0)
		return __copy_to_user(to, from, sizeof(siginfo_t))

probably copy_siginfo_to_user32() should do something similar, at least
it should not truncate ->si_code it it is less than zero.

Not sure what signalfd_copyinfo() should do.

But perhaps I was wrong, I failed to find man sigqueueinfo, and man
sigqueue() documents that it passes sigval_t.


> BTW, x86 has its own set of screwups here.  Somehow cr2 and error_code
> ended up as part of ucontext instead of siginfo, which makes
> absolutely no sense to me and bloats task_struct.

Yes, and probably ->ip should have been the part of siginfo too. Say,
if you get SIGBUS you can't trust sc->ip if another signal was dequeued
before SIGBUS, in this case sc->ip will point to the handler of that
another signal. That is why we have SYNCHRONOUS_MASK and it helps, but
still this doesn't look nice.

Oleg.

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

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH v2 00/20] Fix handling of compat_siginfo_t Amanieu d'Antras <amanieu@gmail.com> - 2015-11-05 02:00 +0100
  [PATCH v2 14/20] powerpc: Use generic copy_siginfo_{to,from}_user32 Amanieu d'Antras <amanieu@gmail.com> - 2015-11-05 02:00 +0100
  [PATCH v2 04/20] x86: Rewrite copy_siginfo_{to,from}_user32 Amanieu d'Antras <amanieu@gmail.com> - 2015-11-05 02:00 +0100
    Re: [PATCH v2 04/20] x86: Rewrite copy_siginfo_{to,from}_user32 "H. Peter Anvin" <hpa@zytor.com> - 2015-11-05 03:40 +0100
  [PATCH v2 05/20] mips: Clean up compat_siginfo_t Amanieu d'Antras <amanieu@gmail.com> - 2015-11-05 02:00 +0100
  [PATCH v2 06/20] mips: Use generic copy_siginfo_{to,from}_user32 Amanieu d'Antras <amanieu@gmail.com> - 2015-11-05 02:00 +0100
  [PATCH v2 19/20] signalfd: Fix some issues in signalfd_copyinfo Amanieu d'Antras <amanieu@gmail.com> - 2015-11-05 02:00 +0100
  [PATCH v2 11/20] s390: Use generic compat_siginfo_t Amanieu d'Antras <amanieu@gmail.com> - 2015-11-05 02:00 +0100
  [PATCH v2 10/20] parsic: Use generic copy_siginfo_{to,from}_user32 Amanieu d'Antras <amanieu@gmail.com> - 2015-11-05 02:00 +0100
  [PATCH v2 17/20] sparc: Use generic compat_siginfo_t Amanieu d'Antras <amanieu@gmail.com> - 2015-11-05 02:00 +0100
  [PATCH v2 18/20] sparc: Use generic copy_siginfo_{to,from}_user32 Amanieu d'Antras <amanieu@gmail.com> - 2015-11-05 02:00 +0100
  [PATCH v2 03/20] x86: Update compat_siginfo_t to be closer to the generic version Amanieu d'Antras <amanieu@gmail.com> - 2015-11-05 02:00 +0100
  [PATCH v2 20/20] signal: Remove unnecessary zero-initialization of siginfo_t Amanieu d'Antras <amanieu@gmail.com> - 2015-11-05 02:00 +0100
  [PATCH v2 02/20] compat: Add generic copy_siginfo_{to,from}_user32 Amanieu d'Antras <amanieu@gmail.com> - 2015-11-05 02:00 +0100
  [PATCH v2 16/20] tile: Use generic copy_siginfo_{to,from}_user32 Amanieu d'Antras <amanieu@gmail.com> - 2015-11-05 02:00 +0100
  [PATCH v2 07/20] arm64: Use generic compat_siginfo_t Amanieu d'Antras <amanieu@gmail.com> - 2015-11-05 02:00 +0100
  [PATCH v2 01/20] compat: Add generic compat_siginfo_t Amanieu d'Antras <amanieu@gmail.com> - 2015-11-05 02:00 +0100
  Re: [PATCH v2 00/20] Fix handling of compat_siginfo_t Andy Lutomirski <luto@amacapital.net> - 2015-11-08 06:10 +0100
    Re: [PATCH v2 00/20] Fix handling of compat_siginfo_t Oleg Nesterov <oleg@redhat.com> - 2015-11-09 15:20 +0100

csiph-web