lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 12 Apr 2010 22:32:11 +0200 (CEST)
From:	Thomas Gleixner <tglx@...utronix.de>
To:	Stefan Agner <stefan@...er.ch>
cc:	linux-rt-users@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: I attached a test module to reproduce this bug. Does I miss
 something in my code or is there a bug?

Stefan,

please use short and descriptive subject lines. "I attached a test
module to reproduce this bug ..." does not tell anything.

On Mon, 12 Apr 2010, Stefan Agner wrote:

> Unable to handle kernel paging request at kthread_should_stop

That would have been the real subject line :)
 
> I attached a test module to reproduce this bug.  Does I miss something in my
> code or is there a bug?

There are several bugs in your code :)

> static int runloop(void *unused)
> {
> 
> 	int ret;
> 
> 	/* Daemonize */
> 	daemonize(MODULE_NAME);

 Do not call daemonize() for a kthread created with kthread_create().
 That was necessary for kthreads created with kernel_thread.

> 	/* Allow SIGTERM signal */
> 	allow_signal(SIGTERM);

 Why do you want signals here ?

> 	/* Calculate first shot */
> 	now = ktime_get();
> 	thread_next = ktime_add_us(now, 500);
> 
> 	do {
> 		set_current_state(TASK_UNINTERRUPTIBLE);
> 		ret = schedule_hrtimeout(&thread_next, HRTIMER_MODE_ABS);
> 		if(ret == -EINTR)
> 		{

  That EINTR can never happen. You set the task to
  TASK_UNINTERRUPTIBLE state, so it cannot be woken up by a signal.
	
> int __init init_test_module(void)
> {
> 	struct sched_param param = { .sched_priority = THREAD_PRIORITY };
> 
> 	/* Kernel Thread erzeugen */
> 	if(thread == NULL)
> 		thread = kthread_create((void *)&runloop, NULL, "testthread");

 The init code is called once, so no need to check for thread == NULL
 before calling kthread_create().

 But you miss to check thread _after_ the call ....

> 	// Realtime scheduler
> 	sched_setscheduler(thread, THREAD_SCHEDULER, &param);

 Scheduler settings should happen in the thread.

> 	wake_up_process(thread);

 Simply use kthread_run(....), which implies kthread_create() and
 wake_up_process().

Thanks,

	tglx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ