lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 3 May 2021 13:17:02 +0200
From:   Borislav Petkov <bp@...en8.de>
To:     Florian Weimer <fweimer@...hat.com>
Cc:     "Bae, Chang Seok" <chang.seok.bae@...el.com>,
        Andy Lutomirski <luto@...nel.org>,
        "Cooper, Andrew" <andrew.cooper3@...rix.com>,
        Boris Ostrovsky <boris.ostrovsky@...cle.com>,
        "Gross, Jurgen" <jgross@...e.com>,
        Stefano Stabellini <sstabellini@...nel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...nel.org>, X86 ML <x86@...nel.org>,
        "Brown, Len" <len.brown@...el.com>,
        "Hansen, Dave" <dave.hansen@...el.com>,
        "H. J. Lu" <hjl.tools@...il.com>,
        Dave Martin <Dave.Martin@....com>,
        Jann Horn <jannh@...gle.com>,
        Michael Ellerman <mpe@...erman.id.au>,
        Carlos O'Donell <carlos@...hat.com>,
        "Luck, Tony" <tony.luck@...el.com>,
        "Shankar, Ravi V" <ravi.v.shankar@...el.com>,
        libc-alpha <libc-alpha@...rceware.org>,
        linux-arch <linux-arch@...r.kernel.org>,
        Linux API <linux-api@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v7 5/6] x86/signal: Detect and prevent an alternate
 signal stack overflow

On Mon, May 03, 2021 at 07:30:21AM +0200, Florian Weimer wrote:
> Just to be clear, I'm worried about the case where an application
> installs a stack overflow handler, but stack overflow does not regularly
> happen at run time.  GNU m4 is an example.  Today, for most m4 scripts,
> it's totally fine to have an alternative signal stack which is too
> small.  If the kernel returned an error for the sigaltstack call, m4
> wouldn't start anymore, independently of the script.  Which is worse
> than memory corruption with some scripts, I think.

Oh lovely.

> 
> > Or is this use case obsolete and this is not what people do at all?
> 
> It's widely used in currently-maintained software.  It's the only way to
> recover from stack overflows without boundary checks on every function
> call.
> 
> Does the alternative signal stack actually have to contain the siginfo_t
> data?  I don't think it has to be contiguous.  Maybe the kernel could
> allocate and map something behind the processes back if the sigaltstack
> region is too small?

So there's an attempt floating around to address this:

https://lkml.kernel.org/r/20210422044856.27250-1-chang.seok.bae@intel.com

esp patch 3.

I'd appreciate having a look and sanity-checking this whether it makes
sense and could be useful this way...

> And for the stack overflow handler, the kernel could treat SIGSEGV with
> a sigaltstack region that is too small like the SIG_DFL handler.  This
> would make m4 work again.

/me searches a bit about SIG_DFL...

Do you mean that the default action in this case should be what SIGSEGV
does by default - to dump core?

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ