[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

[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

[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

[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 @@

[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

[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(-)

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:

[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

[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 +++

[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

[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

[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

[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]

[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

[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

[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. */

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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))

[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

[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

[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

[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 ---

[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

[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 +++

[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

[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 ---

[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

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

[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 --

[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

[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

[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

[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 @@

[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

[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'

[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

[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

[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

[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

[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.

[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

[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

[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

[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 |

[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

[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

[PATCH gnumach] Delete include/mach/rpc.h

2023-05-04 Thread Flavio Cruz
File is unused. --- Makefrag.am| 1 - include/mach/rpc.h | 34 -- ipc/ipc_port.h | 1 - ipc/ipc_target.h | 1 - ipc/mach_port.c| 1 - 5 files changed, 38 deletions(-) delete mode 100644 include/mach/rpc.h diff --git a/Makefrag.am

[PATCH hurd] Update eth-multiplexer/vdev.c to be more portable

2023-05-04 Thread Flavio Cruz
* Perform the correct alignment for x86_64. * Use designated initializers. --- eth-multiplexer/vdev.c | 39 ++- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/eth-multiplexer/vdev.c b/eth-multiplexer/vdev.c index 548af9d2..f441803d 100644 ---

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

2023-05-04 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 and rely

[PATCH gnumach] Use designated initializers in kern/ipc_kobject.c

2023-05-03 Thread Flavio Cruz
msgt_deallocate was not initialized explicitly, this fixes that too. --- kern/ipc_kobject.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/kern/ipc_kobject.c b/kern/ipc_kobject.c index a0feaf40..960ef892 100644 --- a/kern/ipc_kobject.c +++ b/kern/ipc_kobject.c

[PATCH gnumach] Improve portability for device/net_io.c and use designated initializers

2023-05-03 Thread Flavio Cruz
--- device/net_io.c | 32 +--- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/device/net_io.c b/device/net_io.c index bad6d3eb..cabb1be9 100644 --- a/device/net_io.c +++ b/device/net_io.c @@ -386,22 +386,23 @@ boolean_t ethernet_priority(const

[PATCH glibc] Update hurd/intr-msg.c to be more portable

2023-05-03 Thread Flavio Cruz
Summary of the changes: - Introduce BAD_TYPECHECK from MiG to make it simpler to do type checking. - Replace int type with mach_msg_type_t. This assumes that mach_msg_type_t is always the same size as int which is not true for x86_64. - Calculate the size and align using PTR_ALIGN_UP, which

[PATCH glibc] Update sysdeps/mach/hurd/ioctl.c to make it more portable

2023-05-03 Thread Flavio Cruz
Summary of the changes: - Update msg_align to use ALIGN_UP like we have done in previous patches. Use it below whenever necessary to avoid repeating the same alignment logic. - Define BAD_TYPECHECK to make it easier to do type checking in a few places below. - Update io2mach_type to use

[PATCH gnumach] Use designated initializers in kern/exception.c

2023-05-03 Thread Flavio Cruz
--- kern/exception.c | 56 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/kern/exception.c b/kern/exception.c index 10435b5c..d3fa50e1 100644 --- a/kern/exception.c +++ b/kern/exception.c @@ -291,33 +291,33 @@ struct mach_exception

[PATCH hurd] Use designated initializers when building mach_msg_type_t

2023-05-03 Thread Flavio Cruz
--- boot/boot.c | 16 +++ console/display.c | 58 - libfshelp/start-translator-long.c | 56 - libpager/demuxer.c| 16 +++ libports/manage-multithread.c | 16 +++

[PATCH hurd] Use uintptr_t for message payloads.

2023-05-01 Thread Flavio Cruz
A follow up to 92fad38a043b75ed6b435b3efa574ede91dbe9ee in gnumach. --- auth/mig-decls.h| 2 +- eth-multiplexer/mig-decls.h | 2 +- exec/mig-decls.h| 2 +- libcons/priv.h | 2 +- libdiskfs/diskfs.h | 12 ++-- libmachdev/mig-decls.h |

[PATCH gnumach] Implement mig_deallocate to free memory when kernel server RPC succeeds

2023-05-01 Thread Flavio Cruz
In case the kernel interfaces use dynamically sized strings, we will end up calling mig_deallocate to free the out of line string that was copied into the kernel. As a matter of contract such type of data is freed automatically either in kernel code when the RPC fails or in the MiG stub if it

[PATCH gnumach] Use mig_support.h prototypes instead of duplicating them.

2023-05-01 Thread Flavio Cruz
* include/mach/mig_support.h: Drop the ifndef because this file is only used internally to compile gnumach. We export mig_support.h from glibc already. * kern/ipc_mig.c: len should be vm_size_t. * kern/ipc_mig.h: Drop duplicate prototypes. --- include/mach/mig_support.h | 4 +---

[PATCH glibc] Define __mig_strlen to support dynamically sized strings in hurd RPCs

2023-04-30 Thread Flavio Cruz
We make lib{mach,hurd}user.so only call __mig_strlen which can be relocated before libc.so is relocated, similar to what is done with __mig_memcpy. --- mach/Makefile | 2 +- mach/Versions | 1 + mach/mach/mig_support.h | 1 +

[PATCH mig] Add support for dynamically sized strings

2023-04-30 Thread Flavio Cruz
Dynamically sized strings can be represented as c_string[*] (*). We inline up to 64 bytes but can pass arbitrary strings if needed out of line. Currently implementation is limited to input arguments only (MiG will error out if used as output). In the user stub, we first run mig_strlen on the

[PATCH] Make __mach_msg_destroy portable for x86_64

2023-04-29 Thread Flavio Cruz
We need to align on uintptr_t to make this work for x86_64, otherwise things will go wrong when RPCs return errors. --- mach/msg-destroy.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mach/msg-destroy.c b/mach/msg-destroy.c index 7429ecbc2d..0a8b46c895 100644 ---

[PATCH] Define mig_strlen and __mig_strlen to support dynamically sized strings in hurd RPCs

2023-04-29 Thread Flavio Cruz
We make lib{mach,hurd}user.so call __mig_strlen which can be relocated before libc.so is relocated, similar to what is done with __mig_memcpy. --- mach/Makefile | 2 +- mach/Versions | 4 mach/mach/mig_support.h | 2 ++

Re: [PATCH gnumach] Use c_string for dev_name_t in the device subsystem.

2023-04-27 Thread Flavio Cruz
Hi Sergey On Wed, Apr 26, 2023 at 01:43:55PM +0300, Sergey Bugaev wrote: Hi Flavio, could you please explain what the difference / the advantage of new_dev_name_t is over dev_name_t? (Preferably, put it into the commit message too.) tl;dr; we can get rid of mach_msg_type_long_t on x86_64.

[PATCH mig] Add support for dynamically sized strings

2023-04-27 Thread Flavio Cruz
Dynamically sized strings can be represented as c_string[*] (*). We inline up to 64 bytes but can pass arbitrary strings if needed out of line. Currently implementation is limited to input arguments only (MiG will error out if used as output). In the user stub, we first run strlen on the

[PATCH gnumach] Use c_string for dev_name_t in the device subsystem.

2023-04-25 Thread Flavio Cruz
Added device_open_new and device_open_new_request and reused the old MiG ID for xxx_device_set_status which has not been in used in the past decade. Note that device_open_new is gated on defining DEVICE_ENABLE_DEVICE_OPEN_NEW because otherwise some hurd servers wouldn't compile anymore unless

Re: [PATCH] Include device/input.h in console-client

2023-04-24 Thread Flavio Cruz
Hi Samuel On Tue, Jan 10, 2023 at 10:20:19PM +0100, Samuel Thibault wrote: I was expecting it :) I'll wait a bit for the updated gnumach to get uploaded etc. before commiting it. Is it possible to merge this patch given that a new version of gnumach was released recently? Thanks Flavio

  1   2   3   4   >