From: Fan Du <fan.du@windriver.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: <linux-crypto@vger.kernel.org>
Subject: Re: Why care about signal when instantiate an crypt template
Date: Thu, 17 Apr 2014 17:20:34 +0800 [thread overview]
Message-ID: <534F9CE2.1050509@windriver.com> (raw)
In-Reply-To: <20140417074449.GA24539@gondor.apana.org.au>
Hi Herbert
On 2014年04月17日 15:44, Herbert Xu wrote:
> Fan Du<fan.du@windriver.com> wrote:
>> Hi,
>>
>> I recently bump into a issue, ike daemon got interrupted(EINTR),
>> after looking at the code, it seems there are places in crypto code
>> where returning EINTR when current tasks has signal pending.
>>
>> For example:
>> crypto_alloc_base and crypto_alloc_tfm
>>
>> 435 err:
>> 436 if (err != -EAGAIN)
>> 437 break;
>> 438 if (signal_pending(current)) {
>> 439 err = -EINTR;
>> 440 break;
>> 441 }
>> 442 }
>>
>> I can't understand why the codes here needs to care about signals?
>
> Because otherwise you may end up with something that you can't
> kill from user-space. You should fix your app.
Ok, I'm starting to follow your meaning.
The signal checking is only to bail out from the infinite loop, it shouldn't
override original err code -EAGAIN with -EINTR.
With -EAGAIN, user space app can try again, what do you think?
@@ -550,12 +550,8 @@ void *crypto_alloc_tfm(const char *alg_name,
err = PTR_ERR(tfm);
err:
- if (err != -EAGAIN)
+ if ((err != -EAGAIN) || signal_pending(current))
break;
- if (signal_pending(current)) {
- err = -EINTR;
- break;
- }
}
--
浮沉随浪只记今朝笑
--fan
next prev parent reply other threads:[~2014-04-17 9:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-11 7:37 Why care about signal when instantiate an crypt template Fan Du
2014-04-17 7:44 ` Herbert Xu
2014-04-17 9:20 ` Fan Du [this message]
2014-04-17 9:52 ` Herbert Xu
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=534F9CE2.1050509@windriver.com \
--to=fan.du@windriver.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
/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.