Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp5019662rwb; Mon, 31 Jul 2023 16:55:25 -0700 (PDT) X-Google-Smtp-Source: APBJJlH80PucKXIksjjt5LkqMp6vRAoexhpQcfG2yDPbN8m8/1jr0r6oR74SDZU+O0ULLffPfHZa X-Received: by 2002:a17:902:be0b:b0:1bb:598a:14e5 with SMTP id r11-20020a170902be0b00b001bb598a14e5mr10225054pls.43.1690847725087; Mon, 31 Jul 2023 16:55:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690847725; cv=none; d=google.com; s=arc-20160816; b=ZzSQwuCV0A75123Vy1DLbV0QcN6GP4bw5EYhMLyRzOHrDdzyqnd5+Oe/j/KDuszbUS VHzv1tKA3EjkhFxgsxdiz/bSkWtGK2xe7JCIAcNr/m7PFsnS7YdYqKV5w4XrXHWug0cr QAUvRIWny/vXDv6+OktTwXwBTX3k7sZKLE6oWTF8Mu5yinC7Fwwz7IC7J1xgXZQALuAR Zbb0SZwQi0D8g49O0miqlNy+cs+rQmqoyMTvk9IMzmvoXMMPMxYZEycJoeUS70qrsavZ zVLQFdYirdZ7an2YKDq3DjirV8a2ZyggZVxwndxqD3M1AQi4RYE/9tNfBHKo+6O0AKxQ qnNg== 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:date:from:dkim-signature; bh=mfZo16Tt9kvpNfsLlO4ki6ZdRkbvVDogdV8NnQudSyc=; fh=fbR5/AJqsawjhC/tAcR2KXw1wIHFUyw3XUvRcKV59Fw=; b=ICWLgwjfebjWVqzDIbub5Gd0ee5P6d4OWjTIDZUaPfJGFZcn+umQIR/IF/vra1xVW4 wOZZcLdD8dzsp85IM4c03NYQ3EWkn+FRy2AHbf+PhUKnAfmGk0iEAegkwX5AAJCfI1LY naHo7im/Tn2kj9thrUv7IHEdVaZY/ydbOfuu3oal2uGG2il/wbEE8POBP2VARs/n5UJg ppk/JgxIdfNu2u/Squc3vTM/tyQpoqn0y0fFkxvshL9DQfDoi8iAbtvy5v6OFj6iSPSw U4pWx8lbWn0B45DI8yEZIzvLSJvq1rO54Mx0QdTKVfe+B5II9EaMIcoBil474UHZZvp5 2Jhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=KPdLIRgb; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m13-20020a170902d18d00b001bb9e3bae96si3915305plb.255.2023.07.31.16.55.13; Mon, 31 Jul 2023 16:55:25 -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=@gmail.com header.s=20221208 header.b=KPdLIRgb; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231592AbjGaVun (ORCPT + 99 others); Mon, 31 Jul 2023 17:50:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231520AbjGaVu3 (ORCPT ); Mon, 31 Jul 2023 17:50:29 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3527B1718; Mon, 31 Jul 2023 14:50:26 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3fe1d462762so14920735e9.0; Mon, 31 Jul 2023 14:50:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690840224; x=1691445024; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:from:to:cc:subject:date:message-id:reply-to; bh=mfZo16Tt9kvpNfsLlO4ki6ZdRkbvVDogdV8NnQudSyc=; b=KPdLIRgbDvS/UkjfhhaOrpJGjubdJRib5xeU+gS66Y5Otf5FZZ30bopbJn7HJ8i1Qe Kv1HCyAtQdna5OHQ/GhvjvBrU+aI93TDBV7vftufjYH6/XfRMM55at6Oq3hy+CSgVPd3 ZAKjHu19h4wu4alrJrHUHbxEPs8yyNhwm/U/LEaCwU7i0aSgSToKHS/FwFDSkA2C1yFx zRpywd9CgIuJAqESFCHjWp8FaxIZL65RiVMnsyPdAWNCtOyhCX3vzcwKEb7oBieiLbOT k17vv2O2dkvW+iqwTjdMCrgZlj3G6m4QiVAnkbyScauCspmoz/V762dUV72akBEWJHkC 8VAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690840224; x=1691445024; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=mfZo16Tt9kvpNfsLlO4ki6ZdRkbvVDogdV8NnQudSyc=; b=WbE4NV62k71yv7Kug9eDSQxJERB4z6kiT9CfqGc0A648Dbykr7HSVLe1O3BzM62dKT LzjlzXWA/uP/W7VoQC2h6G9Rgq8R3/U7B2frbCzikrzm95oWpGJyEy4CMqc9aPoLkzfI 5Qm2L6AvJ2D6nOxgdb2YVPSI4/Q4jxeASqQ0WRhNvELOq/RzcF982MhahEV5MymD0l2F nb+LVvwPQahw9hN/7dGAN2v3KH7bRl1Bj59zlr7joOM24MnhtCExITz/ZE+PhYuXN0n/ qi9afJw6kNFHTjW7uzEXhiZj74WWT8bjfy+1cgv7ADJshPBG5Oz3sk7FQDZGBVjbyRmt b/zA== X-Gm-Message-State: ABy/qLafdQ1d1g97293Rpo1SBPkFRKfvkwAEFU+HNJYzBrp6PVV6Oz65 VQXNnt6acQa7rG2ftTMA73I= X-Received: by 2002:a1c:f202:0:b0:3f9:b430:199b with SMTP id s2-20020a1cf202000000b003f9b430199bmr909451wmc.15.1690840224278; Mon, 31 Jul 2023 14:50:24 -0700 (PDT) Received: from krava ([83.240.60.220]) by smtp.gmail.com with ESMTPSA id hn8-20020a05600ca38800b003fe29dc0ff2sm118333wmb.21.2023.07.31.14.50.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 14:50:23 -0700 (PDT) From: Jiri Olsa X-Google-Original-From: Jiri Olsa Date: Mon, 31 Jul 2023 23:50:22 +0200 To: Lorenzo Stoakes Cc: Jiri Olsa , David Hildenbrand , Baoquan He , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Andrew Morton , Uladzislau Rezki , Matthew Wilcox , Liu Shixin , Jens Axboe , Alexander Viro Subject: Re: [PATCH v8 1/4] fs/proc/kcore: avoid bounce buffer for ktext data Message-ID: References: <86fd0ccb-f460-651f-8048-1026d905a2d6@redhat.com> <32b8c5e4-c8e3-0244-1b1a-ca33bd44f38a@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Mon, Jul 31, 2023 at 10:12:08PM +0100, Lorenzo Stoakes wrote: > On Mon, Jul 31, 2023 at 10:34:21PM +0200, Jiri Olsa wrote: > > On Mon, Jul 31, 2023 at 08:40:24PM +0100, Lorenzo Stoakes wrote: > > > On Mon, Jul 31, 2023 at 09:24:50PM +0200, David Hildenbrand wrote: > > > > On 31.07.23 21:21, Lorenzo Stoakes wrote: > > > > > On Mon, Jul 24, 2023 at 08:23:55AM +0200, David Hildenbrand wrote: > > > > > > Hi, > > > > > > > > > > > > > > > > > > > > I met this too when I executed below command to trigger a kcore reading. > > > > > > > I wanted to do a simple testing during system running and got this. > > > > > > > > > > > > > > makedumpfile --mem-usage /proc/kcore > > > > > > > > > > > > > > Later I tried your above objdump testing, it corrupted system too. > > > > > > > > > > > > > > > > > > > What do you mean with "corrupted system too" -- did it not only fail to > > > > > > dump the system, but also actually harmed the system? > > > > > > > > > > > > @Lorenzo do you plan on reproduce + fix, or should we consider reverting > > > > > > that change? > > > > > > > > > > > > -- > > > > > > Cheers, > > > > > > > > > > > > David / dhildenb > > > > > > > > > > > > > > > > Apologies I mised this, I have been very busy lately not least with book :) > > > > > > > > > > Concerning, I will take a look as I get a chance. I think the whole series > > > > > would have to be reverted which would be... depressing... as other patches > > > > > in series eliminates the bounce buffer altogether. > > > > > > > > > > > > > I spotted > > > > > > > > https://lkml.kernel.org/r/069dd40aa71e634b414d07039d72467d051fb486.camel@gmx.de > > > > > > > > > > Find that slightly confusing, they talk about just reveritng the patch but then > > > also add a kern_addr_valid()? > > > > > > I'm also confused about people talking about just reverting the patch, as > > > 4c91c07c93bb drops the bounce buffer altogether... presumably they mean > > > reverting both? > > > > > > Clearly this is an arm64 thing (obviously), I have some arm64 hardware let me > > > see if I can repro... > > > > I see the issue on x86 > > Ummmm what? I can't! What repro are you seeing on x86, exactly? # cat /proc/kallsyms | grep ksys_read ffffffff8151e450 T ksys_read # objdump -d --start-address=0xffffffff8151e450 --stop-address=0xffffffff8151e460 /proc/kcore /proc/kcore: file format elf64-x86-64 objdump: Reading section load1 failed because: Bad address jirka > > > > > > > > > Baoquan, Jiri - are you reverting more than just the one commit? And does doing > > > this go from not working -> working? Or from not working (worst case oops) -> > > > error? > > > > yes, I used to revert all 4 patches > > > > I did quick check and had to revert 2 more patches to get clean revert > > > > 38b138abc355 Revert "fs/proc/kcore: avoid bounce buffer for ktext data" > > e2c3b418d365 Revert "fs/proc/kcore: convert read_kcore() to read_kcore_iter()" > > d8bc432cb314 Revert "iov_iter: add copy_page_to_iter_nofault()" > > bf2c6799f68c Revert "iov_iter: Kill ITER_PIPE" > > ccf4b2c5c5ce Revert "mm: vmalloc: convert vread() to vread_iter()" > > de400d383a7e Revert "mm/vmalloc: replace the ternary conditional operator with min()" > > > > jirka > > That's quite a few more reverts and obviously not an acceptable solution here. > > Looking at > https://lore.kernel.org/all/CAA5enKaUYehLZGL3abv4rsS7caoUG-pN9wF3R+qek-DGNZufbA@mail.gmail.com > a parallel thread on this, it looks like the issue is that we are no longer > using a no-fault kernel copy in KCORE_TEXT path and arm64 doesn't map everything > in the text range. > > Solution would be to reinstate the bounce buffer in this case (ugh). Longer term > solution I think would be to create some iterator helper that does no fault > copies from the kernel. > > I will try to come up with a semi-revert that keeps the iterator stuff but > keeps a hideous bounce buffer for the KCORE_TEXT bit with a comment > explaining why...