Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp49482rdf; Thu, 2 Nov 2023 13:26:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHXcCtqyqicJhrzkitlLoqISiQV17c1yKaiTCeDoICf9sWPAC2foWmvxxwx6lxul2pCofxM X-Received: by 2002:a17:907:847:b0:9c4:d19:4a64 with SMTP id ww7-20020a170907084700b009c40d194a64mr5251996ejb.25.1698956766589; Thu, 02 Nov 2023 13:26:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698956766; cv=none; d=google.com; s=arc-20160816; b=fFI4I0CBHUGA+lfcCx6qHaLznu53ZAZzIqimElSmetBz05ZRVOlRCDwF7qHr0CvL5X CrREkVsrRtF32elkM2uauh71v/7EcLQh4CBZ21JQk1nMP9qcsVQnLMkkflM2b6Va1Jvx vg6c/uC1hEQS9vmBfzA+TtuNJXUDp8LX5H7Zjzd1pnZ/a58HOkDPaB4EPlSiBwUp95UK rtBhXQHbLuproxQ9/9gKsxTavzGYtUtVKlsKFegwukJyEBm0Xm41JIr5rH5MmtlaZ7G9 KF/GtV47TUs/gEM96RXFL6UjsfJfl6gd+XSaLBFIH+D5We6DasFt3jE8H08YRKa1AE70 T1Ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=RcWEoS06f0kWkjZ1YzkPeHLmfqD6IXJBjSAaROXoiz0=; fh=yfJw0/6N12chDRO/f3TWHrmpoBDZvOQAwWy0QlOCNA0=; b=g8Qz+KDmbtprKv+G8EEMIT0ZlW9ibxp5vDN9csmRs0CozFh74zlgRVhxH2CUHk3enk OsJpc26ahHWWDY+dF+X+wzGgWJ1kWTVY/9kPqD2bEmGGQmCUTEZBWxRaGohhoXOBO9pq eo2G7Z1fobURt5CC0nIEw8HgOmTykTROpTTJnHPC+c0zTC6JxbjcIWfbmDVMLPZcaSV0 PaNwZnsFuJjivOEhGrvdN06IBSV3LgL9C5S3a+AHMWltDqZsOIwV7pXzkBv3wN7YTtfA 9LZ9aci1vCfO8zvek/knyzIt2KTG1fprXg52ktqFFxsUFFK/Q54MaMqFQpxgGnBlwD8W S/pQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=boLdwsQS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id s12-20020a170906220c00b0099bcae257e3si105867ejs.832.2023.11.02.13.26.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 13:26:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=boLdwsQS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 3557A80CE7EA; Thu, 2 Nov 2023 13:25:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232715AbjKBUZR (ORCPT + 99 others); Thu, 2 Nov 2023 16:25:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229511AbjKBUZQ (ORCPT ); Thu, 2 Nov 2023 16:25:16 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 818571A7 for ; Thu, 2 Nov 2023 13:24:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698956664; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RcWEoS06f0kWkjZ1YzkPeHLmfqD6IXJBjSAaROXoiz0=; b=boLdwsQSQcVsgz1OTErqGIbqGrKDSE8eh+XTYBeN6pVHg7+3EXIq62VOHnTLgtjVNUrDKc qli0GYMy1yMIW6/2Ax44xxqgVY0Wdci5Ku5nH18wrem32tSts1cj4dhS2rj6bM5f2HS5dh N+RFw8d7/7g/emnvGGR8IlRAWnja5Zw= Received: from mail-ot1-f72.google.com (mail-ot1-f72.google.com [209.85.210.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-569-u6aI_T6iNrOW-c8oU-xxaA-1; Thu, 02 Nov 2023 16:24:22 -0400 X-MC-Unique: u6aI_T6iNrOW-c8oU-xxaA-1 Received: by mail-ot1-f72.google.com with SMTP id 46e09a7af769-6cdb4938072so1598795a34.0 for ; Thu, 02 Nov 2023 13:24:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698956661; x=1699561461; h=content-transfer-encoding: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=RcWEoS06f0kWkjZ1YzkPeHLmfqD6IXJBjSAaROXoiz0=; b=d4cv5OPmBlbT+wFdkvSJwXwFkrEAStrzBP4h0c5ThbmWItA/M6+m37U+7ko7aCRBcd 7plBEILjEfT0dkPe87lQvAC+OVuTyTR8i9N7qn0Sg/xIY+D2bAB0/kyq5T/wbDdHYK5j oV2W1Lu30a98oAGfSzB/OgbZjxUGmDeDYU1XIM+AHm6g3UYVl2v1Kr6WJsfD9Z2d+Ml/ kwHir+gzMebrjLgGGidhb922Xuq8SHLHFCarS3DXnz2lQuN2RgIc0fPwOiB5c3XGZ57V U01FRvh2fdWWFzXqwz4R1BAeu7IzoW42UMBySN7hz2UoMPQ2rWQPalR0La1V6qSEEjN5 c0HA== X-Gm-Message-State: AOJu0YyFiL1TQVuoOUa9c6Ay6mBrlPRLX4/8fuDSsG3nW0oglXLJipy3 xs1O/wzQgCKapTM1eV9666Js4xfC4mNM4W6eSyzU7CJ6ZoAnXWJb8bMbdckpMYhIFiXNoaHr9cf 2j49mjKZqWTR7WH2nQJL0uno8XMbe2BbjNMis/Utg X-Received: by 2002:a05:6830:4409:b0:6d3:2346:8e0d with SMTP id q9-20020a056830440900b006d323468e0dmr4431830otv.3.1698956661324; Thu, 02 Nov 2023 13:24:21 -0700 (PDT) X-Received: by 2002:a05:6830:4409:b0:6d3:2346:8e0d with SMTP id q9-20020a056830440900b006d323468e0dmr4431813otv.3.1698956661128; Thu, 02 Nov 2023 13:24:21 -0700 (PDT) MIME-Version: 1.0 References: <20231102192134.53301-2-pstanner@redhat.com> <20231102201424.GL1957730@ZenIV> In-Reply-To: <20231102201424.GL1957730@ZenIV> From: David Airlie Date: Fri, 3 Nov 2023 06:24:09 +1000 Message-ID: Subject: Re: [PATCH] drivers/tty/vt: copy userspace arrays safely To: Al Viro Cc: Philipp Stanner , Greg Kroah-Hartman , Jiri Slaby , Andrew Morton , Kefeng Wang , Tony Luck , Ard Biesheuvel , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=0.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SORBS_WEB,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Thu, 02 Nov 2023 13:25:31 -0700 (PDT) On Fri, Nov 3, 2023 at 6:14=E2=80=AFAM Al Viro wr= ote: > > On Thu, Nov 02, 2023 at 08:21:35PM +0100, Philipp Stanner wrote: > > The functions (v)memdup_user() are utilized to copy userspace arrays. > > This is done without overflow checks. > > > > Use the new wrappers memdup_array_user() and vmemdup_array_user() to > > copy the arrays more safely. > > > @@ -644,7 +644,7 @@ int con_set_unimap(struct vc_data *vc, ushort ct, s= truct unipair __user *list) > > if (!ct) > > return 0; > > > - unilist =3D vmemdup_user(list, array_size(sizeof(*unilist), ct)); > > + unilist =3D vmemdup_array_user(list, ct, sizeof(*unilist)); > > if (IS_ERR(unilist)) > > return PTR_ERR(unilist); > > a 16bit value times sizeof(something). So since it's already using array_size here, moving it to a new helper for consistency just makes things clearer, and so you are fine with the patch? Otherwise I'd think you are been a snarky asshole to a coworker. Dave.