From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932717AbcETOHL (ORCPT ); Fri, 20 May 2016 10:07:11 -0400 Received: from smtp.nsa.gov ([8.44.101.8]:10876 "EHLO emsm-gh1-uea10.nsa.gov" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752075AbcETOHJ (ORCPT ); Fri, 20 May 2016 10:07:09 -0400 X-Greylist: delayed 699 seconds by postgrey-1.27 at vger.kernel.org; Fri, 20 May 2016 10:07:08 EDT X-IronPort-AV: E=Sophos;i="5.26,339,1459814400"; d="scan'208";a="13893649" IronPort-PHdr: =?us-ascii?q?9a23=3ALWJD/xbMgfXgdGgB+8mjzqn/LSx+4OfEezUN459i?= =?us-ascii?q?sYplN5qZpM68bnLW6fgltlLVR4KTs6sC0LqH9fu8EjJaqb+681k8M7V0Hycfjs?= =?us-ascii?q?sXmwFySOWkMmbcaMDQUiohAc5ZX0Vk9XzoeWJcGcL5ekGA6ibqtW1aJBzzOEJP?= =?us-ascii?q?K/jvHcaK1oLsh7H0oMGYPV8ArQH+SI0xBS3+lR/WuMgSjNkqAYcK4TyNnEF1ff?= =?us-ascii?q?9Lz3hjP1OZkkW0zM6x+Jl+73YY4Kp5pIZoGJ/3dKUgTLFeEC9ucyVsvJWq5iTZ?= =?us-ascii?q?SUOzwldUEiBMylsbSzTCuVvAV5n4vy+ylKw15ziBOsb1TPp8DS6r4a5mTDfrhT?= =?us-ascii?q?0BOjp/93vY3Ig4raRUp1qEoBh5ypScNISUMvV5VqDQZ9UXQSxGRMkHBAJbBYbp?= =?us-ascii?q?VJcCF+oMO65jqoD5o1Yf5U+lCRKEGPLkyjgOgGT/m6I9zbJyQkn9wAU8EodW4z?= =?us-ascii?q?zvp9LvOfJXCLrtwQ=3D=3D?= X-IPAS-Result: =?us-ascii?q?A2HsAgABFz9X/wHyM5BeGQEBAQGDGoEBUqVTAQEBAQEBBpI?= =?us-ascii?q?bhBKGBwoCgTZMAQEBAQEBAgJiJ4ItghYBAQQjVhALDQsCAiYCAlcGAQwGAgEBi?= =?us-ascii?q?CuySJFcAQEBAQEBAQMBAQEBAQEhgQGEXII+gleBSoMhglWCWQWYNI4giViFRI9?= =?us-ascii?q?LYoIGHIFnIDKIAwEBAQ?= Subject: Re: PROBLEM: Resume form hibernate broken by setting NX on gap To: "Rafael J. Wysocki" , Ingo Molnar References: <573DF82D.50006@deltatee.com> <20160520071517.GB14191@gmail.com> Cc: Logan Gunthorpe , Kees Cook , Ingo Molnar , the arch/x86 maintainers , "linux-pm@vger.kernel.org" , Linux Kernel Mailing List , Andy Lutomirski , Borislav Petkov , Denys Vlasenko , Brian Gerst From: Stephen Smalley Organization: National Security Agency Message-ID: <7b865a03-484f-2d10-aa3e-d9c0d04caecb@tycho.nsa.gov> Date: Fri, 20 May 2016 09:56:53 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/20/2016 07:34 AM, Rafael J. Wysocki wrote: > On Fri, May 20, 2016 at 9:15 AM, Ingo Molnar wrote: >> >> * Logan Gunthorpe wrote: >> >>> Hi, >>> >>> I have been working on a bug that causes my laptop to freeze during >>> resume from hibernation. I did a bisect to find the offending commit: >>> >>> [ab76f7b4ab] x86/mm: Set NX on gap between __ex_table and rodata >>> >>> There is more information in the bugzilla report [1] that >>> I've been working on but I will summarize things below. >>> >>> I've experienced intermittent but reproducible freezes when resuming >>> from hibernation since about kernel version 3.19. The freeze was >>> significantly more reproducible when a few applications were loaded >>> before hibernation and would largely not happen if hibernated >>> immediately after booting to a desktop. I did some tracing work to find >>> that the kernel gets as far as the resume_image call in >>> swsusp_arch_resume and I could not find any response from the image >>> kernel when I hit the bug. I also did testing that seemed to rule out >>> this being caused by a problematic driver. >>> >>> I did a successful bisect between 3.18 and 3.19 which found a bug in >>> commit f5b2831d6 that was then later fixed by commit 55696b1f66 in 4.4. >>> Then, I did a second bisect with a ported version of the fix to the >>> first bug and found commit ab76f7b4ab in 4.3 to also break hibernation >>> with what appears to be the exact same symptoms. Reverting that commit >>> in recent kernels up to and including 4.6 fixes the issue and restores >>> reliable hibernation. However, it's not at all clear to me why that >>> commit would cause this issue or how to fix the issue without reverting. >> >> I've attached that commit below and also Cc:-ed a few more people who might have >> an idea about why this regressed. Worst-case we'll have to revert it. > > Without looking deep into mm, my theory would be that after this patch > the final jump from the boot kernel to the image kernel's trampoline > code during resume may crash the kernel if the trampoline page turns > out to be NX in the boot kernel (it has to be executable in both the > boot and the image kernels). So, pardon my ignorance, but where is this trampoline page placed in kernel memory?