Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1602377rdb; Wed, 24 Jan 2024 23:55:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IE5qtOSfnvhNhMteP/g9z5nwfvPPNPH2VFXyfD28jY7BARObRlssv0rPEkyq5AZyGDdh59i X-Received: by 2002:aa7:93d1:0:b0:6db:74dc:600b with SMTP id y17-20020aa793d1000000b006db74dc600bmr408470pff.49.1706169345511; Wed, 24 Jan 2024 23:55:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706169345; cv=pass; d=google.com; s=arc-20160816; b=imyKCDwS3asyTBId2JWIRjNL+0lsVAnQzIj2rdZR28ILizfF5fHbReOD758tLFP7oH Yxlq8qK7WOCREbyrj6zmtVLvBBDkNJ2xgZxuiVTWvntDpSrZ72//+8Ilb1IdNhLPG2EK UqUqdDXGpH+5KqGCLDi+8wZrTSDk+FS4XfWWDDEzPzYNOtmItq+FGs3NVsP71kXXRsRy x2Kt/MDUeFG1THHuLCsMFH2Yr8dM7fnVxrr6NaifNE/PldtNf47jZb9nuSy330EAHdMT HJVlFt2FJAOJJmRrtOdEXQNVPqpOF3kXE1HQhfm532hOtwRWMB+f0WdIl+q91r2G0Rhh qzZQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-language:content-transfer-encoding:in-reply-to:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:user-agent:date :message-id:from:references:cc:to:subject; bh=UMDbxq3jf+9EqNgsfHnnGSI8sD1Rgib9GfvR7FCbXDk=; fh=2FB2abfuUyaqClhUJbh9qEUdN3qF/PNXOYtInYLM0Iw=; b=y5Mw8rq6UyIsuOjujic36pRW/TibNyt/gHOnYdPg3d0YxkhvARqEH8HIbq8BrliAlq giYMbSSnBfCMu0JqlmJkI5csK7k8NxAOkS+6WU/MM2RLnRreQmiQ0h+l2nai0m807Vkc US5xGQ1dPZw8JQglE2byVXonfbbPP0qLXNGh6eW4lkn5LLin64EY7tuL1pgPq5+DILNh nM92vCTtvY12JdOtRkgjEsWltXRPERgSi0YqHUdZ2+7fFTrQdvOP9IF16asWN4RRNBz+ coW79B32tA9djGHS0h+KBAH0qEhH7XvqTEe1DSvtk8j0YxyrjLDAoYyXUupUxICwoSRe PPAg== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-38109-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38109-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id i18-20020a63d452000000b005cdf93487basi12923999pgj.585.2024.01.24.23.55.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 23:55:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-38109-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-38109-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38109-linux.lists.archive=gmail.com@vger.kernel.org" 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 2C17D28A7D6 for ; Thu, 25 Jan 2024 07:54:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C490713FF2; Thu, 25 Jan 2024 07:54:33 +0000 (UTC) Received: from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com [45.249.212.56]) (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 C645217727; Thu, 25 Jan 2024 07:54:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706169273; cv=none; b=A6uRMVVBUhPOedCE3oFRkCGtyEYV+0DQ2b0+Gx/5++nEplAVX6tfLmNLx6KH5/9INBK960jlKR69IUV26C8QvnORqVPC6tGQaWwYGXCPPihybd3H4Y1C6XOFBGrSUOpesCUod+jcv/yaengSRr33Ve2AiiHvBxxXx2qnLSEDy4M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706169273; c=relaxed/simple; bh=UMDbxq3jf+9EqNgsfHnnGSI8sD1Rgib9GfvR7FCbXDk=; h=Subject:To:Cc:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=nEL3qu66ESZ1f79y/mMIdc6knUsl+Mrw/8lwrWrJ/lvJAIOL7V1q4j1pe483ptEreHqMfz1t6T1zORhlJhITjDtp0Jp8mVLd8b5CwU69NjoD8eILefHJLet9gOhcBPMUTqBNzjNO7hOobb8W8aOZj7DjGT0ZX+Sp81HUP4jrV44= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.235]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4TLClM333vz4f3kjC; Thu, 25 Jan 2024 15:54:23 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 5E7601A027B; Thu, 25 Jan 2024 15:54:27 +0800 (CST) Received: from [10.174.176.117] (unknown [10.174.176.117]) by APP1 (Coremail) with SMTP id cCh0CgBXJxCtE7JlzoysBw--.1154S2; Thu, 25 Jan 2024 15:54:24 +0800 (CST) Subject: Re: [PATCH bpf 3/3] selftest/bpf: Test the read of vsyscall page under x86-64 To: Sohil Mehta , x86@kernel.org, bpf@vger.kernel.org Cc: Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , linux-kernel@vger.kernel.org, xingwei lee , Jann Horn , houtao1@huawei.com References: <20240119073019.1528573-1-houtao@huaweicloud.com> <20240119073019.1528573-4-houtao@huaweicloud.com> <1c260ab1-d4c0-48e6-bf2b-df69bf083d27@intel.com> From: Hou Tao Message-ID: <01ce6947-8b46-9e27-6ce2-ce5763e3c5a9@huaweicloud.com> Date: Thu, 25 Jan 2024 15:54:21 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <1c260ab1-d4c0-48e6-bf2b-df69bf083d27@intel.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-CM-TRANSID:cCh0CgBXJxCtE7JlzoysBw--.1154S2 X-Coremail-Antispam: 1UD129KBjvdXoWrZF15KF4fCFy5KF1xXrW8WFg_yoWDXrX_u3 9IkFyDJw4xJw17AF43X345uFW2grWDCFy5J39rurW7tryrJasxJwsY9rWruF15GFWIgrs8 GF4Iqa1UKr1Y9jkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbIkYFVCjjxCrM7AC8VAFwI0_Gr0_Xr1l1xkIjI8I6I8E6xAIw20E Y4v20xvaj40_Wr0E3s1l1IIY67AEw4v_Jr0_Jr4l8cAvFVAK0II2c7xJM28CjxkF64kEwV A0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVWDJVCq3wA2z4x0Y4vE2Ix0cI8IcVCY1x02 67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I 0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40E x7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x 0Yz7v_Jr0_Gr1lF7xvr2IY64vIr41lFIxGxcIEc7CjxVA2Y2ka0xkIwI1lc7I2V7IY0VAS 07AlzVAYIcxG8wCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c 02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_ GFylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7 CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6rWUJVWrZr1UMIIF0xvEx4A2jsIE 14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf 9x07UWE__UUUUU= X-CM-SenderInfo: xkrx3t3r6k3tpzhluzxrxghudrp/ On 1/23/2024 8:25 AM, Sohil Mehta wrote: > On 1/18/2024 11:30 PM, Hou Tao wrote: > >> vsyscall page could be disabled by CONFIG_LEGACY_VSYSCALL_NONE or >> vsyscall=none boot cmd-line, but it doesn't affect the reproduce of the >> problem and the returned error codes. >> > With vsyscall=emulate a direct read of the vsyscall address from > userspace is expected to go through. This is mode deprecated so maybe it > wouldn't matter much. Without the fix in patch 2/3, do you see the same > behavior with vsyscall=emulate set in the cmdline? Er, I think it depends on whether or not SMAP [1] feature is available. When SMAP feature is enabled, even the vsyscall page is populated, reading the vsyscall page through bpf_read_kernel() will trigger a page fault and then oops. But when there is not SMAP, bpf_read_kernel() will succeed. So I think the test may need to be skipped if vsyscall_mode is emulate. [1]: https://en.wikipedia.org/wiki/Supervisor_Mode_Access_Prevention > > Sohil