Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2229749rdb; Sun, 11 Feb 2024 18:48:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IE3HfzBRFt8hah6etcgs5AX7gxbcpq7JgZ4TSB04+hGTN0OCs6HJwxXzEvH1gX7KqxuMuiQ X-Received: by 2002:a05:620a:4724:b0:785:db10:6caf with SMTP id bs36-20020a05620a472400b00785db106cafmr65769qkb.69.1707706128857; Sun, 11 Feb 2024 18:48:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707706128; cv=pass; d=google.com; s=arc-20160816; b=SM2u65c+ODUukdfqXXZE/K3C7EUxQdTIKW2xVKlXyZ7jpoFtNArym3Z6LGWJDA/0sA bF6xQLlkGfSt9djpcGp2OmpNmzFDXrWglmrpVjQBTfhNXA5UVaUJedcLHDNFDAr60WOu ZB3x6GO0FPqkw5VZP8N+fiaa0auRGp65VgicCDStIWwGGgG5XWKF3oWkc/JTkwILAjUR Jc7NB+7hBlz91OoGpLeTDjUZEVSh3+VvbV0GuZ52GO+wzpBxN8ZfJs+2YqwcilZ9jmMd BjJZ9VbYUSq63nGuiRbhM22lbrlN/hB11nntSBlAa4WhzEOMa4X85fa0rBBQ+zVr9vzO qxeA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=TycaA2s/zS0gTstZA7vOH1giU+ckDkRTNXdU1ggjDeY=; fh=shGwkCdZdlP0THyGHMmt+HjEjfKCROkz0Hezk1q74xI=; b=Ovi6+LLcbrJDOMD/Yz04OUsPIQe024CSqlniy+tznmsLEtmw4ZHp82zEqe/By1JLII xGsp7kNNpEBYJt0QUOOzmORpNb+Tl2nh2G1h/Mqq5PhXnIZYq2VvAmrrQlicIO93kMuy dAcoWEj0/cIsCDFEH2K9WiPMuPCTk27z2InE8u9R5CazGG60HwiqTe0AUgCYoUsbK68M fzJupBxLXQeGw5+7vbuwM4EqfrV4WDKc89+6ypGmeyEAmxaNe3J0doS9CTBOCfRice9h CH/eV/Mr4jatsIm1QWeeSogNNd3sI+77s2iFau1buPS3/oMuMGSSnABllAJ/iCYRWkbc NvYg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hHBci7tk; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-61071-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61071-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com X-Forwarded-Encrypted: i=2; AJvYcCXx6UKZHlQBz5pQHvDmV1vYg3juUsCk+iAgpRKIBbV/Uh4bpBozRPpVYPR3AtzbhObIu4ClPXlt8GZwbIC5FtqXiaqga+nTzcv66OYoIA== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id f19-20020a05620a12f300b00785d30094d7si2030177qkl.539.2024.02.11.18.48.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 18:48:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61071-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hHBci7tk; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-61071-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61071-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 981931C21B28 for ; Mon, 12 Feb 2024 02:48:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4D57C2F5B; Mon, 12 Feb 2024 02:48:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hHBci7tk" Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1546F110A for ; Mon, 12 Feb 2024 02:48:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707706121; cv=none; b=GV0ktqzodszklWSC5QMLJo/yxuPsyqCIJhrzXyRaIP2A3e2DVRt0rW9+jOw3KbaGp4vnzV+N/1DxgsbFW/vP3LX8YW1rhnTPzwBus/cbbns3JL6SHUwU4wnP0YR55b5sfB6N6AKPo7F7fp+7C9Wf9YUdhZHQupMaoQg/BHLq83o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707706121; c=relaxed/simple; bh=U1S5brLivRdEEProPUBEd2oRg+SgT4UBofe4mfVB4Ak=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=EQAt2h5087Eu5I5D06hjlniJabJDvmsiDHjLk/uIAnXZSTXoq+YnjWAiWFnRxi0dCcNpqleWWIXW3RaWpUuX4oVi4x4/NIwYwfhE8DSEZn9c/T7lQeZHQM4FSfYrGgIP8TtvMEzhfqA3r5VdhMWewbwHBkGCuxg5YO0PyG6Eu1E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=hHBci7tk; arc=none smtp.client-ip=209.85.214.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-1d73066880eso25580535ad.3 for ; Sun, 11 Feb 2024 18:48:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707706117; x=1708310917; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=TycaA2s/zS0gTstZA7vOH1giU+ckDkRTNXdU1ggjDeY=; b=hHBci7tkMmOSC+suRt56+KRdPUQpsZ71kqDN0vgzeBU8VPrTY5dxx70I83H8wj8MLv zlFMLAyQul8kMLPFl6821jFuEdrwmxuysABNAvFX8tjz2skU71eFpRXgp5Zhtk9Noh+1 AxOZ+ATWO/9cYwtoOt3TMie8Zys9WmxJciE4yIPGcLv4cEp9iRzOOIejqi0PG0+SxC/c 7xROwPr7aamyKbPR9IUDcWBAy4IsUvu3wvaqkBSiO+SsI3D8pcqxGdkr5hrjLka2JbuL Ni14+gQlahu0Da1N2aBePOSjMa7+F5gmbavdSbHIz/cja3o3bk1FwiHUkRhq+anhnPaD G2WQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707706117; x=1708310917; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=TycaA2s/zS0gTstZA7vOH1giU+ckDkRTNXdU1ggjDeY=; b=ANNczOezKgTqaKlYnELX1F9oFp1RupdsVEhWzbrAKTNG6x1sOEUVlWJ91a5vQm5nGe dcWwBT6hXqFCQI7colWzS+yGh7h0dnKh3s0eNYalq3R9a0DEXGxG4fKiL3qfmgOUAtba KrIfASIx/pODS+VpBnoQ6+sEEWUVbVfXSbKDln1FagE5zBJ+hxgn9Mr+nzgwTTGznvdJ yEiG7M6LFa2ifHGch2Q2ZLozVG4ZrvQ9ScjcUA7XYIDmCPoo8mlOxCb3lNVUqGq/9J+w faDExhwfvXHLCo/z4YNZs7ksax+aznF3Vft68+LCAR1Oz9jaBSBr6VAcC0o8XsHf46BZ aXig== X-Gm-Message-State: AOJu0Yx4Z33Jy+m0tLMqjlIFafScppuJrVIHy0Gj8W7LQ23ri+G39U0l nMGBK2gO3cLod85833O8+qrF2NVXs122FVzfncm4o3hqdZG6vEcO X-Received: by 2002:a17:902:eb4c:b0:1d9:8fc6:35 with SMTP id i12-20020a170902eb4c00b001d98fc60035mr5938675pli.15.1707706117325; Sun, 11 Feb 2024 18:48:37 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWbMteimK3jECQI8TCvE347ioF55OHhPY12zmjCDQTENLuwFXLF+w8ATj5h58C5d0drGaBd6OpbR29ldvF9D7zYy4x9dHze/6w7zZKMKez6+voOTOl05gNZtiGfsCB3eSFJpVdNcYmmPXwtBpe6SnAk08wq7p4dAOHrVm9dVCB2jjxR5lQfAooXwnByuU81Q0ydLfSRYWmO80lHWyUTsE5Rbt6D1kHYP4hmDzrusVwSDC9MP/NB9YaFy6jp8vqlL+ZrRe2xyR6vEghWZo5rqxEzxDjS1iBo1LiE2eSySCN0UGqoGhvWVrcYyQwj Received: from [192.168.0.106] ([103.131.18.64]) by smtp.gmail.com with ESMTPSA id a1-20020a170902ee8100b001d94c709738sm4845827pld.217.2024.02.11.18.48.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 11 Feb 2024 18:48:37 -0800 (PST) Message-ID: Date: Mon, 12 Feb 2024 09:48:30 +0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: arch/x86/kernel/sys_x86_64.c: rationale for 0x40000000 for MAP_32BIT's start address? Content-Language: en-US From: Bagas Sanjaya To: hapter@420blaze.it, mingo@redhat.com Cc: tglx@linutronix.de, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, Andi Kleen , Andrew Morton , Linux Kernel Mailing List , Linux Memory Management List References: In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 2/12/24 09:43, Bagas Sanjaya wrote: > On Sun, Feb 11, 2024 at 08:52:45AM +0000, hapter@420blaze.it wrote: >> I've found that passing in MAP_32BIT for mmap() will always return an >> address above 0x40000000. The problem seems to lie in > From one gigabyte up? >> arch/x86/kernek/sys_x86_64.c, where the following comment is the only thing >> close to a hint(Line 100): >> >> /* This is usually used needed to map code in small >> model, so it needs to be in the first 31bit. Limit >> it to that. This means we need to move the >> unmapped base down for this case. This can give >> conflicts with the heap, but we assume that glibc >> malloc knows how to fall back to mmap. Give it 1GB >> of playground for now. -AK */ >> >> Unfortunately this does not supply a rationale for starting from 0x40000000, >> which seems very arbitrary, and the git commit has been there since the >> beginning of time (i.e. as far the the git history goes), so the git blame >> has not helped much to clarify it. I was also not able to find who "AK" was. > > That was from commit 717db2f9f36805 ("[PATCH] x86-64 updates for 2.5.54") > in tglx/history.git repo [1], authored by Andi Kleen. Cc'ing him. > [1]: https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git/commit/arch/x86_64/kernel/sys_x86_64.c?id=717db2f9f36805d85c695771ea7d712812896aa7 -- An old man doll... just what I always wanted! - Clara