From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 C76172E265A for ; Mon, 12 Jan 2026 16:40:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.92.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768236010; cv=none; b=nj5D6OJDOvlmxrrDq84rTndV0bpdIFH33T3lCAwu5x1hYeuJEfkYAC82p5iCBYI78LwlBVaowJpciK1p/XbC51yO9sWmzhnRowRMfTTJvb+ykY68wt/E6DwJXMEni9ySP84X5K2WNDtCpEXI3luqmcmAimfkRphKp/bSu9hRo0s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768236010; c=relaxed/simple; bh=ZYvx/IvJRN7RGuFFhIfo9zsAS/O3BTbz11LHgDnWYNY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=n5lx4zo6MEgtE14PDa8e92J9yJXu34J/PDNIGQSewXGBDt43+nkigzp0+OEDWA1KtUwM1oggaoF5TIAuWiQtXSr9VJ/SFSrBWDPbi/v+PUgFNZfqxbukZpK3Z2+L8lF9RXPffJXFB3b9v7HB8E6ciyCvG4xUTdbOTLs9FOvifdY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=PeZK9FMW; arc=none smtp.client-ip=90.155.92.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="PeZK9FMW" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=xryPhtiqMR4mpXgTFwQobC3M1skhbymsO8j1lvQpl/Y=; b=PeZK9FMWzXtV+xXZERXEEEn5mU 3DIg2ak6Ru59/n8UkMDTR4KStLQbASLjkQ16UGrXX6JvIxMhs0pZJruCKfQSWpGeJF3rjGZuoESP/ kIPq5EUnAxXloPwZQnwHXJ+NA3N8DD5nRPNp9EzYUIy4YaQlBT5uQsPH8Jk+Pl8tZkEcnsOr/yKZQ t/tipYori0duBnWJ0fU2YXyWLtBtqJrstc9TwoI7pIv30hAlI6TVIWtdp+InwtD5nOhSM5Swo7GMC DdgdSLUaTcDBlpfD42KSWwnMl5UnBgfZyE5Pn/WHfOot+9sUHB4Lxzc8/hRbN66+xGijz+3+u8rTH 1jXd9YCQ==; Received: from 77-249-17-252.cable.dynamic.v4.ziggo.nl ([77.249.17.252] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1vfKxW-00000001BdU-0ZZ6; Mon, 12 Jan 2026 16:40:02 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 9A2A2302D3E; Mon, 12 Jan 2026 17:40:01 +0100 (CET) Date: Mon, 12 Jan 2026 17:40:01 +0100 From: Peter Zijlstra To: Oleg Nesterov Cc: Andrii Nakryiko , Borislav Petkov , Dave Hansen , David Hildenbrand , "H. Peter Anvin" , Ingo Molnar , Jiri Olsa , Masami Hiramatsu , Paulo Andrade , Thomas Gleixner , linux-kernel@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH] x86/uprobes: Fix XOL allocation failure for 32-bit tasks Message-ID: <20260112164001.GQ830755@noisy.programming.kicks-ass.net> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Sun, Jan 11, 2026 at 04:00:37PM +0100, Oleg Nesterov wrote: > This script > > #!/usr/bin/bash > > echo 0 > /proc/sys/kernel/randomize_va_space > > echo 'void main(void) {}' > TEST.c > > # -fcf-protection to ensure that the 1st endbr32 insn can't be emulated > gcc -m32 -fcf-protection=branch TEST.c -o test > > bpftrace -e 'uprobe:./test:main {}' -c ./test > > "hangs", the probed ./test task enters an endless loop. > > The problem is that with randomize_va_space == 0 > get_unmapped_area(TASK_SIZE - PAGE_SIZE) called by xol_add_vma() can not > just return the "addr == TASK_SIZE - PAGE_SIZE" hint, this addr is used > by the stack vma. > > arch_get_unmapped_area_topdown() doesn't take TIF_ADDR32 into account and > in_32bit_syscall() is false, this leads to info.high_limit > TASK_SIZE. > vm_unmapped_area() happily returns the high address > TASK_SIZE and then > get_unmapped_area() returns -ENOMEM after the "if (addr > TASK_SIZE - len)" > check. > > handle_swbp() doesn't report this failure (probably it should) and silently > restarts the probed insn. Endless loop. > > I think that the right fix should change the x86 get_unmapped_area() paths > to rely on TIF_ADDR32 rather than in_32bit_syscall(). Note also that if > CONFIG_X86_X32_ABI=y, in_x32_syscall() falsely returns true in this case > because ->orig_ax = -1. > > But we need a simple fix for -stable, so this patch just sets TS_COMPAT if > the probed task is 32-bit to make in_ia32_syscall() true. > > Cc: stable@vger.kernel.org > Reported-by: Paulo Andrade > Link: https://lore.kernel.org/all/aV5uldEvV7pb4RA8@redhat.com/ > Signed-off-by: Oleg Nesterov Does this want a Fixes tag? Or has this been busted like forever?