Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932742AbcJTXHw (ORCPT ); Thu, 20 Oct 2016 19:07:52 -0400 Received: from mail-vk0-f44.google.com ([209.85.213.44]:33205 "EHLO mail-vk0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932347AbcJTXHu (ORCPT ); Thu, 20 Oct 2016 19:07:50 -0400 MIME-Version: 1.0 In-Reply-To: <20160921154350.13128-1-roman.penyaev@profitbricks.com> References: <20160921154350.13128-1-roman.penyaev@profitbricks.com> From: Andy Lutomirski Date: Thu, 20 Oct 2016 16:07:28 -0700 Message-ID: Subject: Re: [PATCH 1/2] x86/dumpstack: on oops do not rewind stack for kthread To: Roman Pen Cc: Andy Lutomirski , Josh Poimboeuf , Borislav Petkov , Brian Gerst , Denys Vlasenko , "H . Peter Anvin" , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Tejun Heo , X86 ML , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 652 Lines: 15 On Wed, Sep 21, 2016 at 8:43 AM, Roman Pen wrote: > kthread uses stack and keeps completion structure on it to be woken up > on vfork_done completion. > > In commit 2deb4be28 Andy Lutomirski rewinds the stack unconditionally > and further completion of task->vfork_done for any kthread leads to stack > corruption (or infinite spin on attempt to spin lock on garbage memory). This is sort of okay, but it will blow up pretty badly if a kthread overflows its stack. Would it make more sense to change rewind_stack_do_exit() to leave a big enough gap at the top of the stack to avoid clobbering the completion? --Andy