Re: [PATCH] fix kernel crash on NULL processor dereference

Samuel Thibault <[email protected]>
Newsgroups gmane.os.hurd.bugs
Organization I am not organized
Message-ID <ahTIRn2L_Ch2q3dd@end>
Applied, thanks!

gfleury, le lun. 11 mai 2026 13:45:09 +0100, a ecrit:
> This fix a kernel crash building hurd under smp
> ---
>  kern/sched_prim.c | 4 ++--
>  kern/thread.c     | 3 ++-
>  2 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/kern/sched_prim.c b/kern/sched_prim.c
> index 605f7001..c1b809be 100644
> --- a/kern/sched_prim.c
> +++ b/kern/sched_prim.c
> @@ -1272,7 +1272,7 @@ void thread_setrun(
>  	     *	But first check the last processor it ran on.
>  	     */
>  	    processor = th->last_processor;
> -	    if (processor->state == PROCESSOR_IDLE) {
> +	    if (processor != PROCESSOR_NULL && processor->state == PROCESSOR_IDLE) {
>  		    processor_lock(processor);
>  		    pset_idle_lock();
>  		    if ((processor->state == PROCESSOR_IDLE)
> @@ -1334,7 +1334,7 @@ void thread_setrun(
>  	     *	Bound, can only run on bound processor.  Have to lock
>  	     *  processor here because it may not be the current one.
>  	     */
> -	    if (processor->state == PROCESSOR_IDLE) {
> +	    if (processor != PROCESSOR_NULL && processor->state == PROCESSOR_IDLE) {
>  		processor_lock(processor);
>  		pset = processor->processor_set;
>  		pset_idle_lock();
> diff --git a/kern/thread.c b/kern/thread.c
> index deb9688d..fa6bab72 100644
> --- a/kern/thread.c
> +++ b/kern/thread.c
> @@ -1292,7 +1292,8 @@ thread_dowait(
>  		     *	should cause the thread to take an ast and
>  		     *	context switch to suspend for us.
>  		     */
> -		    cause_ast_check(thread->last_processor);
> +		    if (thread->last_processor != PROCESSOR_NULL)
> +		       cause_ast_check(thread->last_processor);
>  #endif	/* NCPUS > 1 */
>  
>  		    /*
> -- 
> 2.53.0
> 
> 

-- 
Samuel
c> [ ] morning [ ] afternoon [ ] evening [ ] night , everyone (choose as applicable)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.