All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][next] sctp: Fix out-of-bounds warning in sctp_process_asconf_param()
@ 2021-04-16 19:12 Gustavo A. R. Silva
  2021-04-16 19:53 ` Kees Cook
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Gustavo A. R. Silva @ 2021-04-16 19:12 UTC (permalink / raw)
  To: Vlad Yasevich, Neil Horman, Marcelo Ricardo Leitner,
	David S. Miller, Jakub Kicinski
  Cc: linux-sctp, netdev, linux-kernel, Gustavo A. R. Silva, linux-hardening

Fix the following out-of-bounds warning:

net/sctp/sm_make_chunk.c:3150:4: warning: 'memcpy' offset [17, 28] from the object at 'addr' is out of the bounds of referenced subobject 'v4' with type 'struct sockaddr_in' at offset 0 [-Warray-bounds]

This helps with the ongoing efforts to globally enable -Warray-bounds
and get us closer to being able to tighten the FORTIFY_SOURCE routines
on memcpy().

Link: https://github.com/KSPP/linux/issues/109
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
 net/sctp/sm_make_chunk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 54e6a708d06e..5f9a7c028274 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -3147,7 +3147,7 @@ static __be16 sctp_process_asconf_param(struct sctp_association *asoc,
 		 * primary.
 		 */
 		if (af->is_any(&addr))
-			memcpy(&addr.v4, sctp_source(asconf), sizeof(addr));
+			memcpy(&addr, sctp_source(asconf), sizeof(addr));
 
 		if (security_sctp_bind_connect(asoc->ep->base.sk,
 					       SCTP_PARAM_SET_PRIMARY,
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH][next] sctp: Fix out-of-bounds warning in sctp_process_asconf_param()
  2021-04-16 19:12 [PATCH][next] sctp: Fix out-of-bounds warning in sctp_process_asconf_param() Gustavo A. R. Silva
@ 2021-04-16 19:53 ` Kees Cook
  2021-04-16 20:16   ` Gustavo A. R. Silva
  2021-04-16 21:12 ` Marcelo Ricardo Leitner
       [not found] ` <161861761155.26880.11889736067176146088.git-patchwork-notify@kernel.org>
  2 siblings, 1 reply; 7+ messages in thread
From: Kees Cook @ 2021-04-16 19:53 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Vlad Yasevich, Neil Horman, Marcelo Ricardo Leitner,
	David S. Miller, Jakub Kicinski, linux-sctp, netdev,
	linux-kernel, linux-hardening

On Fri, Apr 16, 2021 at 02:12:36PM -0500, Gustavo A. R. Silva wrote:
> Fix the following out-of-bounds warning:
> 
> net/sctp/sm_make_chunk.c:3150:4: warning: 'memcpy' offset [17, 28] from the object at 'addr' is out of the bounds of referenced subobject 'v4' with type 'struct sockaddr_in' at offset 0 [-Warray-bounds]
> 
> This helps with the ongoing efforts to globally enable -Warray-bounds
> and get us closer to being able to tighten the FORTIFY_SOURCE routines
> on memcpy().
> 
> Link: https://github.com/KSPP/linux/issues/109
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Yup!

Reviewed-by: Kees Cook <keescook@chromium.org>

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH][next] sctp: Fix out-of-bounds warning in sctp_process_asconf_param()
  2021-04-16 19:53 ` Kees Cook
@ 2021-04-16 20:16   ` Gustavo A. R. Silva
  0 siblings, 0 replies; 7+ messages in thread
From: Gustavo A. R. Silva @ 2021-04-16 20:16 UTC (permalink / raw)
  To: Kees Cook, Gustavo A. R. Silva
  Cc: Vlad Yasevich, Neil Horman, Marcelo Ricardo Leitner,
	David S. Miller, Jakub Kicinski, linux-sctp, netdev,
	linux-kernel, linux-hardening



On 4/16/21 14:53, Kees Cook wrote:
> On Fri, Apr 16, 2021 at 02:12:36PM -0500, Gustavo A. R. Silva wrote:
>> Fix the following out-of-bounds warning:
>>
>> net/sctp/sm_make_chunk.c:3150:4: warning: 'memcpy' offset [17, 28] from the object at 'addr' is out of the bounds of referenced subobject 'v4' with type 'struct sockaddr_in' at offset 0 [-Warray-bounds]
>>
>> This helps with the ongoing efforts to globally enable -Warray-bounds
>> and get us closer to being able to tighten the FORTIFY_SOURCE routines
>> on memcpy().
>>
>> Link: https://github.com/KSPP/linux/issues/109
>> Reported-by: kernel test robot <lkp@intel.com>
>> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
> 
> Yup!

:)

> Reviewed-by: Kees Cook <keescook@chromium.org>

Thanks, Kees.

--
Gustavo

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH][next] sctp: Fix out-of-bounds warning in sctp_process_asconf_param()
  2021-04-16 19:12 [PATCH][next] sctp: Fix out-of-bounds warning in sctp_process_asconf_param() Gustavo A. R. Silva
  2021-04-16 19:53 ` Kees Cook
@ 2021-04-16 21:12 ` Marcelo Ricardo Leitner
       [not found] ` <161861761155.26880.11889736067176146088.git-patchwork-notify@kernel.org>
  2 siblings, 0 replies; 7+ messages in thread
From: Marcelo Ricardo Leitner @ 2021-04-16 21:12 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Vlad Yasevich, Neil Horman, David S. Miller, Jakub Kicinski,
	linux-sctp, netdev, linux-kernel, linux-hardening

On Fri, Apr 16, 2021 at 02:12:36PM -0500, Gustavo A. R. Silva wrote:
> Fix the following out-of-bounds warning:
> 
> net/sctp/sm_make_chunk.c:3150:4: warning: 'memcpy' offset [17, 28] from the object at 'addr' is out of the bounds of referenced subobject 'v4' with type 'struct sockaddr_in' at offset 0 [-Warray-bounds]
> 
> This helps with the ongoing efforts to globally enable -Warray-bounds
> and get us closer to being able to tighten the FORTIFY_SOURCE routines
> on memcpy().
> 
> Link: https://github.com/KSPP/linux/issues/109
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Thanks.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH][next] sctp: Fix out-of-bounds warning in sctp_process_asconf_param()
       [not found] ` <161861761155.26880.11889736067176146088.git-patchwork-notify@kernel.org>
@ 2021-04-17  0:07   ` Gustavo A. R. Silva
  2021-04-19 22:34     ` David Miller
  0 siblings, 1 reply; 7+ messages in thread
From: Gustavo A. R. Silva @ 2021-04-17  0:07 UTC (permalink / raw)
  To: patchwork-bot+netdevbpf, Gustavo A. R. Silva, David Miller
  Cc: vyasevich, nhorman, marcelo.leitner, kuba, linux-sctp, netdev,
	linux-kernel, linux-hardening

Dave,

On 4/16/21 19:00, patchwork-bot+netdevbpf@kernel.org wrote:
> Hello:
> 
> This patch was applied to netdev/net-next.git (refs/heads/master):
> 
> On Fri, 16 Apr 2021 14:12:36 -0500 you wrote:
>> Fix the following out-of-bounds warning:
>>
>> net/sctp/sm_make_chunk.c:3150:4: warning: 'memcpy' offset [17, 28] from the object at 'addr' is out of the bounds of referenced subobject 'v4' with type 'struct sockaddr_in' at offset 0 [-Warray-bounds]
>>
>> This helps with the ongoing efforts to globally enable -Warray-bounds
>> and get us closer to being able to tighten the FORTIFY_SOURCE routines
>> on memcpy().
>>
>> [...]
> 
> Here is the summary with links:
>   - [next] sctp: Fix out-of-bounds warning in sctp_process_asconf_param()
>     https://git.kernel.org/netdev/net-next/c/e5272ad4aab3

Thanks for this. Can you take these other two, as well, please?

https://lore.kernel.org/linux-hardening/20210416201540.GA593906@embeddedor/
https://lore.kernel.org/linux-hardening/20210416193151.GA591935@embeddedor/

Thanks!
--
Gustavo

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH][next] sctp: Fix out-of-bounds warning in sctp_process_asconf_param()
  2021-04-17  0:07   ` Gustavo A. R. Silva
@ 2021-04-19 22:34     ` David Miller
  2021-04-19 22:39       ` Gustavo A. R. Silva
  0 siblings, 1 reply; 7+ messages in thread
From: David Miller @ 2021-04-19 22:34 UTC (permalink / raw)
  To: gustavo
  Cc: patchwork-bot+netdevbpf, gustavoars, vyasevich, nhorman,
	marcelo.leitner, kuba, linux-sctp, netdev, linux-kernel,
	linux-hardening

From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Date: Fri, 16 Apr 2021 19:07:05 -0500

> Dave,
> 
> On 4/16/21 19:00, patchwork-bot+netdevbpf@kernel.org wrote:
>> Hello:
>> 
>> This patch was applied to netdev/net-next.git (refs/heads/master):
>> 
>> On Fri, 16 Apr 2021 14:12:36 -0500 you wrote:
>>> Fix the following out-of-bounds warning:
>>>
>>> net/sctp/sm_make_chunk.c:3150:4: warning: 'memcpy' offset [17, 28] from the object at 'addr' is out of the bounds of referenced subobject 'v4' with type 'struct sockaddr_in' at offset 0 [-Warray-bounds]
>>>
>>> This helps with the ongoing efforts to globally enable -Warray-bounds
>>> and get us closer to being able to tighten the FORTIFY_SOURCE routines
>>> on memcpy().
>>>
>>> [...]
>> 
>> Here is the summary with links:
>>   - [next] sctp: Fix out-of-bounds warning in sctp_process_asconf_param()
>>     https://git.kernel.org/netdev/net-next/c/e5272ad4aab3
> 
> Thanks for this. Can you take these other two, as well, please?
> 
> https://lore.kernel.org/linux-hardening/20210416201540.GA593906@embeddedor/
> https://lore.kernel.org/linux-hardening/20210416193151.GA591935@embeddedor/
> 

Done.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH][next] sctp: Fix out-of-bounds warning in sctp_process_asconf_param()
  2021-04-19 22:34     ` David Miller
@ 2021-04-19 22:39       ` Gustavo A. R. Silva
  0 siblings, 0 replies; 7+ messages in thread
From: Gustavo A. R. Silva @ 2021-04-19 22:39 UTC (permalink / raw)
  To: David Miller
  Cc: patchwork-bot+netdevbpf, gustavoars, vyasevich, nhorman,
	marcelo.leitner, kuba, linux-sctp, netdev, linux-kernel,
	linux-hardening



On 4/19/21 17:34, David Miller wrote:

>> Thanks for this. Can you take these other two, as well, please?
>>
>> https://lore.kernel.org/linux-hardening/20210416201540.GA593906@embeddedor/
>> https://lore.kernel.org/linux-hardening/20210416193151.GA591935@embeddedor/
>>
> 
> Done.

Thanks, Dave!

--
Gustavo

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-04-19 22:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-16 19:12 [PATCH][next] sctp: Fix out-of-bounds warning in sctp_process_asconf_param() Gustavo A. R. Silva
2021-04-16 19:53 ` Kees Cook
2021-04-16 20:16   ` Gustavo A. R. Silva
2021-04-16 21:12 ` Marcelo Ricardo Leitner
     [not found] ` <161861761155.26880.11889736067176146088.git-patchwork-notify@kernel.org>
2021-04-17  0:07   ` Gustavo A. R. Silva
2021-04-19 22:34     ` David Miller
2021-04-19 22:39       ` Gustavo A. R. Silva

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.