mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: aio_cancel segmentation fault for in progress write requests
Date: Fri, 7 Dec 2018 13:26:50 -0500	[thread overview]
Message-ID: <20181207182650.GF23599@brightrain.aerifal.cx> (raw)
In-Reply-To: <54b4d253-1660-3207-5d59-f23f1c25b2b9@adelielinux.org>

On Fri, Dec 07, 2018 at 11:31:01AM -0600, A. Wilcox wrote:
> awilcox on gwyn [pts/7 Fri 7 11:29] ~: ./aioWrite
> zsh: segmentation fault  ./aioWrite
> awilcox on gwyn [pts/7 Fri 7 11:29] ~: ./aioWrite
> zsh: segmentation fault  ./aioWrite
> awilcox on gwyn [pts/7 Fri 7 11:29] ~: ./aioWrite
> zsh: segmentation fault  ./aioWrite
> awilcox on gwyn [pts/7 Fri 7 11:29] ~: ./aioWrite
> zsh: segmentation fault  ./aioWrite
> awilcox on gwyn [pts/7 Fri 7 11:29] ~: ./aioWrite
> zsh: segmentation fault  ./aioWrite
> awilcox on gwyn [pts/7 Fri 7 11:29] ~: gdb aioWrite
> GNU gdb (GDB) 8.2
> Copyright (C) 2018 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later
> <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
> Type "show copying" and "show warranty" for details.
> This GDB was configured as "powerpc64-foxkit-linux-musl".
> Type "show configuration" for configuration details.
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>.
> Find the GDB manual and other documentation resources online at:
>     <http://www.gnu.org/software/gdb/documentation/>.
> 
> For help, type "help".
> Type "apropos word" to search for commands related to "word"...
> Reading symbols from aioWrite...done.
> (gdb) run
> Starting program: /home/awilcox/aioWrite
> [New LWP 60165]
> [LWP 60165 exited]
> aio_write/1-1.c cancelationStatus : 2
> Test PASSED
> [Inferior 1 (process 60162) exited normally]
> (gdb) quit
> 
> 
> Well, that's pretty interesting.
> 
> 
> awilcox on gwyn [pts/7 Fri 7 11:29] ~: uname -a
> Linux gwyn 4.14.76-mc11-easy-p8 #1 SMP Sat Nov 17 04:52:54 UTC 2018
> ppc64 GNU/Linux
> awilcox on gwyn [pts/7 Fri 7 11:30] ~: /lib/ld-musl-powerpc64.so.1
> musl libc (powerpc64)
> Version 1.1.20
> Dynamic Program Loader
> Usage: /lib/ld-musl-powerpc64.so.1 [options] [--] pathname [args]
> 
> 
> Maybe this is a bug that has been fixed on master?

I don't think so. I'm concerned that it's a stack overflow, and that
somehow the kernel folks have managed to break the MINSIGSTKSZ ABI.
AIO threads use a PTHREAD_STACK_MIN-sized stack with no guard page
(because they don't run any application code, just a tiny stub
function) but this could overflow in kernelspace (and either crash or
clobber memory depending on memory layout and presence/absence of
ASLR) if the kernel is making a signal frame that's too big. Note that
this would have to be nearly twice MINSIGSTKSZ (on x86 at least) due
to rounding up to whole pages, so if the kernel is misbehaving here
it's *badly* misbehaving...

Rich


  reply	other threads:[~2018-12-07 18:26 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-07 12:52 Arkadiusz Sienkiewicz
2018-12-07 15:44 ` Rich Felker
2018-12-07 16:04   ` Arkadiusz Sienkiewicz
2018-12-07 16:52     ` Orivej Desh
2018-12-07 16:52     ` Rich Felker
2018-12-07 17:31       ` A. Wilcox
2018-12-07 18:26         ` Rich Felker [this message]
2018-12-07 19:05           ` A. Wilcox
2018-12-07 20:07             ` Rich Felker
2018-12-07 19:13           ` A. Wilcox
2018-12-07 20:21             ` Rich Felker
2018-12-07 20:35             ` Markus Wichmann
2018-12-07 21:12               ` Rich Felker
2018-12-07 22:51               ` A. Wilcox
2018-12-07 23:50                 ` Rich Felker
2018-12-07 20:06           ` Florian Weimer
2018-12-07 20:14             ` Rich Felker
2018-12-08 16:18               ` Florian Weimer
2018-12-10  9:05                 ` Arkadiusz Sienkiewicz
2018-12-12  0:36                   ` Rich Felker
2018-12-17 14:21                     ` Arkadiusz Sienkiewicz
2018-12-17 17:29                       ` Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181207182650.GF23599@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).