public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [CHECKER] 4 warnings in kernel/module.c
@ 2001-03-23 10:41 Junfeng Yang
  2001-03-23 11:03 ` Alan Cox
  2001-03-23 11:05 ` Keith Owens
  0 siblings, 2 replies; 5+ messages in thread
From: Junfeng Yang @ 2001-03-23 10:41 UTC (permalink / raw)
  To: linux-kernel; +Cc: mc

Hi, we modified the block checker and run it again on linux 2.4.1. (The
block checker flags an error when blocking functions are called with
either interrupts disabled or a spin lock held. )

It gave us 4 warnings in kernel/module.c. Because we are unaware of the
contexts where these functions are called, we are not sure if these 4
warnings are real errors or false positives. Please help us to verify them
or show that they are false positives.

As usual, please CC us at mc@cs.stanford.edu. Any help will be
appreciated.

---------------------------------------------------------

[UNKNOWN] get_mod_name->__get_free_page(GFP_KERNEL). This is in the
KERNEL. Definitely need to verify

/u2/acc/oses/linux/2.4.1/kernel/module.c:290:sys_create_module:
ERROR:BLOCK:289:290:calling blocking fn 'get_mod_name' w/ spin lock held
[type=GLOBAL]:289

Start --->
	lock_kernel();

Error --->
	if ((namelen = get_mod_name(name_user, &name)) < 0) {
		error = namelen;
---------------------------------------------------------

[UNKNOWN] get_mod_name->__get_free_page(GFP_KERNEL) This is in the KERNEL.
Definitely need to verify

/u2/acc/oses/linux/2.4.1/kernel/module.c:599:sys_delete_module:
ERROR:BLOCK:597:599:calling blocking fn 'get_mod_name' w/ spin lock held
[type=GLOBAL]:597

Start --->
	lock_kernel();
	if (name_user) {
Error --->
		if ((error = get_mod_name(name_user, &name)) < 0)
			goto out;
---------------------------------------------------------

[UNKNOWN] need to verify. in the KERNEL!

/u2/acc/oses/linux/2.4.1/kernel/module.c:376:sys_init_module:
ERROR:BLOCK:342:376:calling blocking fn 'copy_from_user' w/ spin lock held
[type=LOCAL]:342

Start --->
	lock_kernel();
Error --->
	if ((namelen = get_mod_name(name_user, &name)) < 0) {
		error = namelen;
		goto err0;
	}

	... DELETED 26 lines ...

		goto err1;
	}
	strcpy(name_tmp, mod->name);

Error --->
	error = copy_from_user(mod, mod_user, mod_user_size);
	if (error) {
---------------------------------------------------------

[UNKNOWN] need to verify. in the KERNEL!

/u2/acc/oses/linux/2.4.1/kernel/module.c:888:sys_query_module:
ERROR:BLOCK:881:888:calling blocking fn 'get_mod_name' w/ spin lock held
[type=GLOBAL]:881

Start --->
	lock_kernel();
	if (name_user == NULL)
		mod = &kernel_module;
	else {
		long namelen;
		char *name;

Error --->
		if ((namelen = get_mod_name(name_user, &name)) < 0) {
			err = namelen;
---------------------------------------------------------

A few questions:

1. Is it OK to call blocking functions in the functions like
/init/main.c:init and init/main.c:start_kernel with a spin lock held? It
seems OK because the system is booting when these functions are called.

2. Can functions like kmem_cache_create, kmem_cache_alloc, alloc_page
block?







^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [CHECKER] 4 warnings in kernel/module.c
  2001-03-23 10:41 [CHECKER] 4 warnings in kernel/module.c Junfeng Yang
@ 2001-03-23 11:03 ` Alan Cox
  2001-03-23 19:49   ` Junfeng Yang
  2001-03-23 11:05 ` Keith Owens
  1 sibling, 1 reply; 5+ messages in thread
From: Alan Cox @ 2001-03-23 11:03 UTC (permalink / raw)
  To: Junfeng Yang; +Cc: linux-kernel, mc

> Hi, we modified the block checker and run it again on linux 2.4.1. (The
> block checker flags an error when blocking functions are called with
> either interrupts disabled or a spin lock held. )

lock_kernel() isnt a spinlock as such.

> 2. Can functions like kmem_cache_create, kmem_cache_alloc, alloc_page
> block?

They may block unless GFP_ATOMIC is specified in the arguments.

Alan


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [CHECKER] 4 warnings in kernel/module.c
  2001-03-23 10:41 [CHECKER] 4 warnings in kernel/module.c Junfeng Yang
  2001-03-23 11:03 ` Alan Cox
@ 2001-03-23 11:05 ` Keith Owens
  2001-03-23 19:56   ` Junfeng Yang
  1 sibling, 1 reply; 5+ messages in thread
From: Keith Owens @ 2001-03-23 11:05 UTC (permalink / raw)
  To: Junfeng Yang; +Cc: linux-kernel, mc

On Fri, 23 Mar 2001 02:41:40 -0800 (PST), 
Junfeng Yang <yjf@stanford.edu> wrote:
>Hi, we modified the block checker and run it again on linux 2.4.1. (The
>block checker flags an error when blocking functions are called with
>either interrupts disabled or a spin lock held. )
>
>It gave us 4 warnings in kernel/module.c. Because we are unaware of the
>contexts where these functions are called, we are not sure if these 4
>warnings are real errors or false positives. Please help us to verify them
>or show that they are false positives.

All false positives.  The big kernel lock is a special case, you are
allowed to sleep while holding that lock.  See release_kernel_lock()
and reacquire_kernel_lock() in sched().


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [CHECKER] 4 warnings in kernel/module.c
  2001-03-23 11:03 ` Alan Cox
@ 2001-03-23 19:49   ` Junfeng Yang
  0 siblings, 0 replies; 5+ messages in thread
From: Junfeng Yang @ 2001-03-23 19:49 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel, mc

On Fri, 23 Mar 2001, Alan Cox wrote:

> > Hi, we modified the block checker and run it again on linux 2.4.1. (The
> > block checker flags an error when blocking functions are called with
> > either interrupts disabled or a spin lock held. )
>
> lock_kernel() isnt a spinlock as such.

Thanks a lot. We just figured out that it is ok to block within
lock_kernel() unlock_kernel() scope. That will help us to eliminate
some false positives.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [CHECKER] 4 warnings in kernel/module.c
  2001-03-23 11:05 ` Keith Owens
@ 2001-03-23 19:56   ` Junfeng Yang
  0 siblings, 0 replies; 5+ messages in thread
From: Junfeng Yang @ 2001-03-23 19:56 UTC (permalink / raw)
  To: Keith Owens; +Cc: linux-kernel

On Fri, 23 Mar 2001, Keith Owens wrote:

> On Fri, 23 Mar 2001 02:41:40 -0800 (PST),
> Junfeng Yang <yjf@stanford.edu> wrote:
> >Hi, we modified the block checker and run it again on linux 2.4.1. (The
> >block checker flags an error when blocking functions are called with
> >either interrupts disabled or a spin lock held. )
> >
> >It gave us 4 warnings in kernel/module.c. Because we are unaware of the
> >contexts where these functions are called, we are not sure if these 4
> >warnings are real errors or false positives. Please help us to verify them
> >or show that they are false positives.
>
> All false positives.  The big kernel lock is a special case, you are
> allowed to sleep while holding that lock.  See release_kernel_lock()
> and reacquire_kernel_lock() in sched().

Thanks for pointing this out. We'll modify the checker again and remove
"lock_kernel" from the patterns.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-03-23 19:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-03-23 10:41 [CHECKER] 4 warnings in kernel/module.c Junfeng Yang
2001-03-23 11:03 ` Alan Cox
2001-03-23 19:49   ` Junfeng Yang
2001-03-23 11:05 ` Keith Owens
2001-03-23 19:56   ` Junfeng Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox