From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756585AbYHGUb7 (ORCPT ); Thu, 7 Aug 2008 16:31:59 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754068AbYHGUbp (ORCPT ); Thu, 7 Aug 2008 16:31:45 -0400 Received: from gprs189-60.eurotel.cz ([160.218.189.60]:2190 "EHLO spitz.ucw.cz" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753681AbYHGUbo (ORCPT ); Thu, 7 Aug 2008 16:31:44 -0400 Date: Thu, 7 Aug 2008 22:31:30 +0200 From: Pavel Machek To: Vivek Goyal Cc: Huang Ying , "Eric W. Biederman" , nigel@nigel.suspend2.net, "Rafael J. Wysocki" , Andrew Morton , mingo@elte.hu, Linus Torvalds , linux-kernel@vger.kernel.org, Kexec Mailing List Subject: Re: [PATCH 2/6] kexec jump: check code size in control page Message-ID: <20080807203130.GA10331@ucw.cz> References: <1218099926.5164.33.camel@caritas-dev.intel.com> <20080807131557.GB27783@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080807131557.GB27783@redhat.com> User-Agent: Mutt/1.5.9i Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi! > > PAGE_SIZE/2. This patch adds runtime checking for this. > > > > Signed-off-by: Huang Ying ... > > { > > if (nx_enabled) > > set_pages_x(image->control_code_page, 1); > > + > > + BUG_ON((unsigned long)kexec_control_page_code_end - \ > > + (unsigned long)relocate_kernel >= PAGE_SIZE/2); > > + > > Run time check is better than nothing but I think in this case it would > be better if we can catch it at compile time. > > One of the methods will be to write a small program of your own and > put in script/ and at build time check for the size and flag error. May > be there are other better ways to do this. BUILD_BUG_ON()? -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html