From: Oleg Nesterov <oleg@redhat.com>
To: zhongjiang <zhongjiang@huawei.com>
Cc: akpm@linux-foundation.org, stsp@list.ru, Waiman.Long@hpe.com,
mingo@kernel.org, mhocko@kernel.org, vbabka@suse.cz,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
qiuxishi@huawei.com
Subject: Re: [PATCH] signal: Avoid undefined behaviour in kill_something_info
Date: Mon, 5 Jun 2017 14:37:45 +0200 [thread overview]
Message-ID: <20170605123744.GA9807@redhat.com> (raw)
In-Reply-To: <1496653897-53093-1-git-send-email-zhongjiang@huawei.com>
On 06/05, zhongjiang wrote:
>
> static int kill_something_info(int sig, struct siginfo *info, pid_t pid)
> {
> - int ret;
> + int ret, vpid;
>
> if (pid > 0) {
> rcu_read_lock();
> @@ -1395,8 +1395,12 @@ static int kill_something_info(int sig, struct siginfo *info, pid_t pid)
>
> read_lock(&tasklist_lock);
> if (pid != -1) {
> + if (pid == INT_MIN)
> + vpid = INT_MAX;
Well, this probably needs a comment to explain that this is just "avoid ub".
And if we really want the fix, to me
if (pid == INT_MIN)
return -ESRCH;
at the start makes more sense...
Oleg.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: Oleg Nesterov <oleg@redhat.com>
To: zhongjiang <zhongjiang@huawei.com>
Cc: akpm@linux-foundation.org, stsp@list.ru, Waiman.Long@hpe.com,
mingo@kernel.org, mhocko@kernel.org, vbabka@suse.cz,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
qiuxishi@huawei.com
Subject: Re: [PATCH] signal: Avoid undefined behaviour in kill_something_info
Date: Mon, 5 Jun 2017 14:37:45 +0200 [thread overview]
Message-ID: <20170605123744.GA9807@redhat.com> (raw)
In-Reply-To: <1496653897-53093-1-git-send-email-zhongjiang@huawei.com>
On 06/05, zhongjiang wrote:
>
> static int kill_something_info(int sig, struct siginfo *info, pid_t pid)
> {
> - int ret;
> + int ret, vpid;
>
> if (pid > 0) {
> rcu_read_lock();
> @@ -1395,8 +1395,12 @@ static int kill_something_info(int sig, struct siginfo *info, pid_t pid)
>
> read_lock(&tasklist_lock);
> if (pid != -1) {
> + if (pid == INT_MIN)
> + vpid = INT_MAX;
Well, this probably needs a comment to explain that this is just "avoid ub".
And if we really want the fix, to me
if (pid == INT_MIN)
return -ESRCH;
at the start makes more sense...
Oleg.
next prev parent reply other threads:[~2017-06-05 12:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-05 9:11 [PATCH] signal: Avoid undefined behaviour in kill_something_info zhongjiang
2017-06-05 9:11 ` zhongjiang
2017-06-05 12:37 ` Oleg Nesterov [this message]
2017-06-05 12:37 ` Oleg Nesterov
2017-06-05 12:47 ` zhong jiang
2017-06-05 12:47 ` zhong jiang
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=20170605123744.GA9807@redhat.com \
--to=oleg@redhat.com \
--cc=Waiman.Long@hpe.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=mingo@kernel.org \
--cc=qiuxishi@huawei.com \
--cc=stsp@list.ru \
--cc=vbabka@suse.cz \
--cc=zhongjiang@huawei.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.