Re: [PATCH V2] Fix a sleep-in-atomic bug in shash_setkey_unaligned

2017-10-05 Thread Marcelo Ricardo Leitner
On Thu, Oct 05, 2017 at 09:16:31PM +0800, Herbert Xu wrote: > On Thu, Oct 05, 2017 at 06:16:20PM +0800, Herbert Xu wrote: > > > > That was my point. Functions like sctp_pack_cookie shouldn't be > > setting the key in the first place. The setkey should happen at > > the point when the key is gener

Re: [PATCH V2] Fix a sleep-in-atomic bug in shash_setkey_unaligned

2017-10-05 Thread Herbert Xu
On Thu, Oct 05, 2017 at 06:16:20PM +0800, Herbert Xu wrote: > > That was my point. Functions like sctp_pack_cookie shouldn't be > setting the key in the first place. The setkey should happen at > the point when the key is generated. That's sctp_endpoint_init > which AFAICS only gets called in GF

Re: [PATCH V2] Fix a sleep-in-atomic bug in shash_setkey_unaligned

2017-10-05 Thread Herbert Xu
On Wed, Oct 04, 2017 at 09:37:58PM -0700, David Miller wrote: > > > I'm not talking about the code-path in question. I'm talking > > about the function which generates the secret key in the first > > place. AFAICS that's only called in GFP_KERNEL context. What > > am I missing? > > The setkey h

Re: [PATCH V2] Fix a sleep-in-atomic bug in shash_setkey_unaligned

2017-10-04 Thread David Miller
From: Herbert Xu Date: Thu, 5 Oct 2017 11:40:54 +0800 > On Tue, Oct 03, 2017 at 07:45:06PM -0300, Marcelo Ricardo Leitner wrote: >> >> > Usually if you're invoking setkey from a non-sleeping code-path >> > you're probably doing something wrong. >> >> Usually but not always. There are 3 calls to

Re: [PATCH V2] Fix a sleep-in-atomic bug in shash_setkey_unaligned

2017-10-04 Thread Herbert Xu
On Tue, Oct 03, 2017 at 07:45:06PM -0300, Marcelo Ricardo Leitner wrote: > > > Usually if you're invoking setkey from a non-sleeping code-path > > you're probably doing something wrong. > > Usually but not always. There are 3 calls to that function on SCTP > code: > - pack a cookie, which is sent

Re: [PATCH V2] Fix a sleep-in-atomic bug in shash_setkey_unaligned

2017-10-03 Thread Marcelo Ricardo Leitner
On Tue, Oct 03, 2017 at 07:33:08PM -0300, Marcelo Ricardo Leitner wrote: > On Tue, Oct 03, 2017 at 10:25:22AM +0800, Jia-Ju Bai wrote: > > The SCTP program may sleep under a spinlock, and the function call path is: > > sctp_generate_t3_rtx_event (acquire the spinlock) > > sctp_do_sm > > sctp_

Re: [PATCH V2] Fix a sleep-in-atomic bug in shash_setkey_unaligned

2017-10-03 Thread Marcelo Ricardo Leitner
On Tue, Oct 03, 2017 at 01:26:43PM +0800, Herbert Xu wrote: > On Mon, Oct 02, 2017 at 09:18:24PM -0700, Andy Lutomirski wrote: > > > On Oct 2, 2017, at 7:25 PM, Jia-Ju Bai wrote: > > > > > > The SCTP program may sleep under a spinlock, and the function call path > > > is: > > > sctp_generate_t3_r

Re: [PATCH V2] Fix a sleep-in-atomic bug in shash_setkey_unaligned

2017-10-03 Thread Marcelo Ricardo Leitner
On Tue, Oct 03, 2017 at 10:25:22AM +0800, Jia-Ju Bai wrote: > The SCTP program may sleep under a spinlock, and the function call path is: > sctp_generate_t3_rtx_event (acquire the spinlock) > sctp_do_sm > sctp_side_effects > sctp_cmd_interpreter > sctp_make_init_ack >

Re: [PATCH V2] Fix a sleep-in-atomic bug in shash_setkey_unaligned

2017-10-03 Thread Andy Lutomirski
On Mon, Oct 2, 2017 at 10:26 PM, Herbert Xu wrote: > On Mon, Oct 02, 2017 at 09:18:24PM -0700, Andy Lutomirski wrote: >> > On Oct 2, 2017, at 7:25 PM, Jia-Ju Bai wrote: >> > >> > The SCTP program may sleep under a spinlock, and the function call path is: >> > sctp_generate_t3_rtx_event (acquire t

Re: [PATCH V2] Fix a sleep-in-atomic bug in shash_setkey_unaligned

2017-10-02 Thread Herbert Xu
On Mon, Oct 02, 2017 at 09:18:24PM -0700, Andy Lutomirski wrote: > > On Oct 2, 2017, at 7:25 PM, Jia-Ju Bai wrote: > > > > The SCTP program may sleep under a spinlock, and the function call path is: > > sctp_generate_t3_rtx_event (acquire the spinlock) > > sctp_do_sm > >sctp_side_effects > >

Re: [PATCH V2] Fix a sleep-in-atomic bug in shash_setkey_unaligned

2017-10-02 Thread Andy Lutomirski
> On Oct 2, 2017, at 7:25 PM, Jia-Ju Bai wrote: > > The SCTP program may sleep under a spinlock, and the function call path is: > sctp_generate_t3_rtx_event (acquire the spinlock) > sctp_do_sm >sctp_side_effects > sctp_cmd_interpreter >sctp_make_init_ack > sctp_pack_cook

[PATCH V2] Fix a sleep-in-atomic bug in shash_setkey_unaligned

2017-10-02 Thread Jia-Ju Bai
The SCTP program may sleep under a spinlock, and the function call path is: sctp_generate_t3_rtx_event (acquire the spinlock) sctp_do_sm sctp_side_effects sctp_cmd_interpreter sctp_make_init_ack sctp_pack_cookie crypto_shash_setkey shash_setke