Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp224498rwb; Mon, 26 Sep 2022 17:44:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6L0Zp6Eoe/DcWVNl8FM7EVcZZV+9oBCqxGmcVjdDoiYjG9D7Nubi5XQLMJwE7hYokWJk0k X-Received: by 2002:a05:6402:28ca:b0:43b:5235:f325 with SMTP id ef10-20020a05640228ca00b0043b5235f325mr25147514edb.320.1664239447255; Mon, 26 Sep 2022 17:44:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664239447; cv=none; d=google.com; s=arc-20160816; b=k6Wm7hC8Txsoz5GJsDHReaIqQxX0FknNkBshDlVaNO84QswXrCpBUoL58PBL3IZfNP 0n5mNLskQJKY7F4QG2eWL8fuY2t0kBbRwe4ktIJoDnsC89WOd4MM8PrdKO7LiRHgmebP mh0eY+LCJyB5kFwKLU3SRf2ktVh0uX/TqfvY65SiVs+womD/L9AFgxdJmaN3R7QW42D2 8CDINlZVCpVy16FnhuYAkkvAMkLoZ0okzQ+2PzDgIJvTL5Xpi37sIcQ3DMbpEQAma0Zq 01wpY9PengrfjK6rqGd/2IlpHO89+fZUXWOdBfdNiy6f2wooQJnTk4SpIrnY/lNoUuWO 6QQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=gjxDtq0Rs25czueJLh+kJywKCTsPWEllkeEaIximls0=; b=jv0uNyku6SBpYLe5IW/0UT6KxJHrJ/rGp57ZYh4FjuNvP7x+lTyak3p/aZSnxbXqwQ +BE0rgWz2q7car7mABfRyjaMuBej4Gpts9JfT8y2M+KUTiRdT+obssbz/pzXvxmTLrP4 3d3L7G3/1GCItHs7MWvfxoy9OWxQN2veV7cxOhbSn1fBGGg2xtMZF1Jb4F9STZnqLcyy EJ5WMnytx3t5CxVqOWcEJnARiAkPeybNBf3/Hd0xlB8ioZC786kynVnS2LfFslbo9d9g Rmvt3OLFgOcqJrZ4EFw4RjM0MwmD6fhCYLnf99aQjphMvtO6fRsBQ4PxN7ZNW6W3ZIOz wpMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Qt+pUXJL; 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=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z13-20020a056402274d00b00456c837e3d0si264623edd.77.2022.09.26.17.43.38; Mon, 26 Sep 2022 17:44:07 -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=@chromium.org header.s=google header.b=Qt+pUXJL; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229436AbiI0AkD (ORCPT + 99 others); Mon, 26 Sep 2022 20:40:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229679AbiI0Aj7 (ORCPT ); Mon, 26 Sep 2022 20:39:59 -0400 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 281AE13D1C for ; Mon, 26 Sep 2022 17:39:56 -0700 (PDT) Received: by mail-pj1-x102d.google.com with SMTP id 8-20020a17090a0b8800b00205d8564b11so196077pjr.5 for ; Mon, 26 Sep 2022 17:39:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=gjxDtq0Rs25czueJLh+kJywKCTsPWEllkeEaIximls0=; b=Qt+pUXJLWWjyzrTWNLVv+IQOkUSuFq6QCzrTd+bfNJnEC/mlmP7mJ1ZUPsX+Z6hY3m UM7tKgEFBDCquZJfU17BA8hgD9xba/Apk87oVo5NgbL4bDm6u2I2ISuoXK3+DTdTX8VJ rzbW/CRrTHVIGYT5eCnI9w3mgYaszxwfLJYmk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=gjxDtq0Rs25czueJLh+kJywKCTsPWEllkeEaIximls0=; b=iQDb7C8l97AANL80FP5adtcS7ROc4JqohIyK2UmgzSxQ0hM7UXmy6Vkmd8yMQlE7/P qD9FkxyWZVsg6Dzp++LxMxHvEU0nf4X6VojQxbFIIYQPJdgbnVae451KqXNJ9SyDiZVh xoeVZa3VvPU6BB5Wy60S5kSojkbYg79/PQ/GN4FKlDOpz3V6QFpBX6DtUQv1VAAxndEZ hmChT2NhiwEme38dv5dGrgXyhbF9K+4yBYS9zSwt9P2+fwOk4pypoNePWjhqL3who3kN ulw/6eMHhsE54WcgLnjcS286VNJjd7SuuNsElafYFIEflacEmb/U7zl76Fg1Z579PKMh /HSA== X-Gm-Message-State: ACrzQf12WjraOeBOefdQJ9Nb7qe/Udf2QlFZDkDxLRPI+NWWdl81yaim /jNT0nUpqYL6S6rTWiPM/pnLdA== X-Received: by 2002:a17:903:2005:b0:178:3a78:80f5 with SMTP id s5-20020a170903200500b001783a7880f5mr24986789pla.174.1664239195767; Mon, 26 Sep 2022 17:39:55 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id h13-20020aa796cd000000b00540a346477csm133564pfq.76.2022.09.26.17.39.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Sep 2022 17:39:55 -0700 (PDT) From: Kees Cook To: Alexandra Winter Cc: Kees Cook , 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 Subject: [PATCH] s390/qeth: Split memcpy() of struct qeth_ipacmd_addr_change flexible array Date: Mon, 26 Sep 2022 17:39:53 -0700 Message-Id: <20220927003953.1942442-1-keescook@chromium.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1525; h=from:subject; bh=bUXptYsfn3QynH+ULXH8Hc9/lgFc7+jyEV9USOVT9ms=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBjMkZYJo3tqJvuRRvDT0Kc6P0APNVENYY0JXVpJPN6 o6X87pSJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCYzJGWAAKCRCJcvTf3G3AJoKLD/ 4pR/ZckZK4sdm9vPPPFA6WxL7A7xzH3EEfNBZ9NGAtkbm3elkZ/DRy0ULpzf7cp9z3/+g8ELZZio3Q llnRP2YMWF2GtNjMvhOctWgPQs7E3S80c5K3o5/j8A4PCZYo1RZli9eCra34cEQVrtKBXRRkspKGkv OjOrwLys51OAEu1HlZi3JckcCBQjGMjGQdDY+kk08Gt2XJv7N7iUxvy4kpp4bF6jobSVhmpKkyvDZt Mv4ydOMUF0j03BktcAJ4z/EtNf4JRPYuoVZIm1+JQiG51ewlVlndEhZ6kCiiIQPdq+RkkR/sMMC0s1 tsByRgpVn4jm95vXnuFV6lzdXnFSlsLQnTsjktuThpW+Nl5Cy0BVubYDZlOUlEcwP8u7PFiOkPcoWo 6Alczo9emoomb9jpWVbfd1Y5E2mW+mwukZlPd5z561oY2BDXC5oPLjCf5pDiRrM1pej99tT9ecFlTc ntLfR9LdRzBrQoyya648IpdOWzMgF5/VqJAaijut2pe7EYXILso1I6wKy0pvf1HLwE2DEv5kKUrMkm CfjGvONdqD3v0wbW3/p5bxPOac1ZgjsdxeF5a83y+Yn4MaY1MQRE4oQg/8DptmBvHLCooSHxqfRaG9 R8ITRB0DB14zuluOnP1MMssvrXDnUVNElfF2eAUJLu5LYQ9dEMKNeDvKstJA== X-Developer-Key: i=keescook@chromium.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 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 --- 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