From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752225AbcHLGBg (ORCPT ); Fri, 12 Aug 2016 02:01:36 -0400 Received: from mx2.suse.de ([195.135.220.15]:49696 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750922AbcHLGBe (ORCPT ); Fri, 12 Aug 2016 02:01:34 -0400 Date: Fri, 12 Aug 2016 08:01:31 +0200 (CEST) From: Jiri Kosina X-X-Sender: jkosina@pobox.suse.cz To: Thomas Garnier cc: "Rafael J . Wysocki" , Len Brown , Pavel Machek , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, keescook@chromium.org, kernel-hardening@lists.openwall.com, bpetkov@suse.de, yinghai@kernel.org Subject: Re: [PATCH v1] x86/power/64: Restore processor state before using per-cpu variables In-Reply-To: <1470952169-39061-1-git-send-email-thgarnie@google.com> Message-ID: References: <1470952169-39061-1-git-send-email-thgarnie@google.com> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 11 Aug 2016, Thomas Garnier wrote: > Restore the processor state before calling any other function to ensure > per-cpu variables can be used with KASLR memory randomization. > > Tracing functions use per-cpu variables (gs based) and one was called > just before restoring the processor state fully. It resulted in a double > fault when both the tracing & the exception handler functions tried to > use a per-cpu variable. > > Signed-off-by: Thomas Garnier Alright, this did the trick, thanks :) Feel free to add Reported-by: Jiri Kosina Tested-by: Jiri Kosina One thing is still beyond me though ... how the heck this doesn't happen without DEBUG_LOCK_ALLOC? The percpu area pointer should be corrupted nevertheless, shouldn't it? Thanks, -- Jiri Kosina SUSE Labs From mboxrd@z Thu Jan 1 00:00:00 1970 Reply-To: kernel-hardening@lists.openwall.com Date: Fri, 12 Aug 2016 08:01:31 +0200 (CEST) From: Jiri Kosina In-Reply-To: <1470952169-39061-1-git-send-email-thgarnie@google.com> Message-ID: References: <1470952169-39061-1-git-send-email-thgarnie@google.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: [kernel-hardening] Re: [PATCH v1] x86/power/64: Restore processor state before using per-cpu variables To: Thomas Garnier Cc: "Rafael J . Wysocki" , Len Brown , Pavel Machek , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, keescook@chromium.org, kernel-hardening@lists.openwall.com, bpetkov@suse.de, yinghai@kernel.org List-ID: On Thu, 11 Aug 2016, Thomas Garnier wrote: > Restore the processor state before calling any other function to ensure > per-cpu variables can be used with KASLR memory randomization. > > Tracing functions use per-cpu variables (gs based) and one was called > just before restoring the processor state fully. It resulted in a double > fault when both the tracing & the exception handler functions tried to > use a per-cpu variable. > > Signed-off-by: Thomas Garnier Alright, this did the trick, thanks :) Feel free to add Reported-by: Jiri Kosina Tested-by: Jiri Kosina One thing is still beyond me though ... how the heck this doesn't happen without DEBUG_LOCK_ALLOC? The percpu area pointer should be corrupted nevertheless, shouldn't it? Thanks, -- Jiri Kosina SUSE Labs