[PATCH v3] Port GDB to Hurd x86_64.

2025-02-02 Thread Flavio Cruz
This port extends the existing i686 port to support x86_64 by reusing existing code whenever it makes sense. * gdb/amd64-gnu-tdep.c: Adds logic for handling signal frames and position of amd64 registers in the different Hurd structs. The signal code is very similar to i686, except the trampoli

[PATCH hurd] Define i386_get_xstate_size in libmachdev.

2024-09-09 Thread Flavio Cruz
libmachdev implements the mach_i386 routines, so we have to implement this one. --- libmachdev/trivfs_server.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/libmachdev/trivfs_server.c b/libmachdev/trivfs_server.c index e228bf40..54a682e7 100644 --- a/libmachdev/trivfs_server.c +++ b/li

[PATCH] Remove the remaining untyped mach message handling

2024-07-30 Thread Flavio Cruz
Some leftovers from 6ae7b5f43d4b13f24606d7108d822e469a96af3d --- hurd/hurdselect.c | 23 --- hurd/intr-msg.c | 4 sysdeps/mach/hurd/ioctl.c | 48 --- 3 files changed, 75 deletions(-) diff --git a/hurd/hurdselect.c b/hurd/

[PATCH] x86_64 hurd: ensure we have a large enough buffer to receive exception_raise requests.

2024-07-29 Thread Flavio Cruz
--- This is likely to help with some of the issues we are seeing with x86_64 related to signal handling but I don't know how to reproduce it. hurd/hurdfault.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hurd/hurdfault.c b/hurd/hurdfault.c index 5110c6030f..1fe973f

[PATCH hurd] nfsd: fix -Werror=incompatible-pointer-types issues for x86_64

2024-07-21 Thread Flavio Cruz
--- nfsd/cache.c | 2 +- nfsd/ops.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nfsd/cache.c b/nfsd/cache.c index cd5524af..864739c0 100644 --- a/nfsd/cache.c +++ b/nfsd/cache.c @@ -387,7 +387,7 @@ create_cached_handle (int fs, struct cache_handle *credc, file_t use

[PATCH mig] Suffix complex_alignof with U to hint the compiler that it is always unsigned

2024-07-18 Thread Flavio Cruz
I have noticed a problem when compiling rumpkernel with the new thread_get_name: gnumachUser.c: In function 'thread_get_name': gnumachUser.c:1791:37: error: comparison of integer expressions of different signedness: 'unsigned int' and 'int' [-Werror=sign-compare] 1791 | if (mig_unlikely

[PATCH] Hurd: use mach_msg_type_number_t for file_get_fs_options since its size is not the same as size_t for x86_64.

2024-07-15 Thread Flavio Cruz
This fixes an incompatible-pointer-types error on GCC14. --- ifconfig/system/hurd.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ifconfig/system/hurd.c b/ifconfig/system/hurd.c index 6ef63a7a..38e0060c 100644 --- a/ifconfig/system/hurd.c +++ b/ifconfig/system/hurd.

Re: [PATCH] server: Fix bogus port deallocation on server error

2024-07-14 Thread Flavio Cruz
On 14.07.2024 16:37, Samuel Thibault wrote: For inlined port arrays, WriteExtractArg compacts them from a mach_port_name_inlined_t array to a mach_port_t array, reusing the memory area. But when the server returns an error, the caller will destroy the message, and thus expects the original inline

[PATCH v2 glibc] Add pthread_getname_np and pthread_setname_np for Hurd

2024-07-11 Thread Flavio Cruz
We use thread_get_name and thread_set_name to get and set the thread name, so nothing is stored in the thread structure since these functions are supposed to be called sparingly. One notable difference with Linux is that the thread name is up to 32 chars, whereas Linux's is 16. Also added a mach_

[PATCH gnumach] Add thread_get_name RPC to get the name of a thread.

2024-07-11 Thread Flavio Cruz
--- include/mach/gnumach.defs | 8 kern/thread.c | 21 + 2 files changed, 29 insertions(+) diff --git a/include/mach/gnumach.defs b/include/mach/gnumach.defs index 7ecf74d..f13e866 100644 --- a/include/mach/gnumach.defs +++ b/include/mach/gnumach.defs @@

[PATCH hurd] netfs and diskfs: make showtrans work correctly when translators are set on top of sylink/device/fifo/socket files.

2024-07-10 Thread Flavio Cruz
While these are short-circuited translators and simply change st_mode, actual translators can be set on top. We want `showtrans` to show the actual passive translator, not the short-circuited one. --- libdiskfs/file-get-trans.c | 37 -- libnetfs/file-get-transla

[PATCH gnumach] Include stddef.h in sys/types.h to get size_t and NULL.

2024-07-10 Thread Flavio Cruz
Remove unnecessary definitions from sys/types.h. --- include/sys/types.h | 23 +-- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/include/sys/types.h b/include/sys/types.h index 8d5af37..82b2e4d 100644 --- a/include/sys/types.h +++ b/include/sys/types.h @@ -28,16

[PATCH gnumach] Ensure we always pass -ffreestanding -nostdlib even if CFLAGS are overridden.

2024-07-10 Thread Flavio Cruz
--- Makefile.am | 5 + configure.ac | 6 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 357e847..837d602 100644 --- a/Makefile.am +++ b/Makefile.am @@ -72,6 +72,11 @@ AM_CFLAGS += \ AM_CFLAGS += \ -fno-strict-aliasing +# We use

[PATCH glibc] Add pthread_getname_np and pthread_setname_np for Hurd

2024-07-10 Thread Flavio Cruz
Some notable differences with Linux: - We are not inheriting the program name. - The name can be up to 64 chars (versus Linux's 16). Also added a mach_RPC_CHECK to check for the existing of gnumach RPCs. --- config.h.in | 3 + htl/Makefile

Re: gnumach "NULL undeclared" build error

2024-07-06 Thread Flavio Cruz
On 06.07.2024 02:55, Nathan Dehnel wrote: Hello, I'm in the process of setting up CI for Hurd using Guix. What I'm doing is taking the upstream Guix package definitions and modifying them to build from a git checkout. I ran into this error trying to build gnumach. Is it being compiled wrong? p

[PATCH v2] Port GDB to Hurd x86_64.

2024-07-03 Thread Flavio Cruz
This port extends the existing i686 port to support x86_64 by trying to reuse existing code whenever it makes sense. * gdb/amd64-gnu-tdep.c: Adds logic for handling signal frames and position of amd64 registers in the different Hurd structs. The signal code is very similar to i686, except the

[PATCH mig] Make the MiG test suite compatible with GCC 14.

2024-07-03 Thread Flavio Cruz
We need to expose the function declarations in mig_support.h. Also fix test setup to work well in cases the build directory is not inside the source directory. --- tests/bad/Makefile.am | 2 +- tests/generate-only/Makefile.am | 2 +- tests/good/Makefile.am| 2 +- test

[PATCH gnumach] Disable specific warnings that are now errors in GCC 14

2024-06-24 Thread Flavio Cruz
--- linux/Makefrag.am | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/linux/Makefrag.am b/linux/Makefrag.am index 2338452..2af513b 100644 --- a/linux/Makefrag.am +++ b/linux/Makefrag.am @@ -37,9 +37,15 @@ liblinux_a_CPPFLAGS = $(AM_CPPFLAGS) \ # corresponding text segme

[PATCH hurd 2/2] Fix issues with GCC 14.

2024-06-24 Thread Flavio Cruz
* ftpfts/ftpfs: use appropriate function signature for interrupt_check. * pfinet/Makefile: turn off warnings in Linux driver code that are now errors in GCC 14. * pfinet/glue-include/linux/socket.h: remove duplicate functions. These are implemented in linux-src/net/core/iovec.c. --- ftpfs/ftpf

[PATCH hurd 1/2] Include unistd.h for sleep in pfinet/ethernet.c

2024-06-24 Thread Flavio Cruz
Compilation fails otherwise due to -Werror=implicit-function-declaration --- pfinet/ethernet.c | 1 + 1 file changed, 1 insertion(+) diff --git a/pfinet/ethernet.c b/pfinet/ethernet.c index 9eb33bb..ae738de 100644 --- a/pfinet/ethernet.c +++ b/pfinet/ethernet.c @@ -30,6 +30,7 @@ #include #incl

[PATCH v2 hurd] MAKEDEV: when creating devices, ensure the underlying files are either block/char devices or directories

2024-03-05 Thread Flavio Cruz
The perl test suite has a test where it reads all the block or char devices under /dev without following the translators. Then it compares it against a list of devices that read the translated nodes stat info. The patch changes how the the device files are created initially so that the stat infor

[PATCH hurd] MAKEDEV: when creating devices, ensure the underlying files are either block/char devices or directories

2024-03-04 Thread Flavio Cruz
The perl test suite has a test where it reads all the block or char devices under /dev without following the translators. Then it compares it against a list of devices that read the translated nodes stat info. The patch changes how the the device files are created initially so that the stat infor

[PATCH hurd] libps: update ps_emit_nice_size_t to handle arbitrarily large size_t

2024-03-03 Thread Flavio Cruz
Update argument types for sprint_frac_value to reflect how big they actually are so that GCC doesn't think it needs a larger buffer than necessary. --- libps/spec.c | 22 +- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/libps/spec.c b/libps/spec.c index 9f64703

[PATCH gcc] Hurd x86_64: add unwind support for signal trampoline code

2024-02-28 Thread Flavio Cruz
Tested with some simple toy examples where an exception is thrown in the signal handler. libgcc/ChangeLog: * config/i386/gnu-unwind.h: Support unwinding x86_64 signal frames. Signed-off-by: Flavio Cruz --- libgcc/config/i386/gnu-unwind.h | 97 - 1 file

[PATCH hurd] rumpdisk: do not open device if block size is 0

2024-02-28 Thread Flavio Cruz
Currently, if we do: $ ls /dev/cd0/ The computer seems to get stuck, caused by the divide by 0 in the rumpdisk server in device_get_status. I noticed that if we have no disk in the cdrom device, we can still open it but block and media size will be 0 and the message "cd0 dos partition I/O error"

[PATCH gnumach] Check for null ports in task_set_essential, task_set_name and thread_set_name.

2024-02-24 Thread Flavio Cruz
Otherwise, it is easy to crash the kernel if userland passes arbitrary port names. --- kern/task.c | 6 ++ kern/thread.c | 3 +++ 2 files changed, 9 insertions(+) diff --git a/kern/task.c b/kern/task.c index 60ab4d7..dfba04d 100644 --- a/kern/task.c +++ b/kern/task.c @@ -1165,6 +1165,9 @@ t

[PATCH v2] Port GDB to Hurd x86_64.

2024-02-23 Thread Flavio Cruz
This port extends the existing i686 port to support x86_64 by trying to reuse existing code whenever it makes sense. * gdb/amd64-gnu-tdep.c: Adds logic for handling signal frames and position of amd64 registers in the different Hurd structs. The signal code is very similar to i686, except the

[PATCH gnumach] x86_64: avoid iterating over the message twice in copyoutmsg/copyinmsg for faster RPCs.

2024-02-19 Thread Flavio Cruz
This is a follow up to https://git.savannah.gnu.org/cgit/hurd/gnumach.git/commit/?id=69620634858b2992e1a362e33c95d9a8ee57bce7 where we made inlined ports 8 bytes long to avoid resizing. The last thing that copy{in,out}msg were doing was just updating msgt_size field since that's required for kerne

[PATCH glibc] Implement setcontext/getcontext/makecontext/swapcontext for Hurd x86_64

2024-02-17 Thread Flavio Cruz
Tested with the tests provided by glibc plus some other toy examples. --- sysdeps/mach/hurd/x86_64/Makefile | 4 + sysdeps/mach/hurd/x86_64/__start_context.S | 49 + sysdeps/mach/hurd/x86_64/getcontext.S | 68 sysdeps/mach/hurd/x86_64/makecontext.c | 119

[PATCH glibc] Use proc_getchildren_rusage when available in getrusage and times.

2024-02-17 Thread Flavio Cruz
--- config.h.in| 3 + sysdeps/mach/hurd/configure| 174 + sysdeps/mach/hurd/configure.ac | 19 sysdeps/mach/hurd/getrusage.c | 8 +- sysdeps/mach/hurd/times.c | 18 +++- 5 files changed, 219 insertions(+), 3 deletions(-) dif

Patch series for children process resource accounting

2024-02-16 Thread Flavio Cruz
These patches implement getrusage(RUSAGE_CHILDREN, _) and populate child related data in times(_). This should fix the problem we have with building the latest grep which uses times(_) to get the cpu cycles in the test suite: https://buildd.debian.org/status/fetch.php?pkg=grep&arch=hurd-i386&ver=

[PATCH glibc] Use proc_getchildren_rusage when available in getrusage and times.

2024-02-16 Thread Flavio Cruz
--- config.h.in | 3 +++ sysdeps/mach/configure| 28 sysdeps/mach/configure.ac | 9 + sysdeps/mach/hurd/getrusage.c | 8 ++-- sysdeps/mach/hurd/times.c | 18 +- 5 files changed, 63 insertions(+), 3 deleti

[PATCH hurd] Add proc_getchildren_rusage RPC and track rusage for children and descendants

2024-02-16 Thread Flavio Cruz
--- hurd/process.defs | 6 ++ proc/info.c | 8 proc/proc.h | 4 +++- proc/wait.c | 2 ++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/hurd/process.defs b/hurd/process.defs index 9a8b3a1..007aa2b 100644 --- a/hurd/process.defs +++ b/hurd/process.defs

[PATCH v2] Port GDB to Hurd x86_64.

2024-02-14 Thread Flavio Cruz
This port extends the existing i686 port to support x86_64 by trying to reuse existing code whenever it makes sense. * gdb/amd64-gnu-tdep.c: Adds logic for handling signal frames and position of amd64 registers in the different Hurd structs, including i386_thread_state. The signal code is very

[PATCH] Port GDB to Hurd x86_64.

2024-02-12 Thread Flavio Cruz
This port extends the existing i686 port to support x86_64 by trying to reuse existing code whenever it makes sense. * gdb/amd64-gnu-tdep.c: Adds logic for handling signal frames and position of amd64 registers in the different Hurd structs, including i386_thread_state. The signal code is very

[PATCH 2/2] Add thread_set_name RPC.

2024-02-11 Thread Flavio Cruz
Like task_set_name, we use the same size as the task name and will inherit the task name, whenever it exists. This will be used to implement pthread_setname_np. --- ddb/db_print.c| 9 + include/mach/gnumach.defs | 8 kern/thread.c | 20 +++

[PATCH 1/2] Replace kernel header includes in include/mach/mach_types.h with forward declarations.

2024-02-11 Thread Flavio Cruz
I was trying to reuse TASK_NAME_SIZE in kern/thread.h but it was impossible because files included from kern/task.h end up requiring kern/thread.h (through percpu.h), creating a recursive dependency. With this change, mach_types.h only defines forward declarations and modules have to explicitly in

[PATCH] Hurd port: update interface to match upstream and fix warnings.

2024-02-06 Thread Flavio Cruz
We have recently updated the interface for raising exceptions to use long [1] and updated mach_port_t to be "unsigned int". This patches fixes those problems and will help us port GDB to Hurd x86_64. Tested on Hurd i686 and x86_64. [1] https://git.savannah.gnu.org/cgit/hurd/gnumach.git/tree/incl

[PATCH binutils-gdb] Port GDB to Hurd x86_64.

2024-02-03 Thread Flavio Cruz
This port extends the existing i686 port to support x86_64 by trying to reuse existing code whenever it makes sense. * gdb/amd64-gnu-tdep.c: Adds logic for handling signal frames and position of amd64 registers in the different Hurd structs, including i386_thread_state. The signal code is very

[PATCH hurd] Update rpctrace to use the new ABI for inlined port names

2024-01-21 Thread Flavio Cruz
--- utils/rpctrace.c | 83 +++- 1 file changed, 53 insertions(+), 30 deletions(-) diff --git a/utils/rpctrace.c b/utils/rpctrace.c index f7046a0..c8635a3 100644 --- a/utils/rpctrace.c +++ b/utils/rpctrace.c @@ -801,6 +801,18 @@ rewrite_right (mach_port_

[PATCH hurd 5/6] ftpfs: use correct function signature for interrupt_check

2024-01-21 Thread Flavio Cruz
--- ftpfs/ftpfs.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ftpfs/ftpfs.c b/ftpfs/ftpfs.c index 794439b..9310a56 100644 --- a/ftpfs/ftpfs.c +++ b/ftpfs/ftpfs.c @@ -51,8 +51,13 @@ struct ftpfs *ftpfs; /* Parameters describing the server we're connecting to. */ str

[PATCH hurd 6/6] hurdio: use correct function signature for hurdio_mdmstate

2024-01-21 Thread Flavio Cruz
--- term/hurdio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/term/hurdio.c b/term/hurdio.c index c6e14a4..a3e2a0a 100644 --- a/term/hurdio.c +++ b/term/hurdio.c @@ -613,8 +613,8 @@ hurdio_mdmctl (int how, int bits) } -static int -hurdio_mdmstate (void) +static err

[PATCH hurd 2/6] procfs: remove unused rootdir_symlink_make_node

2024-01-21 Thread Flavio Cruz
Not needed since b2c97e251bb470e6f967c716081675a96dbde59c --- procfs/rootdir.c | 8 1 file changed, 8 deletions(-) diff --git a/procfs/rootdir.c b/procfs/rootdir.c index 7742edd..206a541 100644 --- a/procfs/rootdir.c +++ b/procfs/rootdir.c @@ -706,14 +706,6 @@ rootdir_file_make_node (voi

[PATCH hurd 3/6] Fix warnings in fstests

2024-01-21 Thread Flavio Cruz
--- fstests/fstests.c | 1 - fstests/timertest.c | 10 -- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/fstests/fstests.c b/fstests/fstests.c index b776503..ca60203 100644 --- a/fstests/fstests.c +++ b/fstests/fstests.c @@ -94,7 +94,6 @@ main (void) #endif printf

[PATCH hurd 4/6] x86_64: do not define mach_cpu_subtypes since we don't use it

2024-01-21 Thread Flavio Cruz
--- proc/cpu-types.c | 2 ++ proc/host.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/proc/cpu-types.c b/proc/cpu-types.c index 3d89d5a..7a814f6 100644 --- a/proc/cpu-types.c +++ b/proc/cpu-types.c @@ -38,6 +38,7 @@ const char *const mach_cpu_types[] = #endif }; +#ifndef __x86

[PATCH hurd 1/6] Restructure argument setup in hashbang

2024-01-21 Thread Flavio Cruz
We do a few things here: - Move search_path to the scope where it is used to make dependencies more clear. - Have a separate variable to store the file name we eventually need to free and move the free logic to happen in a single place. Both of this allows us to still free the name even if a f

[PATCH hurd] x86_64: utmp uses int32_t to store time so use a temporary variable

2023-12-30 Thread Flavio Cruz
--- utils/login.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/utils/login.c b/utils/login.c index 3134c4a..334941c 100644 --- a/utils/login.c +++ b/utils/login.c @@ -157,12 +157,17 @@ static void add_utmp_entry (char *args, unsigned args_len, int inherit_host) {

[PATCH hurd 06/11] x86_64: use 21 bytes in libps since %z might require more characters.

2023-12-29 Thread Flavio Cruz
This makes GCC happy. --- libps/spec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libps/spec.c b/libps/spec.c index dec5704..9f64703 100644 --- a/libps/spec.c +++ b/libps/spec.c @@ -492,7 +492,7 @@ error_t ps_emit_nice_size_t (struct proc_stat *ps, struct ps_fmt_field *fi

[PATCH hurd 11/11] pfinet: fix type alias

2023-12-29 Thread Flavio Cruz
--- pfinet/stubs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pfinet/stubs.c b/pfinet/stubs.c index 9affcff..01ba2fa 100644 --- a/pfinet/stubs.c +++ b/pfinet/stubs.c @@ -50,7 +50,7 @@ void dev_activate (struct device *) __attribute__ ((alias ("dev_init_scheduler")));

[PATCH hurd 03/11] Use mach_msg_type_number_t whenever required to avoid warnings

2023-12-29 Thread Flavio Cruz
--- libfshelp-tests/race.c | 9 + libnetfs/file-get-translator.c | 2 +- pfinet/ethernet.c | 2 +- pfinet/io-ops.c| 10 ++ utils/mount.c | 2 +- utils/msgport.c| 2 +- 6 files changed, 15 insertions(+), 12 d

[PATCH hurd 01/11] Initialize a few error variables to avoid GCC warnings

2023-12-29 Thread Flavio Cruz
--- ext2fs/pager.c | 2 +- fatfs/pager.c | 2 +- trans/random.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ext2fs/pager.c b/ext2fs/pager.c index 2869f4d..61db0df 100644 --- a/ext2fs/pager.c +++ b/ext2fs/pager.c @@ -170,7 +170,7 @@ static error_t file_pager_read_page (

[PATCH hurd 04/11] Fix printf format specifiers

2023-12-29 Thread Flavio Cruz
--- pci-arbiter/options.c | 2 +- utils/ftpdir.c| 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pci-arbiter/options.c b/pci-arbiter/options.c index e0455f4..e578810 100644 --- a/pci-arbiter/options.c +++ b/pci-arbiter/options.c @@ -379,7 +379,7 @@ netfs_append_args (

[PATCH hurd 05/11] x86_64: utmp uses int32_t to store time so use a temporary variable

2023-12-29 Thread Flavio Cruz
--- utils/login.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/utils/login.c b/utils/login.c index 3134c4a..3ed5121 100644 --- a/utils/login.c +++ b/utils/login.c @@ -157,12 +157,17 @@ static void add_utmp_entry (char *args, unsigned args_len, int inherit_host) {

[PATCH hurd 07/11] Fix a few pointer related warnings.

2023-12-29 Thread Flavio Cruz
--- utils/rpctrace.c | 4 ++-- utils/vmallocate.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/rpctrace.c b/utils/rpctrace.c index 589ce8f..f7046a0 100644 --- a/utils/rpctrace.c +++ b/utils/rpctrace.c @@ -810,10 +810,10 @@ print_contents (mach_msg_header_t *inp,

[PATCH hurd 09/11] Fix overflow issues in tmpfs and vmallocate

2023-12-29 Thread Flavio Cruz
--- tmpfs/tmpfs.c | 2 +- utils/vmallocate.c | 7 +-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tmpfs/tmpfs.c b/tmpfs/tmpfs.c index 02d4bd8..d28806a 100644 --- a/tmpfs/tmpfs.c +++ b/tmpfs/tmpfs.c @@ -39,7 +39,7 @@ char *diskfs_disk_name = "none"; int diskfs_default_s

[PATCH hurd 08/11] proxy-defpager: add missing return statement

2023-12-29 Thread Flavio Cruz
--- trans/proxy-defpager.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/trans/proxy-defpager.c b/trans/proxy-defpager.c index 386f1b6..314ce9f 100644 --- a/trans/proxy-defpager.c +++ b/trans/proxy-defpager.c @@ -124,6 +124,8 @@ S_default_pager_paging_storage_new (mach_port_t default_page

[PATCH hurd 10/11] libftpconn: add out >= 2 condition to make GCC happy

2023-12-29 Thread Flavio Cruz
--- libftpconn/cmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libftpconn/cmd.c b/libftpconn/cmd.c index 9916d03..4b4c6fa 100644 --- a/libftpconn/cmd.c +++ b/libftpconn/cmd.c @@ -99,7 +99,7 @@ ftp_conn_cmd (struct ftp_conn *conn, const char *cmd, const char *arg,

[PATCH hurd 02/11] Cast bootinfo to struct diskfs_control * to silence warning

2023-12-29 Thread Flavio Cruz
--- libdiskfs/boot-start.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdiskfs/boot-start.c b/libdiskfs/boot-start.c index e8c09bc..8c159f3 100644 --- a/libdiskfs/boot-start.c +++ b/libdiskfs/boot-start.c @@ -464,7 +464,7 @@ diskfs_S_fsys_getpriv (struct diskfs_control *

[PATCH hurd 3/3] Mark msg_thread as noreturn

2023-12-29 Thread Flavio Cruz
--- boot/boot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boot/boot.c b/boot/boot.c index 0d7ae74..d773bd1 100644 --- a/boot/boot.c +++ b/boot/boot.c @@ -775,7 +775,7 @@ main (int argc, char **argv, char **envp) } } -void * +void * __attribute__ ((noreturn)) msg_

[PATCH hurd 2/3] Replace deprecated sigmask with sigset_t calls

2023-12-29 Thread Flavio Cruz
--- exec/hashexec.c | 9 +++-- libdiskfs/disk-pager.c | 4 +++- libpager/pager-memcpy.c | 11 --- libstore/memobj.c | 11 --- startup/startup.c | 9 ++--- 5 files changed, 32 insertions(+), 12 deletions(-) diff --git a/exec/hashexec.c b/exec/hashexe

[PATCH hurd 1/3] pfinet and pci-arbiter: update server handlers to return kern_return_t to fix -Werror=enum-int-mismatch warnings

2023-12-29 Thread Flavio Cruz
--- pci-arbiter/pci-ops.c | 10 +++ pfinet/iioctl-ops.c | 10 +++ pfinet/io-ops.c | 64 +-- pfinet/main.c | 2 +- pfinet/pfinet-ops.c | 4 +-- pfinet/socket-ops.c | 32 +++--- pfinet/tunnel.c | 24 -

[PATCH mig] Use char* for inlined arrays of char in user headers

2023-12-29 Thread Flavio Cruz
This changes how we declare RPC user prototypes for device_read_inband to use "char *data" rather than "io_buf_ptr_inband_t data". It is more standard to pass a pointer to represent arrays compared to "char [128]". This fixes a warning in console-client since GCC won't complain we are not passing a

[PATCH hurd] Update server handlers to return kern_return_error to fix -Werror=enum-int-mismatch warnings

2023-12-13 Thread Flavio Cruz
MiG expects those to return kern_return_t. --- acpi/acpi-ops.c| 4 ++-- boot/boot.c| 2 +- console-client/trans.c | 10 console/display.c | 8 +++ ext2fs/storeinfo.c | 2 +- fatfs/inode.c

[PATCH glibc] Update code to handle the new ABI for sending inlined port rights.

2023-12-13 Thread Flavio Cruz
For i686, this change is no op but for x86_64 it forces all inlined port rights to be 8 bytes long. --- hurd/intr-msg.c| 26 -- mach/msg-destroy.c | 12 +--- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/hurd/intr-msg.c b/hurd/intr-msg.c index

[PATCH gnumach] x86_64: Support 8 byte inlined port rights to avoid message resizing.

2023-12-13 Thread Flavio Cruz
If a port is inlined in a message, the user has to use mach_port_name_inlined_t to define each port. Out of line memory continues to use mach_port_name_t since that memory has to be copied to the kernel anyway. Both copyinmsg and copyoutmsg can be reduced to nothing (if we ignore USER32) as a foll

[PATCH hurd] Update hurd code to handle the new ABI for sending inlined port rights.

2023-12-13 Thread Flavio Cruz
--- libfshelp/start-translator-long.c | 16 proc/stubs.c | 8 +--- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/libfshelp/start-translator-long.c b/libfshelp/start-translator-long.c index 0b16e7d0..f788f0a7 100644 --- a/libfshelp/star

[PATCH mig] x86_64: adapt MiG generated stubs to use mach_port_name_inlined_t for inlined port rights.

2023-12-13 Thread Flavio Cruz
For i686, we just change the code to use mach_port_name_inlined_t when defining the types. This is a no-op. For x86_64, there's a few things that are different: - In the server code, the server handler can get inlined ports and the array will be resized and cast as an array of mach_port_name_t.

Patch series to avoid message resizing for x86_64 (v2)

2023-12-13 Thread Flavio Cruz
Hello Sending the updated patch series with the warnings fixed. The only difference is in the glibc patch (added a cast when calling clean_inlined_ports) and the MiG patch, which required a 3 line change to add appropriate casts from mach_port_name_inlined_t* to mach_port_t* in server.c. Flavio

[PATCH gnumach] x86_64: Support 8 byte inlined port rights to avoid message resizing.

2023-11-29 Thread Flavio Cruz
If a port is inlined in a message, the user has to use mach_port_name_inlined_t to define each port. Out of line memory continues to use mach_port_name_t since that memory has to be copied to the kernel anyway. Both copyinmsg and copyoutmsg can be reduced to nothing (if we ignore USER32) as a foll

[PATCH gnumach] Use MACH_PORT_NAME_NULL and MACH_PORT_NAME_DEAD when checking for null or dead rights

2023-11-28 Thread Flavio Cruz
Comparing mach_port_name_t that is MACH_PORT_NAME_DEAD against MACH_PORT_DEAD will always return false. --- ipc/ipc_space.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ipc/ipc_space.h b/ipc/ipc_space.h index 9b199de..3f0eaa0 100644 --- a/ipc/ipc_space.h +++ b/ipc/ipc_space.

[PATCH gnumach] Reorder mach_msg_type_t fields to ensure msgt_name and msgt_size are byte aligned

2023-11-24 Thread Flavio Cruz
msgt_unused appears right after msgt_size since msgt_size can be reduced to only 8 bits in the future, so we leave the door opened to make msgt_unused 13 bits long. --- include/mach/message.h | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/include/mach/me

[PATCH hurd] Update hurd code to handle the new ABI for sending inlined port rights.

2023-11-24 Thread Flavio Cruz
--- libfshelp/start-translator-long.c | 16 proc/stubs.c | 8 +--- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/libfshelp/start-translator-long.c b/libfshelp/start-translator-long.c index 0b16e7d0..f788f0a7 100644 --- a/libfshelp/star

[PATCH glibc] Update code to handle the new ABI for sending inlined port rights.

2023-11-24 Thread Flavio Cruz
For i686, this change is no op but for x86_64 it forces all inlined port rights to be 8 bytes long. --- hurd/intr-msg.c| 26 -- mach/msg-destroy.c | 12 +--- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/hurd/intr-msg.c b/hurd/intr-msg.c index

[PATCH mig] x86_64: adapt MiG generated stubs to use mach_port_name_inlined_t for inlined port rights.

2023-11-24 Thread Flavio Cruz
For i686, we just change the code to use mach_port_name_inlined_t when defining the types. This is a no-op. For x86_64, there's a few things that are different: - In the server code, the server handler can get inlined ports and the array will be resized and cast as an array of mach_port_name_t.

[PATCH gnumach] x86_64: Support 8 byte inlined port rights to avoid message resizing.

2023-11-24 Thread Flavio Cruz
If a port is inlined in a message, the user has to use mach_port_name_inlined_t to define each port. Out of line memory continues to use mach_port_name_t since that memory has to be copied to the kernel anyway. Both copyinmsg and copyoutmsg can be reduced to nothing (if we ignore USER32) as a foll

Patch series to avoid message resizing for x86_64

2023-11-24 Thread Flavio Cruz
Hello, this patch series updates the RPC ABI so that inlined port rights are always passed as mach_port_name_inlined_t which is as big as a kernel port pointer. This avoids message resizing for x86_64 in the kernel. Out of line port rights are unchanged. A future patch will simplify copyinmsg/copyo

[PATCH glibc] Remove untyped mach RPC code.

2023-11-18 Thread Flavio Cruz
Existing MiG does not support untyped messages and the Hurd will continue to use typed messages for the foreseeable future. --- hurd/hurdfault.c | 4 --- hurd/intr-msg.c| 69 -- mach/msg-destroy.c | 64 -- m

[PATCH hurd] libfshelp: type check messages using the full mach_msg_type_t so that it works on x86_64.

2023-11-18 Thread Flavio Cruz
--- libfshelp/start-translator-long.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libfshelp/start-translator-long.c b/libfshelp/start-translator-long.c index 0d6c574..0b16e7d 100644 --- a/libfshelp/start-translator-long.c +++ b/libfshelp/start-translator-long.c @@ -110,7 +

[PATCH glibc] _hurd_intr_rpc_mach_msg: handle message iteration correctly.

2023-11-18 Thread Flavio Cruz
The `ty` pointer is only set at the end of the loop so that `msgtl_header.msgt_inline` and `msgtl_header.msgt_deallocate` remain valid. Also, when deallocating memory, we use the length from the message directly rather than hard coding mach_port_t since we want to deallocate any kind of OOL data. -

[PATCH gnumach] Fix assertion for i686 since mach_port_name_t and mach_port_t have the same size

2023-11-06 Thread Flavio Cruz
--- ipc/ipc_kmsg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ipc/ipc_kmsg.c b/ipc/ipc_kmsg.c index 1b98445d..fb8de249 100644 --- a/ipc/ipc_kmsg.c +++ b/ipc/ipc_kmsg.c @@ -2385,7 +2385,8 @@ ipc_kmsg_copyout_body( /* first allocate memory i

[PATCH glibc] Update BAD_TYPECHECK to work on x86_64

2023-11-05 Thread Flavio Cruz
--- sysdeps/mach/mach_rpc.h | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sysdeps/mach/mach_rpc.h b/sysdeps/mach/mach_rpc.h index 152f057ca7..ed81403be6 100644 --- a/sysdeps/mach/mach_rpc.h +++ b/sysdeps/mach/mach_rpc.h @@ -20,11 +20,8 @@ /* Macro used by MIG to c

[PATCH incubator/dde] Use designated initializers when defining mach_msg_type_t in libmachdevdde

2023-08-10 Thread Flavio Cruz
This avoids assuming a specific field order in mach_msg_type_t (see https://git.savannah.gnu.org/cgit/hurd/gnumach.git/commit/device/net_io.c?id=50b744c4c2877dfbec54dc7bdae0d141e34c17c3 for a similar change in gnumach). --- libmachdevdde/net.c | 26 +- 1 file changed, 13 in

[PATCH hurd] Check for file_utimens since that's the correct RPC for changing access/modification times

2023-06-13 Thread Flavio Cruz
libtrivfs/nfsd/fakeroot can now make the call to the underlying translators. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 44aa69d7..452fe1fd 100644 --- a/configure.ac +++ b/configure.ac @@ -155,7 +155,7 @@ AC_CHECK_FUNCS(fil

[PATCH hurd] Replace msgh_kind with msgh_seqno

2023-06-12 Thread Flavio Cruz
msgh_kind is deprecated and is an alias to msgh_seqno. --- eth-multiplexer/vdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eth-multiplexer/vdev.c b/eth-multiplexer/vdev.c index f441803d..62042ee6 100644 --- a/eth-multiplexer/vdev.c +++ b/eth-multiplexer/vdev.c @@ -276,7

[PATCH gnumach] Update the 64bit RPC ABI to be simpler (v2)

2023-06-12 Thread Flavio Cruz
* Make full use of the 8 bytes available in mach_msg_type_t by moving into the unused 4 bytes. This allows us to use 32bits for mach_msg_type_number_t whether we use the longform or not. * Make mach_msg_type_long_t exactly the same as mach_msg_type_t. Updating MiG is strongly encouraged since

[PATCH gnumach] copyinmsg: allow for the last message element to have msgt_number = 0.

2023-06-11 Thread Flavio Cruz
When copying messages from user space, some messages may have mach_msg_type_t with msgt_number = 0 and no data after. This is a valid message and we want to allow that. I found this bug when testing "[PATCH gnumach] Update the 64bit RPC ABI to be simpler" and attempting to run a basic Hurd x86_64

[PATCH glibc] Fix build for hurd/thread-self.c for i386.

2023-05-21 Thread Flavio Cruz
We need to include hurd.h for libc_hidden_proto (__hurd_thread_self), introduced in https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=b44c1e12524bb5de0f93294a7c24c8e41c06bb75 This the error log: In file included from : ./../include/libc-symbols.h:472:33: error: '__EI___hurd_thread_self' ali

[PATCH mig] Update code generation to handle the new 64 bit ABI

2023-05-16 Thread Flavio Cruz
Mostly, we don't set the fields that do not exist and avoid type mismatching (like casting unsigned short to unsigned char for msgt_name). We also revamp type checking to compare mach_msg_type_t to uint64_t instead of just uint32_t as we now use the whole structure. --- global.h | 2 ++ utils.c

[PATCH gnumach] Update the 64bit RPC ABI to be simpler

2023-05-16 Thread Flavio Cruz
* Make full use of the 8 bytes available in mach_msg_type_t by moving into the unused 4 bytes. This allows us to use 32bits for mach_msg_type_number_t whether we use the longform or not. * Make mach_msg_type_long_t exactly the same as mach_msg_type_t. I'm not changing any of the code but keep

[PATCH gnumach] Fix task_info for TASK_THREAD_TIMES_INFO.

2023-05-16 Thread Flavio Cruz
We are checking for the existence of time_value64_t but we didn't add that to the task_thread_times_info structure. --- include/mach/task_info.h | 6 ++ kern/task.c | 8 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/include/mach/task_info.h b/include/mach

[PATCH glibc] Use TASK_THREAD_TIMES_INFO_COUNT when calling task_info with TASK_THREAD_TIMES_INFO

2023-05-16 Thread Flavio Cruz
This hasn't caused any problems yet but we are passing a pointer to struct task_thread_times_info which can cause problems if we populate over the existing size of the struct. --- sysdeps/mach/clock_gettime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sysdeps/mach/clock_ge

[PATCH mig] Check that msgt_name is always smaller than 255.

2023-05-09 Thread Flavio Cruz
For the x86_64 ABI we want this to always fit into 1 byte. Even for regular i686, msgt_name is always smaller than 25 (MACH_MSG_TYPE_LAST) and we don't have plans to have more names. Also throw an error if we deemed an RPC to be "TooLong" as that won't work or work badly. Tested by cross-compilin

[PATCH glibc] Stop checking if MiG supports retcode.

2023-05-09 Thread Flavio Cruz
We already did the same change for Hurd (https://git.savannah.gnu.org/cgit/hurd/hurd.git/commit/?id=ef5924402864ef049f40a39e73967628583bc1a4) Due to MiG requiring the subsystem to be defined early in order to know the size of a port, this was causing a division by zero error during ./configure. We

[PATCH hurd] Only use host_get_kernel_version and default_pager_paging_storage_new in x86_64.

2023-05-09 Thread Flavio Cruz
Also fixed the implementation of default_pager_paging_storage_new in proxy def pager to call into default_pager_paging_storage_new. We can fast track the simplification of the RPC ABI for x86_64 if we don't have MACH_MSG_TYPE_STRING used in RPCs which forces msgt_size to use more than 8 bits. ---

[PATCH hurd] Only use host_get_kernel_version and default_pager_paging_storage_new in x86_64.

2023-05-07 Thread Flavio Cruz
--- hurd/default_pager.defs | 4 mach-defpager/setup.c | 6 -- proc/host.c | 3 +++ sutils/swapon.c | 3 +++ trans/proxy-defpager.c | 6 -- 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/hurd/default_pager.defs b/hurd/default_pager.defs index 3c

[PATCH gnumach] Remove host_kernel_version RPC for x86_64

2023-05-07 Thread Flavio Cruz
We can fast track the simplification of the RPC ABI for x86_64 if we don't have MACH_MSG_TYPE_STRING used in RPCs which forces msgt_size to use more than 8 bits. --- include/mach/mach_host.defs | 4 kern/host.c | 10 ++ 2 files changed, 10 insertions(+), 4 deletions(-

[PATCH hurd] Stop checking if MiG supports retcode.

2023-05-07 Thread Flavio Cruz
Due to MiG requiring the subsystem to be defined early in order to know the size of a port, this was causing a division by zero error during ./configure. We could have just move subsystem to the top of the snippet, however it is simpler to just remove the check given that we have no plans to use so

[PATCH hurd] Implement device_open_new for all the translators implementing the device interface.

2023-05-07 Thread Flavio Cruz
--- boot/Makefile | 1 + boot/boot.c | 13 + devnode/Makefile | 2 +- devnode/devnode.c | 10 ++ eth-multiplexer/Makefile | 2 +- eth-multiplexer/device_impl.c | 10 ++ libmachdev/Makefile | 2

[PATCH glibc] Enable new device_open_new RPC in libmachuser.

2023-05-07 Thread Flavio Cruz
--- mach/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mach/Makefile b/mach/Makefile index a5d1252f95..2c09c29406 100644 --- a/mach/Makefile +++ b/mach/Makefile @@ -123,7 +123,8 @@ user-interfaces := $(filter-out $(mach-interface-list:%=mach/%) \ endif # For s

[PATCH glibc] Update hurd/hurdselect.c to be more portable.

2023-05-06 Thread Flavio Cruz
Summary of changes: - Use BAD_TYPECHECK to perform type checking in a cleaner way. BAD_TYPECHECK is moved into sysdeps/mach/rpc.h to avoid duplication. - Remove assertions for mach_msg_type_t since those won't work for x86_64. - Update message structs to use mach_msg_type_t directly. - Use desi

  1   2   3   4   >