Re: [PATCH v2] signal: Avoid undefined behaviour in kill_something_info

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon 05-06-17 20:53:27, zhongjiang wrote:
> diff --git a/kernel/signal.c b/kernel/signal.c
> index ca92bcf..63148f7 100644
> --- a/kernel/signal.c
> +++ b/kernel/signal.c
> @@ -1395,6 +1395,12 @@ static int kill_something_info(int sig, struct siginfo *info, pid_t pid)
>  
>  	read_lock(&tasklist_lock);
>  	if (pid != -1) {
> +		/*
> +	 	 * -INT_MIN is undefined, it need to exclude following case to 
> + 		 * avoid the UBSAN detection.
> +		 */
> +		if (pid == INT_MIN)
> +			return -ESRCH;

this will obviously keep the tasklist_lock held...

>  		ret = __kill_pgrp_info(sig, info,
>  				pid ? find_vpid(-pid) : task_pgrp(current));
>  	} else {
> -- 
> 1.7.12.4

-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]
  Powered by Linux