Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp1251965rdg; Fri, 11 Aug 2023 15:17:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEdd5THmwJHkI8m6Ax1GIKdwkpC59nqHx/B6/ZP/sJ8GUNpqBeavDs+nCznTT9U7wOKse95 X-Received: by 2002:a05:6a20:394d:b0:12f:952:11fb with SMTP id r13-20020a056a20394d00b0012f095211fbmr3743234pzg.52.1691792249239; Fri, 11 Aug 2023 15:17:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691792249; cv=none; d=google.com; s=arc-20160816; b=XCmWkEULnFJfFyJpKLwMBAJ0ZFolaKMEB9gf+nxHfxhybYOnIkqteWg6HpE8BrY87H VW2Qyd5PC0v22k0uMZhXxoK76bObYpdLHa0CGfT/vjWQu20Vo9kDQVyjj0xvbKaCk2xo iAQLsRP/1TrLj7H8wSOG5n7YkBU5y7zAlZAYNJDM28nnNVqa8bQwvX6hI2LVAuXAjh// ri9xRh7SC67UaIDV7C2R+FYAQcHFJOP5UUTvTT+nmLuaVsac2guDoZAwdSpuiBrfNXez fRvk81TcM7UFYeb1gl+R6t3u9YjcwWIWFwTmxlN98h1FyHRbfJQQxKAffqxQxPxWl5pz ryYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=T8aVoixM0xxO+gfsUyyhZDp4bChNMHCVGjLRMPROvP8=; fh=JOPP2UKodrFOCiQckP0ZVZeQ1rHnBOfcsjjC3l9B6Mg=; b=GD++9u4ts1+zdVQEzlSchV2HEeDkitUIclc04h/pIbNVO1LEcEvft5e3pDdI8Dwv79 1FG8PC9XvP1U/eJ6qu2ELt4SfDfDeD9OIMteT8YWRdVS9Ldi+V5bqSauw0buaJDjfnz8 TG2d5ec6kHDAKB1kLWniFp15uTmt0uOSEsY0G4Fvt1JptVvczo4mYHb2otW2SmyYJ51Y oSaQ4JWx0iK5zldwBH2/k8+TdH3EZIXx9nFoBnrGINaW366O/Yu7vzX7+A22TkRBDYdM bCGcVT0HC/MoCI/3VZ8ECipfhyeWlcVLiTYJSamXfUydv9v/GOJL9Lg5VkV1Ucnn/cPm 9yJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="ND/zo0nf"; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n7-20020a170903110700b001b9ffda161esi3964904plh.451.2023.08.11.15.17.15; Fri, 11 Aug 2023 15:17:29 -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=@redhat.com header.s=mimecast20190719 header.b="ND/zo0nf"; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236424AbjHKUw1 (ORCPT + 99 others); Fri, 11 Aug 2023 16:52:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234928AbjHKUwZ (ORCPT ); Fri, 11 Aug 2023 16:52:25 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B1DC2D78 for ; Fri, 11 Aug 2023 13:51:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691787097; 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: in-reply-to:in-reply-to:references:references; bh=T8aVoixM0xxO+gfsUyyhZDp4bChNMHCVGjLRMPROvP8=; b=ND/zo0nfbyrtRPuOhDKVA89mjhP7jQ/8rPPwXm/ydLLvYZAGMrS1jlCMXrP6qVqp/yMhdc YpXEJa/3fXPMNheY6Ng7/wjbHVTjv8AH7/bHk0VZjOb9V18azI9IKNFOCPdyjhoMCfb3Hi MdUgI563ajbPd2qA89pZLO7KZULDgdI= Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-518-Kc3ykUwmMc6fjPBKZqPOYQ-1; Fri, 11 Aug 2023 16:51:35 -0400 X-MC-Unique: Kc3ykUwmMc6fjPBKZqPOYQ-1 Received: by mail-qt1-f198.google.com with SMTP id d75a77b69052e-40fd6d83c21so6168481cf.1 for ; Fri, 11 Aug 2023 13:51:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691787095; x=1692391895; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=T8aVoixM0xxO+gfsUyyhZDp4bChNMHCVGjLRMPROvP8=; b=KPx80vM/HkwGLITOLaevp5SwRdKnOdtG1PsN54KlBGPgIjBo0lJZqFrs60eGsJ0ECh iEICmMfxM+gDEByh2JRinUmIBuD9G4nWXD7brQFMSp1q/x0qLiIR61jQ0JCpaw5yex+N VDFsRc1ogqGJ6+UlwuSXQ80zBfK3In1blTKgJ9CcjOjdyOxfxnHsrvb+B8Lk1pJWx7X7 oBMiUdSh8YM40Gw7dZmTrmxpJw+Ibj184gOLYMwYNK7YJoI04Nt4k2I+mM1ddRPPQly2 6eDSkfGdjqF13P3nSDbX202Xm6p32tnimm8iyzII4FOTdcEXckF1qPS8aF0NaqahJhZV ZHOQ== X-Gm-Message-State: AOJu0YwA5hjjPZ+kpvV7Jlh4KKwztt8+qJGapCC+gq23z3J8wBTHIGFz +n+Mb7w2gukfD4q+x8EPdsi9Rrg0UWe9EquQ8LpT0dzgUXimo/b0TVDhrQChjYn5vK0ARKKq3Jm Uc7JKVbTm6DUjlFN2ZOh80ler X-Received: by 2002:a05:6214:3002:b0:63f:7d29:1697 with SMTP id ke2-20020a056214300200b0063f7d291697mr3548988qvb.2.1691787094955; Fri, 11 Aug 2023 13:51:34 -0700 (PDT) X-Received: by 2002:a05:6214:3002:b0:63f:7d29:1697 with SMTP id ke2-20020a056214300200b0063f7d291697mr3548975qvb.2.1691787094629; Fri, 11 Aug 2023 13:51:34 -0700 (PDT) Received: from x1n (cpe5c7695f3aee0-cm5c7695f3aede.cpe.net.cable.rogers.com. [99.254.144.39]) by smtp.gmail.com with ESMTPSA id f8-20020a0caa88000000b00637873ff0f3sm1479316qvb.15.2023.08.11.13.51.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Aug 2023 13:51:32 -0700 (PDT) Date: Fri, 11 Aug 2023 16:51:30 -0400 From: Peter Xu To: Axel Rasmussen Cc: Alexander Viro , Andrew Morton , Brian Geffon , Christian Brauner , David Hildenbrand , Gaosheng Cui , Huang Ying , Hugh Dickins , James Houghton , Jiaqi Yan , Jonathan Corbet , Kefeng Wang , "Liam R. Howlett" , Miaohe Lin , Mike Kravetz , "Mike Rapoport (IBM)" , Muchun Song , Nadav Amit , Naoya Horiguchi , Ryan Roberts , Shuah Khan , Steven Barrett , Suleiman Souhlal , Suren Baghdasaryan , "T.J. Alumbaugh" , Yu Zhao , ZhangPeng , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH mm-unstable fix] mm: userfaultfd: check for start + len overflow in validate_range: fix Message-ID: References: <20230810192128.1855570-1-axelrasmussen@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20230810192128.1855570-1-axelrasmussen@google.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE 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 Thu, Aug 10, 2023 at 12:21:28PM -0700, Axel Rasmussen wrote: > A previous fixup to this commit fixed one issue, but introduced another: > we're now overly strict when validating the src address for UFFDIO_COPY. > > Most of the validation in validate_range is useful to apply to src as > well as dst, but page alignment is only a requirement for dst, not src. > So, split the function up so src can use an "unaligned" variant, while > still allowing us to share the majority of the code between the > different cases. > > Reported-by: Ryan Roberts > Closes: https://lore.kernel.org/linux-mm/8fbb5965-28f7-4e9a-ac04-1406ed8fc2d4@arm.com/T/#t > Signed-off-by: Axel Rasmussen Acked-by: Peter Xu -- Peter Xu