From patchwork Sun Jul 29 15:27:17 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Hinds X-Patchwork-Id: 1252501 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 90B9DDF25A for ; Sun, 29 Jul 2012 15:31:05 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SvVPE-00008z-0e; Sun, 29 Jul 2012 15:27:44 +0000 Received: from mail-pb0-f49.google.com ([209.85.160.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1SvVOs-00008i-6t for linux-arm-kernel@lists.infradead.org; Sun, 29 Jul 2012 15:27:22 +0000 Received: by pbbrq13 with SMTP id rq13so9029893pbb.36 for ; Sun, 29 Jul 2012 08:27:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=39A2esbCcNHscQq55jyWfTENvz7KIiDkVf69+TzxmRo=; b=SsvGdXF5H/MsjFhfceCgrO7aJF/t4PsapLbhaxB9Jkdl7evW4nr3UGnGXiGq9ChHtp AxYI4lb/4YXxXPoYJagTbuMlPZ3UDA+ZYiTcyiTW8zETx8FQF30p83EUXw/TeMB3RVQk Q8CScx66TbWEc8GdOz44aE7v7G2mXTSUROshDbDIvKitceXM5znee2+We6B62SnYU55F CsFQtluJvVdznm8kkJ6QqTbnpqwJnZJglnYUtNDXsLFtIa3BZ+PKqpUE1FBQqB8pmvuh QKQ0fWTlgTfqN5/l1cpgTmJaziqmLOkTS/5Vx+DUzB4sT6ggo6fdFbr0+Oh3c6Cs23Cp kHoQ== Received: by 10.66.89.166 with SMTP id bp6mr18559920pab.48.1343575639404; Sun, 29 Jul 2012 08:27:19 -0700 (PDT) Received: from [192.168.44.3] (50-47-10-219.evrt.wa.frontiernet.net. [50.47.10.219]) by mx.google.com with ESMTPS id hf4sm6011997pbc.4.2012.07.29.08.27.18 (version=SSLv3 cipher=OTHER); Sun, 29 Jul 2012 08:27:18 -0700 (PDT) Message-ID: <50155655.9070002@gmail.com> Date: Sun, 29 Jul 2012 08:27:17 -0700 From: Mark Hinds User-Agent: Mozilla/5.0 (X11; Linux i686; rv:14.0) Gecko/20120715 Firefox/14.0.1 SeaMonkey/2.11 MIME-Version: 1.0 To: linux-arm-kernel@lists.infradead.org Subject: Problem: CONFIG_KALLSYMS is not set + kernel/module.c X-Spam-Note: CRM114 invocation failed X-Spam-Note: SpamAssassin invocation failed X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org In linux-3.2.xx I've been getting kernel dumps when I modprobe some modules with CONFIG_KALLSYMS diabled - nls_base.ko for example. I traced the problem to kernel/module.c, line 2607 or there about. Starting with: ptr = module_alloc_update_bounds(mod->init_size); If mod->init_size == 0 then foobar happens. I assume that there is no init section in some modules when CONFIG_KALLSYMS is disabled. Here is my fix: Index: kernel/module.c =================================================================== --- kernel/module.c (.../linux-3.2.24/kernel/module.c) (revision 9084) +++ kernel/module.c (.../linux-3.2.24-ces/kernel/module.c) (working copy) @@ -2604,20 +2604,24 @@ memset(ptr, 0, mod->core_size); mod->module_core = ptr; - ptr = module_alloc_update_bounds(mod->init_size); - /* - * The pointer to this block is stored in the module structure - * which is inside the block. This block doesn't need to be - * scanned as it contains data and code that will be freed - * after the module is initialized. - */ - kmemleak_ignore(ptr); - if (!ptr && mod->init_size) { - module_free(mod, mod->module_core); - return -ENOMEM; +#warning ### CES/zoro fix problem with mod->init_size == 0 + if (mod->init_size) { + ptr = module_alloc_update_bounds(mod->init_size); + /* + * The pointer to this block is stored in the module structure + * which is inside the block. This block doesn't need to be + * scanned as it contains data and code that will be freed + * after the module is initialized. + */ + kmemleak_ignore(ptr); + if (!ptr) { + module_free(mod, mod->module_core); + return -ENOMEM; + } + memset(ptr, 0, mod->init_size); + mod->module_init = ptr; } - memset(ptr, 0, mod->init_size); - mod->module_init = ptr; + else mod->module_init = NULL; /* Transfer each section which specifies SHF_ALLOC */ DEBUGP("final section addresses:\n");