linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Muhammad Usama Anjum <Usama.Anjum@collabora.com>
To: Jeff Xu <jeffxu@chromium.org>
Cc: Usama.Anjum@collabora.com,
	Andrew Morton <akpm@linux-foundation.org>,
	Shuah Khan <shuah@kernel.org>, Kees Cook <kees@kernel.org>,
	"Liam R. Howlett" <Liam.Howlett@oracle.com>,
	kernel@collabora.com, stable@vger.kernel.org, linux-mm@kvack.org,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] selftests: mm: Fix build errors on armhf
Date: Mon, 16 Sep 2024 10:11:18 +0500	[thread overview]
Message-ID: <406c2919-a546-40e4-89af-baa910c22740@collabora.com> (raw)
In-Reply-To: <CABi2SkWk8igT=HCTcawv72uxrf2rhzj1A23k4EixCxcDKhSNxw@mail.gmail.com>

On 9/14/24 3:33 AM, Jeff Xu wrote:
> On Mon, Aug 19, 2024 at 3:05 AM Muhammad Usama Anjum
> <Usama.Anjum@collabora.com> wrote:
>>
>> On 8/14/24 3:29 AM, Jeff Xu wrote:
>>> Hi Muhammad
>>>
>>> On Fri, Aug 9, 2024 at 1:25 AM Muhammad Usama Anjum
>>> <usama.anjum@collabora.com> wrote:
>>>>
>>>> The __NR_mmap isn't found on armhf. The mmap() is commonly available
> 
> What is armhf ?
> is that arm64 ? I was able to build arm64 correctly.
It is arm architecture. Use following toolchain with it:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-

Please test your patches on it.

> 
> -Jeff
> 
>>>> system call and its wrapper is presnet on all architectures. So it
>>>> should be used directly. It solves problem for armhf and doesn't create
>>>> 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 = 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().
>>
>> --
>> BR,
>> Muhammad Usama Anjum
>>

-- 
BR,
Muhammad Usama Anjum



      reply	other threads:[~2024-09-16  5:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-09  8:25 Muhammad Usama Anjum
2024-08-13 22:29 ` Jeff Xu
2024-08-19 10:05   ` Muhammad Usama Anjum
2024-09-10 14:15     ` Jeff Xu
2024-09-10 15:31       ` Liam R. Howlett
2024-09-13 22:33     ` Jeff Xu
2024-09-16  5:11       ` Muhammad Usama Anjum [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=406c2919-a546-40e4-89af-baa910c22740@collabora.com \
    --to=usama.anjum@collabora.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=jeffxu@chromium.org \
    --cc=kees@kernel.org \
    --cc=kernel@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=shuah@kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox