From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBCE8EB64DE for ; Tue, 10 Sep 2024 14:15:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3565E8D0078; Tue, 10 Sep 2024 10:15:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 306E78D0002; Tue, 10 Sep 2024 10:15:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1CDF98D0078; Tue, 10 Sep 2024 10:15:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id F14FA8D0002 for ; Tue, 10 Sep 2024 10:15:34 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id AAFB2A0580 for ; Tue, 10 Sep 2024 14:15:34 +0000 (UTC) X-FDA: 82549026588.26.3B28B6E Received: from mail-oa1-f48.google.com (mail-oa1-f48.google.com [209.85.160.48]) by imf03.hostedemail.com (Postfix) with ESMTP id C5AE82001D for ; Tue, 10 Sep 2024 14:15:31 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=gKitA9Lv; spf=pass (imf03.hostedemail.com: domain of jeffxu@chromium.org designates 209.85.160.48 as permitted sender) smtp.mailfrom=jeffxu@chromium.org; dmarc=pass (policy=none) header.from=chromium.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1725977629; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ybYH3pl5I3XVIgOYPoF7qjD9tXRX1IFgRU4+n15LPsA=; b=WlAlLk5I2AYlATdZ0h29EZ+2zfgSJ/5z4vEtVX/CDgQhqOxmykhDsMUGcqBS8OBBf1l/K3 3wZkPfOGH4CkIQ9fCUqkeJOMyNqi3txtZO7UOHO23kbGSnQWV4tWl3KDq95aCZjNu0tpjz gOTH1uxiPOgLVVD3THE7Q4ZSZa0GMcM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725977629; a=rsa-sha256; cv=none; b=UI0Q8r4k+8yvX8olmkC8ZuFvd3wBiSQcW12WpMNvuNT3/xDpxb+zHIEMxeI9N6vQGmvSE6 i9+x+w3VgARh7kikbRWyAb2sTZYaaFld9U4O5LeorWDiAUXi9zMYWCkiSesnbGHlS7kSzV GcRlj9THK67z35myeCXQdc3yCQDLPzg= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=gKitA9Lv; spf=pass (imf03.hostedemail.com: domain of jeffxu@chromium.org designates 209.85.160.48 as permitted sender) smtp.mailfrom=jeffxu@chromium.org; dmarc=pass (policy=none) header.from=chromium.org Received: by mail-oa1-f48.google.com with SMTP id 586e51a60fabf-2611dcc3941so217485fac.3 for ; Tue, 10 Sep 2024 07:15:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1725977730; x=1726582530; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ybYH3pl5I3XVIgOYPoF7qjD9tXRX1IFgRU4+n15LPsA=; b=gKitA9LvO2RQznMptRIyVl//iULtAaVpB+vx/jFCe5MczEKHvz4rQu/mEcI7TWWAwo x7CNHTJMeT+4RAJkMmtS5PslwwtfeJJMMxyVyxHJ6ksPBb3GGRwXDVB/etDhSlEJf8Su WiV80Wz9Pqj5LrEpN1euQaqAXJcmU4tDqlDC8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725977730; x=1726582530; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ybYH3pl5I3XVIgOYPoF7qjD9tXRX1IFgRU4+n15LPsA=; b=ZoM7f2jqt8OVysePHugSpw29+qrA1HO/+QhnPGXeHk5FV5sbHjxT7syGUZ5xzQcmw6 EfTwOMZ2OQaqhhlzc/Xq2b1At4A8f/YTB+Yxg6gPwBMLff2beC9+cisu3Vv91XFXMOWy z3AiM/6i6jlTE0dMvcdUYX6r7GZklzs2GEou9b44epL1S6dest5uOiaZnissSoF5wS13 z5hJHhdSVu7Jfp/ia1yksusGJIaWpJOVd2/SLIOZQ0DUjBv0f09oNDrZAqnt071Rskxb KIW4ZwiHdpn0sYLZh4wSXN7CUurdYWAzhQzmz+bD3jS00ydrIW9fY2gTgf8J5WXdT3Fk TpLw== X-Forwarded-Encrypted: i=1; AJvYcCXcBOfni7oPKXqbCmNkzmorFSLwIRUpVaq9H/fsjrcwAQR8TxUtYKgNYK6NgnjQSZGEOR+lPMR3Ig==@kvack.org X-Gm-Message-State: AOJu0Yz02PByA/FvbMBa4Qh9K1KJ9hbKGZqZYa3Vgfuls4lRfHutP5wZ yhgnCnAOg8+L/hClVJFJdI1Mk99vJTGB65uO/MD6WvtkRg3uIc4QGwL9CemPwDRG4L5NZbdB4kL M3cWnO+ZqTM55bkrYKn3uRBDOSMS8ZW7j0Z5q X-Google-Smtp-Source: AGHT+IGrqe/kUELE8mrEjs2DqGDQyaa2RipgO9ceLOCupntW+1CqirpJeFY2eByO3yoZIssqQqSUjK4jmQwbYKjek2k= X-Received: by 2002:a05:6870:224c:b0:27b:72b3:cd9a with SMTP id 586e51a60fabf-27b82dba2b5mr5918265fac.2.1725977730540; Tue, 10 Sep 2024 07:15:30 -0700 (PDT) MIME-Version: 1.0 References: <20240809082511.497266-1-usama.anjum@collabora.com> <1b36ba43-60a4-441c-981f-9b62f366aa95@collabora.com> In-Reply-To: <1b36ba43-60a4-441c-981f-9b62f366aa95@collabora.com> From: Jeff Xu Date: Tue, 10 Sep 2024 07:15:18 -0700 Message-ID: Subject: Re: [PATCH] selftests: mm: Fix build errors on armhf To: Muhammad Usama Anjum Cc: Andrew Morton , Shuah Khan , Kees Cook , "Liam R. Howlett" , kernel@collabora.com, stable@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: C5AE82001D X-Stat-Signature: aeuhskoug61c44fno978fnzdx8cxyn3w X-HE-Tag: 1725977731-676643 X-HE-Meta: U2FsdGVkX19PFoQdhIhRnqeb5cGsZdz3y/C+/0yAFzn7jlKKEZP3PwKpEzzQ2epzKdtMrQFH6gFB2VFAUJmOeRkrstT8i+9s30017q1lNRg0brXYCcvUvUUD1/Gn+3G7Eto+QAV1mmifcm38i6pptnBpI6nix9MUgitRgiqsTFUnKTT9DmrExS72SJcfK28ga5Dyq2K7XDGZDH49fWpTWRSYwYtzzl+N7hyNdiT/DD+gTenKOw6XqT7I5bD/VHnC3Hk/6F1aZuZ+78b/oiX+6Q2I0QVJ2c3z+JolhDIwML0jFE4lRgIHRCwT9+Q1dTK+CB66MSXSq7cPIjpd/DFNIYew/8Xj/tvojBSc1wdgxYc4wVTCfKnluAUTJ4uMizVzjpnxFivIb3GdxWus84sDq/eCE0TJNaD/qqLmqEN7hNzPe8ZJ4TA7eQPYDB2GxJaEcfhbyPrSd/Pmw+Uo23riK2mtU3nA9uOS4Fvk2m7GQKFKinTm9j2tFZd2C2EWvMkQrdyxYoyL5ik458xs3sG9dUwEdnDYF5UqOLLfmsU29ynbTpDPOl34Dt2a6Aqv0Zby0OaxH6QwlrtkO6KWSmXpoWwhZIUmt0aqRBn9dtUtGj6DYIl2pOtJjASH9vsMNUvP+M02wPTdGZY8ss/9vRuZLnUsMWbQ20LVdQajiPz5NAau4UROq5zrCulLuDz9FXlr+VEuQLx+AsZCL0ALiEZmjL5lVtShQ/phGYWyNXCj+JvNhN7Bg/LKTt6rr2nMEYZ7RLFx04PmdVchykv4K4xdMJ2yctrSxPob8OgubLg1ADto3AQBQurpHFresV4tnKzCLcqLNtrXImxz2pvJvtF+RopTvJqR17momcpSBxueDKYh9/p+36xr4DuQo6K5qmsPt5ZFKhACzXe+6gP9bQoexy1/OraNxNSobLdh1eTIjd5HtmGBgO57/iw/F4LFBHpLV/X2BcfH/oewq37N7oL Yphl6rl7 prnS8KpH9g6MbcSzgDXoH4c8HpW7zps0h1AJ3FGU8Geg6BC4Nf92YmAp4QO+rxin3NDXxvd1UQvz8IO2SZyEechp27uMoImejScnqpQabsxZgzOXEf2DvbYKMAuOFJvnkFw5rODrEQroLhArePFn7kRrjycZFYUg4D8YItTfL8XPSJdKHBC7NoARm2blFDJ/F7FScB5MTZhcVqUU0VPvLcFxi2wEkg1yH3G2DnSvjIWdjJFcRqwV0wgtB/kXLPSUkz9LF X-Bogosity: Ham, tests=bogofilter, spamicity=0.000750, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Hi Muhammad On Mon, Aug 19, 2024 at 3:05=E2=80=AFAM Muhammad Usama Anjum wrote: > > On 8/14/24 3:29 AM, Jeff Xu wrote: > > Hi Muhammad > > > > On Fri, Aug 9, 2024 at 1:25=E2=80=AFAM Muhammad Usama Anjum > > wrote: > >> > >> The __NR_mmap isn't found on armhf. The mmap() is commonly available > >> system call and its wrapper is presnet on all architectures. So it > >> should be used directly. It solves problem for armhf and doesn't creat= e > >> problem for architectures as well. Remove sys_mmap() functions as they > >> aren't doing anything else other than calling mmap(). There is no need > >> to set errno =3D 0 manually as glibc always resets it. > >> > > The mseal_test should't have dependency on libc, and mmap() is > > implemented by glibc, right ? > > > > I just fixed a bug to switch mremap() to sys_mremap to address an > > issue that different glibc version's behavior is slightly different > > for mremap(). > > > > What is the reason that __NR_mmap not available in armhf ? (maybe it > > is another name ?) there must be a way to call syscall directly on > > armhf, can we use that instead ? > > It seems __NR_mmap syscall is deprecated for arm. Found this comment in > arch/arm/include/asm/unistd.h: > /* > * The following syscalls are obsolete and no longer available for EABI: > * __NR_time > * __NR_umount > * __NR_stime > * __NR_alarm > * __NR_utime > * __NR_getrlimit > * __NR_select > * __NR_readdir > * __NR_mmap > * __NR_socketcall > * __NR_syscall > * __NR_ipc > */ > > The glibc mmap() calls mmap2() these days by adjusting the parameters > internally. From man mmap: > C library/kernel differences: > This page describes the interface provided by the glibc mmap() wrapper > function. Originally, this function invoked a system call of the same > name. Since Linux 2.4, that system call has been superseded by > mmap2(2), and nowadays the glibc mmap() wrapper function invokes > mmap2(2) with a suitably adjusted value for offset. > > I'm not sure if behaviour of glibc mmap() and syscall mmap2() would be > same, but we should use glibc at most places which accounts for > different architectures correctly. Maybe the differences were only > present in case of mremap(). > We shouldn't use glibc to test mseal, mseal is a security feature, and an attacker can access syscall directly, so the test needs to test with as little layer as possible. I think there are two options: 1> switch everything to use __NR_mmap2 2> switch to __NR_mmap2 only for ARM. I'm not sure which one is more appropriate though. Thanks -Jeff > -- > BR, > Muhammad Usama Anjum >