Re: git: 1da65dcb1c57 - main - linux: populate sv_syscallnames in each sysentvec

From: Cy Schubert <Cy.Schubert_at_cschubert.com>
Date: Sat, 29 Oct 2022 16:19:57 UTC
In message <000aa27d-b115-5106-1870-78474e911336@freebsd.org>, Mitchell 
Horne w
rites:
> On 10/29/22 12:21, Mitchell Horne wrote:
> > On 10/29/22 12:01, Cy Schubert wrote:
> >> In message <202210282133.29SLXqfq064166@gitrepo.freebsd.org>, Mitchell
> >> Horne wr
> >> ites:
> >>> The branch main has been updated by mhorne:
> >>>
> >>> URL: 
> >>> https://cgit.FreeBSD.org/src/commit/?id=1da65dcb1c57fae7be75ddf1bd300ddf
> >>> 19ced850
> >>>
> >>> commit 1da65dcb1c57fae7be75ddf1bd300ddf19ced850
> >>> Author:     Mitchell Horne <mhorne@FreeBSD.org>
> >>> AuthorDate: 2022-10-28 21:19:39 +0000
> >>> Commit:     Mitchell Horne <mhorne@FreeBSD.org>
> >>> CommitDate: 2022-10-28 21:21:08 +0000
> >>>
> >>>      linux: populate sv_syscallnames in each sysentvec
> >>>      This allows the syscallname() function to give a usable result 
> >>> for Linux
> >>>      ABIs.
> >>>      Reported by:    jrtc27
> >>>      Reviewed by:    jrtc27, markj, jhb
> >>>      MFC after:      1 week
> >>>      Sponsored by:   The FreeBSD Foundation
> >>>      Differential Revision:  https://reviews.freebsd.org/D37199
> >>> ---
> >>>   sys/amd64/linux/linux_sysvec.c     | 3 ++-
> >>>   sys/amd64/linux32/linux32_sysvec.c | 3 ++-
> >>>   sys/arm64/linux/linux_sysvec.c     | 3 ++-
> >>>   sys/i386/linux/linux_sysvec.c      | 3 ++-
> >>>   4 files changed, 8 insertions(+), 4 deletions(-)
> >>>
> >>> diff --git a/sys/amd64/linux/linux_sysvec.c 
> >>> b/sys/amd64/linux/linux_sysvec.c
> >>> index abb498370f79..2a9e4909340b 100644
> >>> --- a/sys/amd64/linux/linux_sysvec.c
> >>> +++ b/sys/amd64/linux/linux_sysvec.c
> >>> @@ -110,6 +110,7 @@ extern char _binary_linux_vdso_so_o_end;
> >>>   static vm_offset_t linux_vdso_base;
> >>>   extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL];
> >>> +extern const char *linux_syscallnames[];
> >>>   SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler);
> >>> @@ -729,7 +730,7 @@ struct sysentvec elf_linux_sysvec = {
> >>>           SV_SIG_WAITNDQ | SV_TIMEKEEP,
> >>>       .sv_set_syscall_retval = linux_set_syscall_retval,
> >>>       .sv_fetch_syscall_args = linux_fetch_syscall_args,
> >>> -    .sv_syscallnames = NULL,
> >>> +    .sv_syscallnames = linux_syscallnames,
> >>>       .sv_shared_page_base = LINUX_SHAREDPAGE_LA48,
> >>>       .sv_shared_page_len = PAGE_SIZE,
> >>>       .sv_schedtail    = linux_schedtail,
> >>> diff --git a/sys/amd64/linux32/linux32_sysvec.c 
> >>> b/sys/amd64/linux32/linux32_s
> >>> ysvec.c
> >>> index bd10d659979c..15caa5a2c2cc 100644
> >>> --- a/sys/amd64/linux32/linux32_sysvec.c
> >>> +++ b/sys/amd64/linux32/linux32_sysvec.c
> >>> @@ -113,6 +113,7 @@ extern char _binary_linux32_vdso_so_o_end;
> >>>   static vm_offset_t linux_vdso_base;
> >>>   extern struct sysent linux32_sysent[LINUX32_SYS_MAXSYSCALL];
> >>> +extern const char *linux32_syscallnames[];
> >>>   SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler);
> >>> @@ -882,7 +883,7 @@ struct sysentvec elf_linux_sysvec = {
> >>>           SV_SIG_DISCIGN | SV_SIG_WAITNDQ | SV_TIMEKEEP,
> >>>       .sv_set_syscall_retval = linux32_set_syscall_retval,
> >>>       .sv_fetch_syscall_args = linux32_fetch_syscall_args,
> >>> -    .sv_syscallnames = NULL,
> >>> +    .sv_syscallnames = linux32_syscallnames,
> >>>       .sv_shared_page_base = LINUX32_SHAREDPAGE,
> >>>       .sv_shared_page_len = PAGE_SIZE,
> >>>       .sv_schedtail    = linux_schedtail,
> >>> diff --git a/sys/arm64/linux/linux_sysvec.c 
> >>> b/sys/arm64/linux/linux_sysvec.c
> >>> index 362917c3de31..41ac2912be29 100644
> >>> --- a/sys/arm64/linux/linux_sysvec.c
> >>> +++ b/sys/arm64/linux/linux_sysvec.c
> >>> @@ -98,6 +98,7 @@ extern char _binary_linux_vdso_so_o_end;
> >>>   static vm_offset_t linux_vdso_base;
> >>>   extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL];
> >>> +extern const char *linux_syscallnames[];
> >>>   SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler);
> >>> @@ -576,7 +577,7 @@ struct sysentvec elf_linux_sysvec = {
> >>>           SV_SIG_WAITNDQ | SV_TIMEKEEP,
> >>>       .sv_set_syscall_retval = linux_set_syscall_retval,
> >>>       .sv_fetch_syscall_args = linux_fetch_syscall_args,
> >>> -    .sv_syscallnames = NULL,
> >>> +    .sv_syscallnames = linux_syscallnames,
> >>>       .sv_shared_page_base = LINUX_SHAREDPAGE,
> >>>       .sv_shared_page_len = PAGE_SIZE,
> >>>       .sv_schedtail    = linux_schedtail,
> >>> diff --git a/sys/i386/linux/linux_sysvec.c 
> >>> b/sys/i386/linux/linux_sysvec.c
> >>> index e964f475a393..f67b19725cdf 100644
> >>> --- a/sys/i386/linux/linux_sysvec.c
> >>> +++ b/sys/i386/linux/linux_sysvec.c
> >>> @@ -96,6 +96,7 @@ extern char _binary_linux_vdso_so_o_end;
> >>>   static vm_offset_t linux_vdso_base;
> >>>   extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL];
> >>> +extern const char *linux_syscallnames[];
> >>>   SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler);
> >>> @@ -782,7 +783,7 @@ struct sysentvec linux_sysvec = {
> >>>           SV_SIG_DISCIGN | SV_SIG_WAITNDQ,
> >>>       .sv_set_syscall_retval = linux_set_syscall_retval,
> >>>       .sv_fetch_syscall_args = linux_fetch_syscall_args,
> >>> -    .sv_syscallnames = NULL,
> >>> +    .sv_syscallnames = linux_syscallnames,
> >>>       .sv_schedtail    = linux_schedtail,
> >>>       .sv_thread_detach = linux_thread_detach,
> >>>       .sv_trap    = NULL,
> >>>
> >>
> >> This results in the following error:
> >>
> >> cwsys# nice -20 poudriere bulk -j HEADamd64 -J 4 -p prod -f _bulk-queue
> >> kldload: an error occurred while loading module linux. Please check
> >> dmesg(8) for more details.
> >> [00:00:02] Error: Required kernel module 'linux' not found
> >> cwsys#
> >>
> >>
> >> dmesg shows:
> >>
> >> link_elf_obj: symbol linux32_syscallnames undefined
> >> linker_load_file: /boot/kernel/linux.ko - unsupported file type
> >>
> >>
> > 
> > This is my bad, I only compile-tested the change :(
> > 
> > Thank you for the report, I am testing the fix. It is only a matter of 
> > adding the missing source file to each module... but I'll ensure it 
> > actually loads for each architecture before committing.
> > 
> > Cheers,
> > Mitchell
>
> This should be fixed by 331784880821 and f396f9b6c96f. Please let me 
> know if this is not the case!

Thanks. I'm starting a new build now.


-- 
Cheers,
Cy Schubert <Cy.Schubert@cschubert.com>
FreeBSD UNIX:  <cy@FreeBSD.org>   Web:  https://FreeBSD.org
NTP:           <cy@nwtime.org>    Web:  https://nwtime.org

			e^(i*pi)+1=0