From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-23.2 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1B07C432BE for ; Mon, 2 Aug 2021 20:11:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 82CE261051 for ; Mon, 2 Aug 2021 20:11:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231465AbhHBULK (ORCPT ); Mon, 2 Aug 2021 16:11:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231357AbhHBULI (ORCPT ); Mon, 2 Aug 2021 16:11:08 -0400 Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EF4AC06175F for ; Mon, 2 Aug 2021 13:10:59 -0700 (PDT) Received: by mail-io1-xd2c.google.com with SMTP id 185so21736801iou.10 for ; Mon, 02 Aug 2021 13:10:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7JjQd+ZR7FC88NvaO1/ik1OCoriiWj0SLnlnN+EI6+8=; b=Ywy6YSPDF52dLo6oCY5yw62rQn3QAGehVNzZ6Dv5DUDeIKKP92UUQMDs8CtPL3DiJE 1OefmpRqTUy2v0i+OjdR8oZzMg4nynlv5vAj5zU5UTqYK+LOVP879lP4OgXBf1HRHyTb wRdcZGFEXh59XgJTvMCpApDLIgiAGWfm6ke6p74FuSBJTpCI3GZILGpVFdH3JYVE85Q5 ZxXmdpQ+aUkvo7nhN0KIamvaJ88+5VGe1ycZtK0Ryi+litocRaf+THOt43sEpqEh9MHX O/azej0FQFGlnTyXYL4bF3WjwHs/L5jx0++1/bn7zm90xoaGqaqgpY8hWouHTvTgbeei SOtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7JjQd+ZR7FC88NvaO1/ik1OCoriiWj0SLnlnN+EI6+8=; b=srZsgyJXmOr8v2utmz3RtG0e2fd7yyLQOAl46v8NEQ02VL/t/0F9z9+3+F/Pye3dhW eoRrGxD5msB7jsZiEew1GXs94JHRymqyajkbD2rDWjILmIYXOxe8HRKLTI7KOeBMgT4Z OofzC56f37SAyJkUnme8LgB+nPmZYVc4DaL6KrspiOBz0qH8qeKQpQlyHuGukyucVMCZ i16oIlMAWPpAUC4trG2fw6a09pGMwPC1KTKqCDBlZkbxv0bp8w6tUnX+uqqwxqFtFT7x Fxe4mEhIRRid6hGdH4n9JK16o9q27uwLTSlb1qRyw0LvbqkNgyJyjXEcaBg1NBQbgyN+ ExRw== X-Gm-Message-State: AOAM531Lk0dbPEO4E1omUjSWbJBFIBQbRyoyQ/y0qWqMuZKRRnkxXkaE 2oaTXyy0cIWeUWzDew/vn2w2mh1AcCV4GG+XYvRqtw== X-Google-Smtp-Source: ABdhPJz9KoWJcLNs4XLiWG7XBcXDfyud1ryml8h+jHng7dNSa3OM43gzesT4vPjQfdkKmf49a+ZVhPYPExOqvjEyZE4= X-Received: by 2002:a05:6638:35a8:: with SMTP id v40mr16688614jal.126.1627935058394; Mon, 02 Aug 2021 13:10:58 -0700 (PDT) MIME-Version: 1.0 References: <20210726153846.245305071@linuxfoundation.org> <20210726153852.445207631@linuxfoundation.org> In-Reply-To: From: Peter Collingbourne Date: Mon, 2 Aug 2021 13:10:47 -0700 Message-ID: Subject: Re: [PATCH 5.13 191/223] selftest: use mmap instead of posix_memalign to allocate memory To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Lokesh Gidra , Catalin Marinas , Vincenzo Frascino , Dave Martin , Will Deacon , Andrea Arcangeli , Alistair Delva , William McVicker , Evgenii Stepanov , Mitch Phillips , Andrey Konovalov , Andrew Morton , Linus Torvalds , donnyxia@google.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 29, 2021 at 9:38 PM Greg Kroah-Hartman wrote: > > On Thu, Jul 29, 2021 at 10:58:11AM -0700, Peter Collingbourne wrote: > > On Mon, Jul 26, 2021 at 9:16 AM Greg Kroah-Hartman > > wrote: > > > > > > From: Peter Collingbourne > > > > > > commit 0db282ba2c12c1515d490d14a1ff696643ab0f1b upstream. > > > > > > This test passes pointers obtained from anon_allocate_area to the > > > userfaultfd and mremap APIs. This causes a problem if the system > > > allocator returns tagged pointers because with the tagged address ABI > > > the kernel rejects tagged addresses passed to these APIs, which would > > > end up causing the test to fail. To make this test compatible with such > > > system allocators, stop using the system allocator to allocate memory in > > > anon_allocate_area, and instead just use mmap. > > > > > > Link: https://lkml.kernel.org/r/20210714195437.118982-3-pcc@google.com > > > Link: https://linux-review.googlesource.com/id/Icac91064fcd923f77a83e8e133f8631c5b8fc241 > > > Fixes: c47174fc362a ("userfaultfd: selftest") > > > Co-developed-by: Lokesh Gidra > > > Signed-off-by: Lokesh Gidra > > > Signed-off-by: Peter Collingbourne > > > Reviewed-by: Catalin Marinas > > > Cc: Vincenzo Frascino > > > Cc: Dave Martin > > > Cc: Will Deacon > > > Cc: Andrea Arcangeli > > > Cc: Alistair Delva > > > Cc: William McVicker > > > Cc: Evgenii Stepanov > > > Cc: Mitch Phillips > > > Cc: Andrey Konovalov > > > Cc: [5.4] > > > Signed-off-by: Andrew Morton > > > Signed-off-by: Linus Torvalds > > > Signed-off-by: Greg Kroah-Hartman > > > --- > > > tools/testing/selftests/vm/userfaultfd.c | 6 ++++-- > > > 1 file changed, 4 insertions(+), 2 deletions(-) > > > > > > --- a/tools/testing/selftests/vm/userfaultfd.c > > > +++ b/tools/testing/selftests/vm/userfaultfd.c > > > @@ -197,8 +197,10 @@ static int anon_release_pages(char *rel_ > > > > > > static void anon_allocate_area(void **alloc_area) > > > { > > > - if (posix_memalign(alloc_area, page_size, nr_pages * page_size)) { > > > - fprintf(stderr, "out of memory\n"); > > > + *alloc_area = mmap(NULL, nr_pages * page_size, PROT_READ | PROT_WRITE, > > > + MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); > > > + if (*alloc_area == MAP_FAILED) > > > > Hi Greg, > > > > It looks like your backport of this patch (and the backports to stable > > kernels) are missing a left brace here. > > Already fixed up in the latest -rc releases, right? It looks like you fixed it on linux-4.19.y and linux-5.4.y, but not linux-4.14.y, linux-5.10.y or linux-5.13.y. Peter