public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Cort Dougan <cort@fsmlabs.com>
To: Andrea Arcangeli <andrea@suse.de>
Cc: Christoph Hellwig <hch@infradead.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] cheap lookup of symbol names on oops()
Date: Thu, 25 Jul 2002 14:27:16 -0600	[thread overview]
Message-ID: <20020725142716.N2276@host110.fsmlabs.com> (raw)
In-Reply-To: <20020725190445.GO1180@dualathlon.random>; from andrea@suse.de on Thu, Jul 25, 2002 at 09:04:45PM +0200

None of the changes look like a problem.  I'll absorb them and send another
patch.  One that fixes Ben's criticisms of spurious whitespace, even :)

Are you suggesting that it should print the start/end of the module in each
trace in addition to the symbol names or instead of them?

I've found it valuable to have the EIP resolved.  Even though the symbol
name may not be perfect (only resolves exported names) it is valuable to
see that the function crashed 0x1fe bytes after a given symbol name.

The version I use prints names for the stack trace but the formatting is
abysmal.  Making it clean and pretty on the screen would turn the "simple
and cheap" function into a parsing monster.  I'm happy to add it but it
wouldn't be the innocuous little patch it is now.

} It looks like it has a few issues, can you verify the below patch?
}
} I don't think it make sense to resolve the EIP unless it's a module,
} you'd liekly need the system.map/vmlinux anyways to get to the right
} function symbol name.
} 
} Furthmore it would be nice to print also for the stack trace, in case
} there are intra-modules, infact I guess I would prefer to keep trace of
} all the modules affected and to print the start address of each module
} affected instead of resolving to the nearest symbol, since as for the
} kernel .text, also the module .text isn't likely to be always exported.
} 
} In short I don't like very much your approch but for now the below will
} be ok, and it will work right most of the time (since from such symbol
} we'll be able to deduce the rest and it's likely all the modules
} addresses in the stack trace cames from the same module .o, but it's not
} guaranteed)
} 
} But as said above long term the right thing to do is to print the start
} address of each module affected in the trace (we just check for that
} during the oops to discard bogus values from the stack trace), not to
} try to resolve anything in the kernel. So I will reject the current
} patch as soon as the right way is implemented (then of course ksymoops
} will have to learn the right way too, instead of guessing from the
} current unreliable /proc/ksyms after reboot).
} 
} --- symb/kernel/module.c.~1~	Thu Jul 25 20:21:19 2002
} +++ symb/kernel/module.c	Thu Jul 25 20:48:20 2002
} @@ -246,10 +246,11 @@ void free_module(struct module *, int ta
}   * the need for user space tools.
}   *  -- Cort <cort@fsmlabs.com>
}   */
} +#define PRINT_ADDR_LENGTH 60
}  void module_print_addr(char *s1, unsigned long addr, char *s2)
}  {
}  	unsigned long best_match = 0; /* so far */
} -	char best_match_string[60] = {0, }; /* so far */
} +	char best_match_string[PRINT_ADDR_LENGTH];
}  	struct module *mod;
}  	struct module_symbol *sym;
}  	int j;
} @@ -265,24 +266,25 @@ void module_print_addr(char *s1, unsigne
}  		return;
}  	}
}  
} -	for (mod = module_list; mod; mod = mod->next)
} -	{
} +	for (mod = module_list; mod != &kernel_module; mod = mod->next) {
} +		if (!mod_bound(addr, 0, mod))
} +			continue;
}  		for ( j = 0, sym = mod->syms; j < mod->nsyms; ++j, ++sym)
}  		{
}  			/* is this a better match than what we've
}  			 * found so far? -- Cort */
} -			if ( (sym->value < addr) &&
} -			     ((addr - sym->value) < (addr - best_match)) )
} +			if (sym->value <= addr &&
} +			    addr - sym->value < addr - best_match)
}  			{
}  				best_match = sym->value;
}  				/* kernelmodule.name is "" so we
}  				 * have a special case -- Cort */
}  				if ( mod->name[0] == 0 )
} -					sprintf(best_match_string, "%s",
} -						sym->name);
} +					snprintf(best_match_string, PRINT_ADDR_LENGTH, "%s",
} +						 sym->name);
}  				else
} -					sprintf(best_match_string, "%s:%s",
} -						sym->name, mod->name);
} +					snprintf(best_match_string, PRINT_ADDR_LENGTH, "%s:%s",
} +						 sym->name, mod->name);
}  			}
}  		}
}  	}
} 
} 
} 
} Andrea
} -
} To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
} the body of a message to majordomo@vger.kernel.org
} More majordomo info at  http://vger.kernel.org/majordomo-info.html
} Please read the FAQ at  http://www.tux.org/lkml/

  reply	other threads:[~2002-07-25 20:30 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-25 17:00 [PATCH] cheap lookup of symbol names on oops() Cort Dougan
2002-07-25 17:11 ` Christoph Hellwig
2002-07-25 17:21   ` Cort Dougan
2002-07-25 18:49     ` Benjamin LaHaise
2002-07-25 20:16       ` Cort Dougan
2002-07-25 19:04     ` Andrea Arcangeli
2002-07-25 20:27       ` Cort Dougan [this message]
2002-07-25 20:59         ` Andrea Arcangeli
2002-07-25 21:05           ` Cort Dougan
2002-07-25 22:06             ` Andrea Arcangeli
2002-07-25 22:05               ` Cort Dougan
2002-07-25 22:56                 ` Andrea Arcangeli
2002-07-25 23:01                   ` Cort Dougan
2002-07-26 22:37                     ` module oops tracking [Re: [PATCH] cheap lookup of symbol names on oops()] Andrea Arcangeli
2002-07-26 22:55                       ` Cort Dougan
2002-07-26 23:28                         ` Andrea Arcangeli
2002-07-26 23:31                           ` Cort Dougan
2002-07-27  0:10                             ` Andrea Arcangeli
2002-07-27  2:15                               ` cort
2002-07-27  0:19                       ` Keith Owens
2002-07-27  0:31                         ` Andrea Arcangeli
2002-07-27  1:19                           ` Andrea Arcangeli
2002-07-27  1:33                             ` Keith Owens
2002-07-27  1:47                               ` Andrea Arcangeli
2002-07-25 21:12           ` [PATCH] cheap lookup of symbol names on oops() Lars Marowsky-Bree
2002-07-25 22:13             ` Andrea Arcangeli
2002-07-25 22:41           ` Rik van Riel
2002-07-25 23:01             ` Andrea Arcangeli
2002-07-26  7:57             ` Lars Marowsky-Bree
     [not found]           ` <Pine.LNX.4.44L.0207251941120.3086-100000@imladris.surriel. com>
2002-07-27  2:34             ` Stevie O
2002-07-25 22:39         ` Rik van Riel
2002-07-26  1:01   ` Marcin Dalecki
2002-07-25 22:46 ` Alan Cox
2002-07-25 21:44   ` Cort Dougan
2002-07-25 22:18     ` Russell King
2002-07-25 22:23       ` Cort Dougan
2002-07-25 22:44   ` Rik van Riel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020725142716.N2276@host110.fsmlabs.com \
    --to=cort@fsmlabs.com \
    --cc=andrea@suse.de \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox