From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755902AbdCGSxR (ORCPT ); Tue, 7 Mar 2017 13:53:17 -0500 Received: from mail-ua0-f169.google.com ([209.85.217.169]:35386 "EHLO mail-ua0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755631AbdCGSxP (ORCPT ); Tue, 7 Mar 2017 13:53:15 -0500 MIME-Version: 1.0 In-Reply-To: References: <20170221231216.y56gb62vkn5ewgea@treble> <20170222210548.GC8467@amd> <20170222212103.tigzbw5sfrwd7uwh@treble> <20170222224755.GA4310@amd> <20170222225614.4z4z24uz6l2iz6qm@treble> <20170222231808.hmr6ulbvfnrg2at7@treble> <20170223201039.GB5177@amd> <20170225050439.7dplheb6nyne4nkm@treble> <20170302234514.3qcqdozibcltkdai@treble> <20170306163807.GA20689@amd> <20170307173821.yknj5htr7plgdwxv@treble> From: Andy Lutomirski Date: Tue, 7 Mar 2017 09:59:44 -0800 Message-ID: Subject: Re: v4.10: kernel stack frame pointer .. has bad value (null) To: Linus Torvalds Cc: Josh Poimboeuf , Pavel Machek , kernel list , Ingo Molnar , Andrew Lutomirski , Borislav Petkov , Brian Gerst , Denys Vlasenko , Peter Anvin , Peter Zijlstra , Thomas Gleixner Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 7, 2017 at 9:52 AM, Linus Torvalds wrote: > On Tue, Mar 7, 2017 at 9:38 AM, Josh Poimboeuf wrote: >> >> So I'm thinking we should have -maccumulate-outgoing-args always enabled >> on x86_32 just like we already do on x86_64. > > Ugh. I realize we have workarounds for bugs, but I think > -maccumulate-outgoing-args is nasty. It just generates worse code by > avoiding the much nicer push/pop sequences, afaik. > > On x86-64 it's not such a big deal, because we pass the first six > arguments in registers anyway, so the arguments on the stack is a > fairly unusual special case. > > But on x86-32, we only have three argument registers, so this > braindamage is potentially worse. > > I guess we already do this in most situations due to the gcc bugs, but > I do think it's sad that we would do it for our _own_ bugs too. > Is it our bug or a gcc bug? I would have thought -fno-omit-frame-pointer meant that the call-frame-to-return-address offset should be constant and -fomit-frame-pointer meant "do whatever". Also, maybe I'm missing something, but does gcc's code even allow the function to return sensibly? It could do it by a nasty calculation involving backing out the old esp from edi, but that seems quite overcomplicated. --Andy