Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp832950rwb; Tue, 27 Sep 2022 05:23:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7ahoJmmdPyRj5VoAfEFKzb57k588y2GrThpLg2S36h0bvmGepinq0FWpFYC9/WQ8vDn12d X-Received: by 2002:a05:6402:27cf:b0:451:6ccc:4ea0 with SMTP id c15-20020a05640227cf00b004516ccc4ea0mr27748196ede.193.1664281403474; Tue, 27 Sep 2022 05:23:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664281403; cv=none; d=google.com; s=arc-20160816; b=VCn63U0GtgKLalUJtpyDY3lGm7uh2i7U1FEu99nfomLWyw+vPqM+pt2Y6z1BonBm49 uBrZaR7QEG/il0XSUebLQKHNxEK0Hj6gkihayz8k2xLkbQB2STYJU9zQzjNKC/9h9gXQ 2mJMRU5e13hh/k3L5zopVR8Sr5hXbXMGZR3AJ6xBKw6yPQQJXQ72FFG4voCJR1Gto9B8 /IQxIq+3AXzhmDUHCRYJPgbEc0nkfWFfV23SfRLSjpAZ9cnCNE3AH0czFVG5ZRNrkK4n 4+Uhs6C5q246lbWJdXLP1C9J+inmQShQstaUrxy7jczYBiBJv4a3QG47336eV/oVAlWC 629Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=xLsQWoQYEmSnbRzAfDyJ0GosO+ncb/MY/54nvuNAncY=; b=AmDqvE19XVIujC79XiA+71461MKw+fzh5SwLh5kYwfVYNNTBlapzBwEbe8vWlMysHq hQC3Qhb6GjqBLz620/xJIxcN7bwZnVwigS/9Tkhoh8wSiEPHSDrOPtqJx4p6wDvBUJkR OlU/bL+XZ7g7HIvWCZ42TKRMsmDeXtFfW3Rys3Ho8eN0HjGL4i4ClECdimJAMyPLXoRB tzITtYCK6cykDNT9ODnHmDr7was1VMjulWJlrEdw5mhG+Eu2+9HLQGdc9oYdXS4GYxRo 0BSbLkrqgSs/UtdE5qFn3V/N45PH9iZ+gy/74o0gL9aGIrwLqK8y9fr7gCHFZen4KNlw RDbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=jvMOG30k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb28-20020a1709071c9c00b00780b9f1d14asi1188377ejc.663.2022.09.27.05.22.55; Tue, 27 Sep 2022 05:23:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=jvMOG30k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231950AbiI0Lyp (ORCPT + 99 others); Tue, 27 Sep 2022 07:54:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230209AbiI0Lyi (ORCPT ); Tue, 27 Sep 2022 07:54:38 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 625DE32EC9; Tue, 27 Sep 2022 04:54:37 -0700 (PDT) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28RBroAh015071; Tue, 27 Sep 2022 11:54:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pp1; bh=xLsQWoQYEmSnbRzAfDyJ0GosO+ncb/MY/54nvuNAncY=; b=jvMOG30kZWLXWnxFa1bRIaAeEM+52Yms3ru2FpsOoeFuuuankwbnlwWwMxRFrLNoPZzO syvhWINRVewZZ2WFOEkI1GbFADfMTJn4Y7ffgDY9tRyqz6hQpaxN24cik9AP48rwvWPD 5hmjH7n50yewRbJ/ALGVtNdn1S6bbR4iUHo3jTs+mjXQGkMqUFFshnyV2YVrIfIMCHf7 /f8mmxRgwZKT0K4/DQCIGlHQ+Own5IInFqhc2zuf8PQvEU+0X/2fYNAO6MHauaUkzlSr 65S1L0Lys4HeMBsgd4FOVEMOHZs4ag0qRlEAq4DSkK5I3o5GXciJe3rcd6jx1qyDAor3 UQ== Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3jv0pr00bf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Sep 2022 11:54:33 +0000 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 28RBoEuH031152; Tue, 27 Sep 2022 11:54:31 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma05fra.de.ibm.com with ESMTP id 3jssh8ttsc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Sep 2022 11:54:31 +0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 28RBoFkW46203376 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 27 Sep 2022 11:50:15 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 64C9C4204B; Tue, 27 Sep 2022 11:54:28 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0944C42045; Tue, 27 Sep 2022 11:54:28 +0000 (GMT) Received: from [9.152.224.236] (unknown [9.152.224.236]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 27 Sep 2022 11:54:27 +0000 (GMT) Message-ID: <23b905f8-2836-8879-fe9f-9521e0f8674e@linux.ibm.com> Date: Tue, 27 Sep 2022 13:54:27 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.13.1 Subject: Re: [PATCH] s390/qeth: Split memcpy() of struct qeth_ipacmd_addr_change flexible array Content-Language: en-US To: "Gustavo A. R. Silva" , Kees Cook Cc: Wenjia Zhang , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , linux-s390@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org References: <20220927003953.1942442-1-keescook@chromium.org> From: Alexandra Winter In-Reply-To: Content-Type: text/plain; charset=UTF-8 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: RBvWxvqcdxstuJ3M2seMtC6vRdy9bNz0 X-Proofpoint-GUID: RBvWxvqcdxstuJ3M2seMtC6vRdy9bNz0 Content-Transfer-Encoding: 7bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-27_03,2022-09-27_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 suspectscore=0 mlxscore=0 clxscore=1011 lowpriorityscore=0 spamscore=0 phishscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209270069 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 27.09.22 03:16, Gustavo A. R. Silva wrote: > On Mon, Sep 26, 2022 at 05:39:53PM -0700, Kees Cook wrote: >> To work around a misbehavior of the compiler's ability to see into >> composite flexible array structs (as detailed in the coming memcpy() >> hardening series[1]), split the memcpy() of the header and the payload >> so no false positive run-time overflow warning will be generated. >> >> [1] https://lore.kernel.org/linux-hardening/20220901065914.1417829-2-keescook@chromium.org/ >> >> Cc: Alexandra Winter >> Cc: Wenjia Zhang >> Cc: Heiko Carstens >> Cc: Vasily Gorbik >> Cc: Alexander Gordeev >> Cc: Christian Borntraeger >> Cc: Sven Schnelle >> Cc: linux-s390@vger.kernel.org >> Cc: netdev@vger.kernel.org >> Signed-off-by: Kees Cook > > Reviewed-by: Gustavo A. R. Silva > > Thanks! > -- > Gustavo > Reviewed-by: Alexandra Winter Thank you Alexandra >> --- >> drivers/s390/net/qeth_l2_main.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c >> index 2d4436cbcb47..0ce635b7b472 100644 >> --- a/drivers/s390/net/qeth_l2_main.c >> +++ b/drivers/s390/net/qeth_l2_main.c >> @@ -1530,8 +1530,8 @@ static void qeth_addr_change_event(struct qeth_card *card, >> else >> INIT_DELAYED_WORK(&data->dwork, qeth_l2_dev2br_worker); >> data->card = card; >> - memcpy(&data->ac_event, hostevs, >> - sizeof(struct qeth_ipacmd_addr_change) + extrasize); >> + data->ac_event = *hostevs; >> + memcpy(data->ac_event.entry, hostevs->entry, extrasize); >> queue_delayed_work(card->event_wq, &data->dwork, 0); >> } >> >> -- >> 2.34.1 >>