From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F089547799D for ; Wed, 6 May 2026 13:25:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778073913; cv=none; b=msCuCCSRtUB9HQvU9ioFVN3nDFdkkLUM8BSFfseKScDlkuLn7Unkmy28gofzlAl8h9VW/KvG1N+lPj6s46GL22OYeTwq4m58OkZ3ei13x3ir3Q1PrvNLqdJbCcYAkIz/0gnjTfNVtvCj4Ce02PQ9ZTFAWiTBBAroXo4/ZBBoeq0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778073913; c=relaxed/simple; bh=gg4sYVQ40vjb+sx/0DmPlD/9Oei5/5UhG7b05Qwyg6g=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=ncEVUYJMq501pLX40MrA7liaNJqAmV0C3rTwEcaXZksTvgdsVq9thzEgkxU5UtYvKsUwckB/YLk5/SGBhRXmirqjyl+WQw7MHys2+f/9P3Gr6j4Xmkdt1fC5qgZ0dgKSXJVWPqoqaehj28BikbYCZexmNh9foFHzyHHmp5VFT1o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=fhbz2Wbc; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=hy9LysJ5; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="fhbz2Wbc"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="hy9LysJ5" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1778073909; 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=KtQpZV0D6UvRwNAoekpjuTxrL3V+P/+4gLCtI9n3lvs=; b=fhbz2WbcSycAEZ+Sr2gzEbY8Fb12EGVM4CsrRdno5oKvMsHtyF/KSTXo0j/PwUw5tg+U6t 6yU3gP5f6yYm5GYyuzAf6vr5ckG6KOKZik+FXOVdyqjXEAGuQNHwCuVRQDKNd6SJEpuwVt HrmlUhEZrq1sCXNLzDvcr+HojhYdV9k= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-450-eOPXhBZ5OGegkUwiKNworw-1; Wed, 06 May 2026 09:25:07 -0400 X-MC-Unique: eOPXhBZ5OGegkUwiKNworw-1 X-Mimecast-MFC-AGG-ID: eOPXhBZ5OGegkUwiKNworw_1778073906 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-44d83e45febso760060f8f.0 for ; Wed, 06 May 2026 06:25:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1778073905; x=1778678705; darn=vger.kernel.org; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=KtQpZV0D6UvRwNAoekpjuTxrL3V+P/+4gLCtI9n3lvs=; b=hy9LysJ5MXtehAgcSC3lsQBt8lS1qDVuAfOp+PtMImklGpnnANWqoBTzz4Tdx4e7W0 5w9Zale/S2h+x/3R/Hip1+j8xxgDv3AXios2ZqaduHhxw3+e8IHc6JKDevK1NxzKdyXz g1zCe4rD1/UNzH/aiAirWkWw/tmKlGSPt+qLdtrwwRC355FfE9xIA/pOHbjMgw/dAKwz lex8K3zGvufMTXpOkt05vIqgjaxeTNIIf9m+CF/VLf+tig/0ml6XzZwcyLMLzSGcmyBB v6dgd5tna+gW5lZYs6Ek90lINyX07w3CDP6L0u+h7cVxuEydaisIMAls9pi/20wlfexs gTJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778073905; x=1778678705; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=KtQpZV0D6UvRwNAoekpjuTxrL3V+P/+4gLCtI9n3lvs=; b=AQiYfhKFVVz1agHsqg4u9g2ljy3mrxaYQW43R8I5VovgrOebJoj7SnZTwR5buF68G3 IPcRKPgkdMToe7NFMEL+Zw50ZVs899dUZQpcW1Sf10qBU/x5z+A4zBRE87bi78XSCGdX RQQ7SgqtdLwKhqNLNxL7coDXnhpPZSxvrIiIFCcOpyfWBEbIClBBkaXfZS5S0ev4IdiE Eab//Z/NVJ+rF/zyssWbYPBrYCaDWRZFAjMo9TmBJLRoydL/NzW20s2URmCUFZpE/N/J BLKzlpsZwy5tobp9gu7bja0I/QeX4DvdWVPur+ozaJwLOC47c2jYlaW1NJMoQyiHxCrz cWHw== X-Gm-Message-State: AOJu0YzI/l6ybMUiTSWhIYnChF1F86AEHrsBvVnwQL7jVHag6zOk1QWT M8QY23eu+NG189xOmX/Ub2jvf54WqzoBsDsuOgYr0GFkqb8fOm8IJRTQGBGtctEwwweNHKB5X/u GHCFcDE0001etds5caFbS15k+gilsqzzcmrdqB5xIYkC0x8t06ltnyFUgx+1hQRDSN6hnGuFOST qg X-Gm-Gg: AeBDieuMDRB8xRnN70OyXDC6DnSuSTOHNVOSmoUspgqfP8JGtWbom+06Ta1Wnyu2SC+ TFXHhK8VGsQuaz4OYBzvFikTNuIf0rohH1vUtgr+sHzvcVkJdXwBYZk8neuqrv5nciaNFSjykiz o/i4dTpH4JYwUquMmbsPnThYBuXQMXX8XvWauK9aYzjOy3ajSGZeAbqWsJcMPzZUEAMVzBxnEmM kAvT9fP+SJSg8SCs4ALZdWseb/oycoblZaDubfR1rZ46eo0aB3wItxw9kkjxhYbZu0kdBeQ+RaU yScnx0lRceKMV1D53P9UkZOXYHo6NIQvU876/39S99M9lA8hOgCByqM6OTolIXQGGTjiMHTnvbk tMPM/YE+padInB848TZKm0IAbRjsZQGQYwNigGDfqSliwn04h6LsMe4lFBmsrYdzJBsWVfK88lS 2JFULG2nu8EVbIRDpD8Q== X-Received: by 2002:a05:600c:4b1a:b0:488:8be1:ca3a with SMTP id 5b1f17b1804b1-48d142726f3mr91806655e9.15.1778073905435; Wed, 06 May 2026 06:25:05 -0700 (PDT) X-Received: by 2002:a05:600c:4b1a:b0:488:8be1:ca3a with SMTP id 5b1f17b1804b1-48d142726f3mr91806175e9.15.1778073905032; Wed, 06 May 2026 06:25:05 -0700 (PDT) Received: from vschneid-thinkpadt14sgen2i.remote.csb (213-44-135-146.abo.bbox.fr. [213.44.135.146]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-45054b03e04sm12787510f8f.21.2026.05.06.06.25.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 May 2026 06:25:04 -0700 (PDT) From: Valentin Schneider To: Waiman Long , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , K Prateek Nayak , Frederic Weisbecker , Mike Rapoport Cc: linux-kernel@vger.kernel.org, Waiman Long Subject: Re: [PATCH] sched/isolation: Don't free memblock allocated cpumasks In-Reply-To: <20260505051821.1107133-1-longman@redhat.com> References: <20260505051821.1107133-1-longman@redhat.com> Date: Wed, 06 May 2026 15:25:02 +0200 Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On 05/05/26 01:18, Waiman Long wrote: > When testing a v7.1 kernel with commit 59bd1d914bb5 ("memblock: warn when > freeing reserved memory before memory map is initialized"), the following > warning was hit when there was a "nohz_full" kernel boot parameter. > > [ 0.080911] Cannot free reserved memory because of deferred initialization of the memory map > [ 0.080911] WARNING: mm/memblock.c:904 at __free_reserved_area+0xde/0xf0, CPU#0: swapper/0/0 > : > [ 0.080945] Call Trace: > [ 0.080947] > [ 0.080949] memblock_phys_free+0xcb/0x100 > [ 0.080953] housekeeping_init+0x14c/0x170 > [ 0.080957] start_kernel+0x207/0x450 > [ 0.080961] x86_64_start_reservations+0x24/0x30 > [ 0.080965] x86_64_start_kernel+0xda/0xe0 > [ 0.080967] common_startup_64+0x13e/0x141 > [ 0.080972] > > The commit states that freeing of reserved memory before the memory > map is fully initialized in deferred_init_memmap() would cause access > to uninitialized struct pages and may crash when accessing spurious > list pointers. However, if the memblock_free() call is deferred to > the start of initcall processing in the bootup process, for instance, > the following KASAN warning can appear. > > [ 8.514775] BUG: KASAN: use-after-free in memblock_isolate_range+0x4ac/0x650 > [ 8.514775] Read of size 8 at addr ffff88a07fe6a000 by task swapper/0/1 > : > [ 8.514775] Call Trace: > [ 8.514775] > [ 8.514775] kasan_report+0xb2/0x1b0 > [ 8.514775] memblock_isolate_range+0x4ac/0x650 > [ 8.514775] memblock_phys_free+0xc4/0x190 > [ 8.514775] housekeeping_late_init+0x257/0x280 > [ 8.514775] do_one_initcall+0xaa/0x470 > [ 8.514775] do_initcalls+0x1b4/0x1f0 > [ 8.514775] kernel_init_freeable+0x4b5/0x550 > [ 8.514775] kernel_init+0x1c/0x150 > [ 8.514775] ret_from_fork+0x5dc/0x8e0 > [ 8.514775] ret_from_fork_asm+0x1a/0x30 > [ 8.514775] > Darn, I just saw the previous version doing this. > It is likely that memblock_discard() may discard memblock data needed > for memblock_free(). One workaround for now to avoid these warning/bug > messages is to keep the memblock allocated cpumasks even if they are > no longer needed until the memblock subsystem is properly updated to > handle memblock_free(). Pardon my ignorance, but how come this isn't the case for the other memblock users? It sounds like there is no right place for freeing this mask.