All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anant Thazhemadam <anant.thazhemadam@gmail.com>
To: Greg KH <greg@kroah.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jakub Kicinski <kuba@kernel.org>,
	syzbot+09a5d591c1f98cf5efcb@syzkaller.appspotmail.com,
	"David S. Miller" <davem@davemloft.net>,
	linux-kernel-mentees@lists.linuxfoundation.org
Subject: Re: [Linux-kernel-mentees] [PATCH] net: fix uninit value error in __sys_sendmmsg
Date: Sun, 13 Sep 2020 11:50:52 +0530	[thread overview]
Message-ID: <89526337-9657-8f4d-3022-9f2ad830fbe9@gmail.com> (raw)
In-Reply-To: <20200913061351.GA585618@kroah.com>


On 13/09/20 11:43 am, Greg KH wrote:
> On Sun, Sep 13, 2020 at 11:26:39AM +0530, Anant Thazhemadam wrote:
>> The crash report showed that there was a local variable;
>>
>> ----iovstack.i@__sys_sendmmsg created at:
>>  ___sys_sendmsg net/socket.c:2388 [inline]
>>  __sys_sendmmsg+0x6db/0xc90 net/socket.c:2480
>>  
>>  that was left uninitialized.
>>
>> The contents of iovstack are of interest, since the respective pointer
>> is passed down as an argument to sendmsg_copy_msghdr as well.
>> Initializing this contents of this stack prevents this bug from happening.
>>
>> Since the memory that was initialized is freed at the end of the function
>> call, memory leaks are not likely to be an issue.
>>
>> syzbot seems to have triggered this error by passing an array of 0's as
>> a parameter while making the initial system call.
>>
>> Reported-by: syzbot+09a5d591c1f98cf5efcb@syzkaller.appspotmail.com
>> Tested-by: syzbot+09a5d591c1f98cf5efcb@syzkaller.appspotmail.com
>> Signed-off-by: Anant Thazhemadam <anant.thazhemadam@gmail.com>
>> ---
>>  net/socket.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/net/socket.c b/net/socket.c
>> index 0c0144604f81..d74443dfd73b 100644
>> --- a/net/socket.c
>> +++ b/net/socket.c
>> @@ -2396,6 +2396,7 @@ static int ___sys_sendmsg(struct socket *sock, struct user_msghdr __user *msg,
>>  {
>>  	struct sockaddr_storage address;
>>  	struct iovec iovstack[UIO_FASTIOV], *iov = iovstack;
>> +	memset(iov, 0, UIO_FASTIOV);
>>  	ssize_t err;
>>  
>>  	msg_sys->msg_name = &address;
> I don't think you built this code change, otherwise you would have seen
> that it adds a build warning to the system, right?
>
> :(
My apologies. I think I ended up overlooking the build warning. Thank you for pointing that out.
If everything else looks good, I'd be happy to send in a v2 that fixes this build warning.

Thanks,
Anant

WARNING: multiple messages have this Message-ID (diff)
From: Anant Thazhemadam <anant.thazhemadam@gmail.com>
To: Greg KH <greg@kroah.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jakub Kicinski <kuba@kernel.org>,
	syzbot+09a5d591c1f98cf5efcb@syzkaller.appspotmail.com,
	"David S. Miller" <davem@davemloft.net>,
	linux-kernel-mentees@lists.linuxfoundation.org
Subject: Re: [Linux-kernel-mentees] [PATCH] net: fix uninit value error in __sys_sendmmsg
Date: Sun, 13 Sep 2020 11:50:52 +0530	[thread overview]
Message-ID: <89526337-9657-8f4d-3022-9f2ad830fbe9@gmail.com> (raw)
In-Reply-To: <20200913061351.GA585618@kroah.com>


On 13/09/20 11:43 am, Greg KH wrote:
> On Sun, Sep 13, 2020 at 11:26:39AM +0530, Anant Thazhemadam wrote:
>> The crash report showed that there was a local variable;
>>
>> ----iovstack.i@__sys_sendmmsg created at:
>>  ___sys_sendmsg net/socket.c:2388 [inline]
>>  __sys_sendmmsg+0x6db/0xc90 net/socket.c:2480
>>  
>>  that was left uninitialized.
>>
>> The contents of iovstack are of interest, since the respective pointer
>> is passed down as an argument to sendmsg_copy_msghdr as well.
>> Initializing this contents of this stack prevents this bug from happening.
>>
>> Since the memory that was initialized is freed at the end of the function
>> call, memory leaks are not likely to be an issue.
>>
>> syzbot seems to have triggered this error by passing an array of 0's as
>> a parameter while making the initial system call.
>>
>> Reported-by: syzbot+09a5d591c1f98cf5efcb@syzkaller.appspotmail.com
>> Tested-by: syzbot+09a5d591c1f98cf5efcb@syzkaller.appspotmail.com
>> Signed-off-by: Anant Thazhemadam <anant.thazhemadam@gmail.com>
>> ---
>>  net/socket.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/net/socket.c b/net/socket.c
>> index 0c0144604f81..d74443dfd73b 100644
>> --- a/net/socket.c
>> +++ b/net/socket.c
>> @@ -2396,6 +2396,7 @@ static int ___sys_sendmsg(struct socket *sock, struct user_msghdr __user *msg,
>>  {
>>  	struct sockaddr_storage address;
>>  	struct iovec iovstack[UIO_FASTIOV], *iov = iovstack;
>> +	memset(iov, 0, UIO_FASTIOV);
>>  	ssize_t err;
>>  
>>  	msg_sys->msg_name = &address;
> I don't think you built this code change, otherwise you would have seen
> that it adds a build warning to the system, right?
>
> :(
My apologies. I think I ended up overlooking the build warning. Thank you for pointing that out.
If everything else looks good, I'd be happy to send in a v2 that fixes this build warning.

Thanks,
Anant
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

  reply	other threads:[~2020-09-13  6:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-13  5:56 [PATCH] net: fix uninit value error in __sys_sendmmsg Anant Thazhemadam
2020-09-13  5:56 ` [Linux-kernel-mentees] " Anant Thazhemadam
2020-09-13  6:13 ` Greg KH
2020-09-13  6:13   ` Greg KH
2020-09-13  6:20   ` Anant Thazhemadam [this message]
2020-09-13  6:20     ` Anant Thazhemadam
2020-09-13 21:25     ` David Miller
2020-09-13 21:25       ` David Miller
2020-09-14  5:09       ` Anant Thazhemadam
2020-09-14  7:58   ` David Laight
2020-09-14  7:58     ` David Laight

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=89526337-9657-8f4d-3022-9f2ad830fbe9@gmail.com \
    --to=anant.thazhemadam@gmail.com \
    --cc=davem@davemloft.net \
    --cc=greg@kroah.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=syzbot+09a5d591c1f98cf5efcb@syzkaller.appspotmail.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.