From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933111AbcBAPJh (ORCPT ); Mon, 1 Feb 2016 10:09:37 -0500 Received: from mx2.parallels.com ([199.115.105.18]:45484 "EHLO mx2.parallels.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933300AbcBAPJf (ORCPT ); Mon, 1 Feb 2016 10:09:35 -0500 Subject: Re: CONFIG_UBSAN_ALIGNMENT breaks x86-64 kernel with lockdep enabled To: Mike Krinkin References: <20160130003645.GA30158@kmu-tp-x230> CC: , From: Andrey Ryabinin Message-ID: <56AF756E.9080102@virtuozzo.com> Date: Mon, 1 Feb 2016 18:10:38 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <20160130003645.GA30158@kmu-tp-x230> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: US-EXCH.sw.swsoft.com (10.255.249.47) To US-EXCH.sw.swsoft.com (10.255.249.47) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/30/2016 03:36 AM, Mike Krinkin wrote: > Hi, > > option CONFIG_UBSAN_ALIGNMENT breaks x86-64 kernel with lockdep enabled, > i. e kernel with CONFIG_UBSAN_ALIGNMENT fails to load without even any > error message. > > The problem is that ubsan callbacks use spinlocks and might be called > before lockdep is initialized. Particularly this line in the > reserve_ebda_region function causes problem: > > lowmem = *(unsigned short *)__va(BIOS_LOWMEM_KILOBYTES); > > If i put lockdep_init() before reserve_ebda_region call in > x86_64_start_reservations kernel loads well. Since CONFIG_UBSAN_ALIGNMENT > isn't useful for x86 anyway it might be better to disable this option for > x86 arch? > Alignment checks could be useful even on x86, because there are unaligned accesses in generic code. I think we can disable alignment instrumentation for arch/x86 directory only.