Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp2599309rdb; Tue, 12 Sep 2023 06:57:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHltBtjj0oKC6C2DmjtrLqBtQocEuQpJ1x8UVuQ8uy7oNLT9HH8rKZB7n5OLH7wG+PbcIiC X-Received: by 2002:a17:902:ea0c:b0:1c3:81b7:2385 with SMTP id s12-20020a170902ea0c00b001c381b72385mr4359691plg.11.1694527021913; Tue, 12 Sep 2023 06:57:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694527021; cv=none; d=google.com; s=arc-20160816; b=QImuUdsHlTwh5KH50H2/izye+7GOGs6uhO9fnz7kc3WL6VsIRiRQzA/kjsG/NcKP9D apXDQNqUPmFxkUBi05QWmoCOK9yoKPhuMtJMvx1yfquBxy4FwfbPgxaJKs4UDssEOA4X tQH4p3QtnKTSFRb1ShmzzoOFTqbhsyErN4AFf1J/jKth7sIIZx2M0clnDXCqmyR8nUvP bAVWXqjMwdWeknOXFR/DaTXE5EPCDksonwwXoS1tfysuAwTR9hlBdRLMLzuQswmy1cgE bkFvFYECzSECvie7oxPzowZKIkK9VmiLQFZ9+m5HcCg07YJqerqj1VN1uw2E+t4YzU0U FAug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Dfh8/mDNgK8vxrADw9UDg9zBqSEE3ndEwyQtmVmeyWM=; fh=T1QmvzV2XCgY10BaOiNHtkjHGhrM3U6Nacs13vNKFHg=; b=nNck/t+Y0HZS3aTe2g0M1mV1B9adl3XdwPaE1xGpPSY8RsNyCMqgPyRYElB6qNHCuO UUKu8j+DqSRJNatJbhWd5JZTYfqdHvCTUVbpPnt4Q4u/saI0c6Ffm1O9OZ4QIkW6+W1t jqAuz1jQ6eo1CFJlBwEQAbF8yPLrLjpDY5KvlC6gpSxJCs060E7IMW6L88vXeQc73NTn CrfXX4TDbb0KqJZWmsjoXF+wvVCtoOLeztnSJ/C2I9vfgaBa/cBZB6FhI68Dvhw5ZrFA hmPe2r1xFJTf+Ru1t9C1/md+kcDndbmnME/nQjDTy49CQZRnkpyggO92n0AHTfdWs//W JSlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=dGkwDdBC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id y16-20020a170902b49000b001b5fc11ea09si8061139plr.94.2023.09.12.06.57.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 06:57:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=dGkwDdBC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 3A08A81CEB3E; Mon, 11 Sep 2023 21:35:18 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.8 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238768AbjILCbl (ORCPT + 99 others); Mon, 11 Sep 2023 22:31:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238855AbjILCbP (ORCPT ); Mon, 11 Sep 2023 22:31:15 -0400 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D67581018BC; Mon, 11 Sep 2023 18:55:46 -0700 (PDT) Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-502b1bbe5c3so3506401e87.1; Mon, 11 Sep 2023 18:55:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694483745; x=1695088545; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Dfh8/mDNgK8vxrADw9UDg9zBqSEE3ndEwyQtmVmeyWM=; b=dGkwDdBCX3cXrz8Ue9ZL6uoO1ie1TIMpf4wzbZ3qWw+Mhd7e2Fz/55RqjyRfhcmVkr lrOKLz9frG/wJbmma7JNaunjK9me9ZOvrdS2i6BB6HXeNq9SYBrDdeq0IBp3oOeLDKEA g8RojhzRXq/mY6d0+kR9JnGOlrP0e0wSCh0dJphcO7yfTozuZV3MGepDjXi7aR2lZRgI vZRIzAtxRVc056brgE5gS0RUByIlyCNYaYDsJg0g9AuY4eUbmhROaSItRGRjoowD1674 TNEeJ/KunB7/8Z3ko9Cx8K1jB4mOOydKnvpq011PT/xyQUr5s9jZzuigCnLGs+mc3L62 m1Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694483745; x=1695088545; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Dfh8/mDNgK8vxrADw9UDg9zBqSEE3ndEwyQtmVmeyWM=; b=qggRUVVBuUo7Jvg54FguPz7NPP1vRM09CvPkqL0OpOGcoEhXor6HKtVZPCP5vhOqTc A7M5C/G9IqgHJdJg8NXmRB0LEetR1LiQACgkSwLQuK9Fo7zv0IfpA7CGXvY8MSat999Z i2mbCnTzcFnMeqbcW8A4h8M+rtxGwiC5JADv8KLBQNh0xyo6TotknSC9y3FuG/UA9LS/ oO0RZ7Z3j4stWAiDUd/FkzqJjUdTcdGWC2rIqfLTssPwMlPUUDYksttJy7W+orGZmWed mMihkDPfmCwIIA+xz+E1QS6wg2aGnEw1IlsY3CXtqMGdXEj/HPE/eqC9xtEhYSQZahv2 3D6Q== X-Gm-Message-State: AOJu0YzV9GoBDfg34LzcldVfnE2Yxym6BNvj8/rKQhNYVGF6tOf0xI99 2Q+ZdopxGyNoZZbQ+ma1NTojBX2tzzDR+3bd1Eo= X-Received: by 2002:a05:6512:2038:b0:500:75f1:c22e with SMTP id s24-20020a056512203800b0050075f1c22emr7814227lfs.40.1694483744716; Mon, 11 Sep 2023 18:55:44 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Dave Airlie Date: Tue, 12 Sep 2023 11:55:32 +1000 Message-ID: Subject: Re: [PATCH v2 0/5] Introduce new wrappers to copy user-arrays To: Kees Cook Cc: Philipp Stanner , Kees Cook , Andy Shevchenko , Eric Biederman , Christian Brauner , David Disseldorp , Luis Chamberlain , Siddh Raman Pant , Nick Alcock , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Daniel Vetter , Zack Rusin , VMware Graphics Reviewers , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kexec@lists.infradead.org, linux-hardening@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 11 Sep 2023 21:35:18 -0700 (PDT) On Tue, 12 Sept 2023 at 11:27, Kees Cook wrote: > > On September 8, 2023 12:59:39 PM PDT, Philipp Stanner wrote: > >Hi! > > > >David Airlie suggested that we could implement new wrappers around > >(v)memdup_user() for duplicating user arrays. > > > >This small patch series first implements the two new wrapper functions > >memdup_array_user() and vmemdup_array_user(). They calculate the > >array-sizes safely, i.e., they return an error in case of an overflow. > > > >It then implements the new wrappers in two components in kernel/ and two > >in the drm-subsystem. > > > >In total, there are 18 files in the kernel that use (v)memdup_user() to > >duplicate arrays. My plan is to provide patches for the other 14 > >successively once this series has been merged. > > > > > >Changes since v1: > >- Insert new headers alphabetically ordered > >- Remove empty lines in functions' docstrings > >- Return -EOVERFLOW instead of -EINVAL from wrapper functions > > > > > >@Andy: > >I test-build it for UM on my x86_64. Builds successfully. > >A kernel build (localmodconfig) for my Fedora38 @ x86_64 does also boot > >fine. > > > >If there is more I can do to verify the early boot stages are fine, > >please let me know! > > > >P. > > > >Philipp Stanner (5): > > string.h: add array-wrappers for (v)memdup_user() > > kernel: kexec: copy user-array safely > > kernel: watch_queue: copy user-array safely > > drm_lease.c: copy user-array safely > > drm: vmgfx_surface.c: copy user-array safely > > > > drivers/gpu/drm/drm_lease.c | 4 +-- > > drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 4 +-- > > include/linux/string.h | 40 +++++++++++++++++++++++++ > > kernel/kexec.c | 2 +- > > kernel/watch_queue.c | 2 +- > > 5 files changed, 46 insertions(+), 6 deletions(-) > > > > Nice. For the series: > > Reviewed-by: Kees Cook Hey Kees, what tree do you think it would best to land this through? I'm happy to send the initial set from a drm branch, but also happy to have it land via someone with a better process. Dave.