From: Osama Muhammad <osmtendev@gmail.com>
To: Shuah Khan <skhan@linuxfoundation.org>
Cc: shuah@kernel.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org
Subject: Re: [PATCH v2] selftests: prctl: Add new prctl test for PR_SET_NAME
Date: Sat, 17 Jun 2023 18:01:24 +0500 [thread overview]
Message-ID: <CAK6rUAObT-kQVGddhvxxtaKPcuaDddM6ipEDXuECCFtpR-GV6w@mail.gmail.com> (raw)
In-Reply-To: <3c03e28b-8006-a4ac-30bc-6aaf83ccb5d5@linuxfoundation.org>
Hi,
Yes, I did install the latest kernel headers and TASK_COMM_LEN is not
accessible in userspace.
I looked into the test which uses TASK_COMM_LEN but the test defines
it in its own header file.
Example: https://elixir.bootlin.com/linux/latest/source/tools/testing/selftests/bpf/progs/pyperf.h#L13
TASK_COMM_LEN is defined in include/linux/sched.h, but this header
file is not exposed to userspace.
TASK_COMM_LEN is not defined in /include/uapi/linux/sched.h which is
exposed to userspace kernel headers.
Please find the link to the header file exposed to user space :-
-https://elixir.bootlin.com/linux/v5.15.116/source/include/uapi/linux/sched.h
As for arm64/abi/tpidr2.c It includes linux/sched.h which will be
/include/uapi/linux/sched.h because the user space program is
including it.
So it also cannot use TASK_COMM_LEN directly.
Regards,
Osama
On Tue, 13 Jun 2023 at 02:56, Shuah Khan <skhan@linuxfoundation.org> wrote:
>
> On 6/10/23 07:01, Osama Muhammad wrote:
> > Hi all,
> >
> > I looked into it and tried to use TASK_COMM_LEN in the test. Even
> > though I included "linux/sched.h '', I was not able to compile the
> > test because it couldn't find it in the header file.
> > I dived deep into the issue and turns out header file mapped in
> > /usr/include/linux/sched.h is actually mapped to
> > /include/uapi/linux/sched.h[1] in linux source,
> > where TASK_COMM_LEN is not even defined. Instead TASK_COMM_LEN is
> > defined in /include/linux/sched.h which is not mapped to any header
> > files in
> > userspace(/(/usr/include/linux).
> > I also tried to find the TASK_COM_LEN in /usr/include/linux/ but I
> > couldn't find it. Following are the search results.
> > grep -rnw '/usr/include/linux/' -e 'TASK_COMM_LEN"
> > RESULTS OF COMMAND :- /usr/include/linux/taskstats.h:38:#define
> > TS_COMM_LEN 32 /* should be >= TASK_COMM_LEN
> > Based on this information, I have two questions:
> > 1. Would this require a fix to move 'TASK_COMM_LEN' macro from
> > /include/linux/sched.h to UAPI headers /include/uapi/linux/sched.h.
> > 2. Is there any other way to access TASK_COMM_LEN in the selftest that
> > I'm not aware of?
> >
> > [1]:-https://elixir.bootlin.com/linux/v5.15.116/source/include/uapi/linux/sched.h
> >
>
> The best source is Linux mainline.
>
> Take a look at test files that include linux/sched.h
>
> arm64/abi/tpidr2.c is one of them.
>
> Did you install headers before compiling the test?
> make headers_install
>
> thanks,
> -- Shuah
>
>
next prev parent reply other threads:[~2023-06-17 13:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-07 15:36 [PATCH v2] selftests: prctl: Add new prctl test for PR_SET_NAME Osama Muhammad
2023-06-09 21:43 ` Shuah Khan
2023-06-10 13:01 ` Osama Muhammad
2023-06-12 21:56 ` Shuah Khan
2023-06-17 13:01 ` Osama Muhammad [this message]
2023-06-26 18:36 ` Osama Muhammad
2023-06-27 19:03 ` Muhammad Usama Anjum
2023-07-14 16:21 ` Shuah Khan
2023-07-21 16:30 ` Shuah Khan
2023-06-27 19:01 ` Muhammad Usama Anjum
2023-06-27 19:08 ` Muhammad Usama Anjum
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=CAK6rUAObT-kQVGddhvxxtaKPcuaDddM6ipEDXuECCFtpR-GV6w@mail.gmail.com \
--to=osmtendev@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=skhan@linuxfoundation.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).