Mach time device, or: I know why the network deadlocks!

2023-04-28 Thread Sergey Bugaev
Hello! Here comes yet another bug description and a change proposal; hopefully not too long this time. (Update after having written like half of it: apparently it *is* going to be long.) My system regularly experiences network deadlocks: the system itself still works if I access it through the co

[PATCH 3/3] Mark various cold functions as __COLD

2023-04-29 Thread Sergey Bugaev
GCC docs explicitly list perror () as a good candidate for using __attribute__ ((cold)). So apply __COLD to perror () and similar functions. Signed-off-by: Sergey Bugaev --- include/error.h | 4 ++-- libio/stdio.h | 2 +- misc/err.h | 12 ++-- misc/error.h| 4 ++-- 4 files

[PATCH 2/3] hurd: Mark error functions as __COLD

2023-04-29 Thread Sergey Bugaev
This should hopefully hint the compiler that they are unlikely to be called. Signed-off-by: Sergey Bugaev --- hurd/hurd.h| 2 +- hurd/hurd/fd.h | 8 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hurd/hurd.h b/hurd/hurd.h index eca4abb7..06f00e93 100644 --- a/hurd

[PATCH 1/3] cdefs.h: Define __COLD

2023-04-29 Thread Sergey Bugaev
This expands to __attribute__ ((cold)) when supported. It should be used to mark up functions that are invoked rarely. Signed-off-by: Sergey Bugaev --- I can change __COLD to __attribute_cold__ if that is preferred. misc/sys/cdefs.h | 6 ++ 1 file changed, 6 insertions(+) diff --git a

[PATCH 1/7] hurd: Simplify _hurd_critical_section_lock a bit

2023-04-29 Thread Sergey Bugaev
This block of code was doing exactly what _hurd_self_sigstate does; so just call that and let it do its job. Signed-off-by: Sergey Bugaev --- hurd/hurd/signal.h | 14 +- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/hurd/hurd/signal.h b/hurd/hurd/signal.h index

[PATCH 2/7] hurd: Move libc_hidden_def's around

2023-04-29 Thread Sergey Bugaev
Each libc_hidden_def should be placed immediately next to its function, not in some random unrelated place. No functional change. Fixes: 653d74f12abea144219af00400ed1f1ac5dfa79f "hurd: Global signal disposition" Signed-off-by: Sergey Bugaev --- hurd/hurdsig.c | 9 + 1 file

[PATCH 5/7] hurd: Don't leak the auth port in msg* RPCs

2023-04-29 Thread Sergey Bugaev
-v $$ | grep task 36: send task(1577)(self) (refs: 505) $ portinfo -v $$ | grep task 36: send task(1577)(self) (refs: 631) Checked on i686-gnu. Signed-off-by: Sergey Bugaev --- hurd/hurdmsg.c | 67 +++--- 1 file changed, 58 insertions(+), 9

[PATCH 6/7] hurd: Respect existing FD_CLOEXEC in S_msg_set_fd

2023-04-29 Thread Sergey Bugaev
If the process has set the close-on-exec flag for the file descriptor, it expects the file descriptor to get closed on exec, even if we replace what the file descriptor refers to. Signed-off-by: Sergey Bugaev --- hurd/hurdmsg.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff

[PATCH 7/7] hurd: Fix FS_RETRY_MAGICAL "machtype" handling

2023-04-29 Thread Sergey Bugaev
-gnu. Signed-off-by: Sergey Bugaev --- hurd/lookup-retry.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/hurd/lookup-retry.c b/hurd/lookup-retry.c index 99c98104..62f94bbc 100644 --- a/hurd/lookup-retry.c +++ b/hurd/lookup-retry.c @@ -277,7 +277,6

[PATCH 4/7] hurd: Make _exit work during early boot-up

2023-04-29 Thread Sergey Bugaev
. Checked on x86_64-gnu. Signed-off-by: Sergey Bugaev --- sysdeps/mach/hurd/_exit.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sysdeps/mach/hurd/_exit.c b/sysdeps/mach/hurd/_exit.c index 73957744..80cfe532 100644 --- a/sysdeps/mach/hurd/_exit.c +++ b/sysdeps/mach/hurd

[PATCH 3/7] hurd: Mark various conditions as unlikely

2023-04-29 Thread Sergey Bugaev
Signed-off-by: Sergey Bugaev --- hurd/hurd/fd.h | 10 +- hurd/hurd/signal.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hurd/hurd/fd.h b/hurd/hurd/fd.h index 241797bf..824b7dbb 100644 --- a/hurd/hurd/fd.h +++ b/hurd/hurd/fd.h @@ -73,18 +73,18

Re: [PATCH] cdefs.h: Define __COLD

2023-04-29 Thread Sergey Bugaev
And of course right after I have sent it, I notice that I forgot the "Not GCC or clang." case. Sergey -- >8 -- >From 1b8c6563828399de563846525d0f525001f2d80d Mon Sep 17 00:00:00 2001 From: Sergey Bugaev Date: Thu, 27 Apr 2023 17:42:11 +0300 Subject: [PATCH] cdefs.h: Define __CO

Re: Mach time device, or: I know why the network deadlocks!

2023-04-29 Thread Sergey Bugaev
On Sat, Apr 29, 2023 at 7:39 AM Flávio Cruz wrote: > This never happened to me. Probably because I don't have NTP installed > in my Hurd box? That might explain it :) But I can't be the only one who wants their Hurd VM to have a sane notion of the current time across suspend-wake cycles of the h

[PATCH v3 1/6] hurd: Implement sigreturn for x86_64

2023-04-29 Thread Sergey Bugaev
Signed-off-by: Sergey Bugaev --- This incorporates back the fix made to the i386 version: we do need to call _hurd_self_sigstate () once after all. sysdeps/mach/hurd/x86_64/sigreturn.c | 162 +++ 1 file changed, 162 insertions(+) create mode 100644 sysdeps/mach/hurd

[PATCH v3 2/6] hurd: Implement longjmp for x86_64

2023-04-29 Thread Sergey Bugaev
Checked on x86_64-gnu. Signed-off-by: Sergey Bugaev --- I have checked that setjmp/longjmp actually works sucessfully, with both __longjmp and longjmp_chk. I have not been able to check w/ sigaltstack because we don't yet have the proc server and signals. Changes since v1: - dro

[PATCH v3 4/6] hurd: Add expected abilist files for x86_64

2023-04-29 Thread Sergey Bugaev
These were created by creating stub files, running 'make update-abi', and reviewing the results. Also, set baseline ABI to GLIBC_2.38, the (upcoming) first glibc release to first have x86_64-gnu support. Signed-off-by: Sergey Bugaev --- Changes compared to v2: - __pthread_self

[RFC PATCH v3 3/6] hurd: Replace reply port with a dead name on failed interruption

2023-04-29 Thread Sergey Bugaev
#x27;t get reused for some other right, and deallocate it in _hurd_intr_rpc_mach_msg once we return from the signal handler. Signed-off-by: Sergey Bugaev --- This is not required for x86_64, but probably a good idea anyway. I have checked that this does not fatally break things (this commit has been

[RFC PATCH v3 5/6] hurd: Make it possible to call memcpy very early

2023-04-29 Thread Sergey Bugaev
ubsequent calls of memcpy are going to call. Checked on x86_64-gnu. Signed-off-by: Sergey Bugaev --- Changes since v1: - drop the stpncpy, since it's apparently not required during early startup; - as a result of the above, there are no longer any changes to the i386 version; - drop t

[PATCH v3 0/6] The remaining x86_64-gnu patches

2023-04-29 Thread Sergey Bugaev
These are the patches that I have locally that have not (yet) been pushed. Most of them I have already sent previously, but have made changes to since then. Please see the notes on individual patches. I'm putting "v3" on the whole series because some of the patches here have already been through v

[DO NOT PUSH PATCH v3 6/6] TMP hurd: Lower BRK_START

2023-04-29 Thread Sergey Bugaev
...until gnumach learns to support higher addresses --- This is not meant to be pushed, but you're going to need this patch to run glibc on the current builds of gnumach. sysdeps/mach/hurd/x86_64/vm_param.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sysdeps/mach/hurd/x8

Re: [PATCH v3 4/6] hurd: Add expected abilist files for x86_64

2023-05-01 Thread Sergey Bugaev
On Mon, May 1, 2023 at 1:20 PM Samuel Thibault wrote: > Applied, thanks! I assume the delay means you have built it, and your results matched mine, in which case, \o/ I can hardly believe it no longer only exists on my machine :) Did you manage to run it? Thank you for changing pthread_t to be

Re: [PATCH 5/5] add setting gs/fsbase

2023-05-02 Thread Sergey Bugaev
On Tue, May 2, 2023 at 10:04 AM Samuel Thibault wrote: > I don't see any issue on 32bit gnumach: > > $ ./test > Killed > > Perhaps with is only with 64bit gnumach Yes, most likely it's something 64-bit specific. We know from experience that the 32-bit gnumach survives a task_terminate call just f

Re: [PATCH v3 4/6] hurd: Add expected abilist files for x86_64

2023-05-02 Thread Sergey Bugaev
On Mon, May 1, 2023 at 8:43 PM Samuel Thibault wrote: > > How do we proceed? I don't know enough about rump to get it building; > > We can easily cross-build debian packages thanks to the rebootstrap > scripts from Helmut: > > https://salsa.debian.org/helmutg/rebootstrap.git I didn't just mean th

Re: [PATCH v3 0/6] The remaining x86_64-gnu patches

2023-05-02 Thread Sergey Bugaev
Hello, On Tue, May 2, 2023 at 5:03 PM Joseph Myers wrote: > On Sat, 29 Apr 2023, Sergey Bugaev via Libc-alpha wrote: > > > If these patches are pushed, it should be possible for anyone to build > > x86_64-gnu glibc just out of Git master, without having to dig through &g

Re: [PATCH v3 4/6] hurd: Add expected abilist files for x86_64

2023-05-02 Thread Sergey Bugaev
On Tue, May 2, 2023 at 6:20 PM Samuel Thibault wrote: What I'm really interested in doing is 'bootstrapfs'... which is kind of the same thing as the boot shell, but with a different focus. Uhh, I need to put in the time to actually write one of those long letters detailing what I have in mind; b

Re: [PATCH v3 4/6] hurd: Add expected abilist files for x86_64

2023-05-02 Thread Sergey Bugaev
On Tue, May 2, 2023 at 7:08 PM Samuel Thibault wrote: > > Sergey Bugaev, le mar. 02 mai 2023 18:47:50 +0300, a ecrit: > > On Tue, May 2, 2023 at 6:20 PM Samuel Thibault > > wrote: > > > > What I'm really interested in doing is 'bootstrapfs'... wh

Re: [PATCH v3 4/6] hurd: Add expected abilist files for x86_64

2023-05-02 Thread Sergey Bugaev
On Tue, May 2, 2023 at 7:48 PM Samuel Thibault wrote: > You'll need to store the /dev directory etc. And possibly some temporary > conf files for some translators, etc. Really, an initrd doesn't seem too > horrible a thing. Better maintain few powerful tools than a series of > small tools that the

Re: [PATCH v3 4/6] hurd: Add expected abilist files for x86_64

2023-05-02 Thread Sergey Bugaev
On Tue, May 2, 2023 at 8:56 PM Samuel Thibault wrote: > > Sergey Bugaev, le mar. 02 mai 2023 19:34:02 +0300, a ecrit: > > On Tue, May 2, 2023 at 7:08 PM Samuel Thibault > > wrote: > > > > > > Sergey Bugaev, le mar. 02 mai 2023 18:47:50 +0300, a ecrit: &g

Re: [PATCH v3 4/6] hurd: Add expected abilist files for x86_64

2023-05-02 Thread Sergey Bugaev
On Tue, May 2, 2023 at 10:06 PM Samuel Thibault wrote: > > Sergey Bugaev, le mar. 02 mai 2023 21:59:40 +0300, a ecrit: > > I don't see how network/disk/USB are relevant > > What I mean is that we don't have much workforce. If we keep > reimplementing things that

Re: [PATCH v3 4/6] hurd: Add expected abilist files for x86_64

2023-05-02 Thread Sergey Bugaev
On Tue, May 2, 2023 at 11:43 PM Samuel Thibault wrote: > > Sergey Bugaev, le mar. 02 mai 2023 22:58:24 +0300, a ecrit: > > redoing bootstrap sounds rather interesting and challenging. It's not > > the most interesting thing right now though, which is why I haven't >

Re: [PATCH v3 4/6] hurd: Add expected abilist files for x86_64

2023-05-02 Thread Sergey Bugaev
On Wed, May 3, 2023 at 1:20 AM Samuel Thibault wrote: > Actually, even what depends on it. That's the whole thing the > rebootstrap script I mentioned is about, and it's making progress, it > should be able to produce essentially what is needed to run > debootstrap/crosshurd. Ah, I don't mean the

Re: Prospectives (Was: hurd: Add expected abilist files for x86_64)

2023-05-03 Thread Sergey Bugaev
Hello, I got a little bit overly emotional and personal over there yesterday, sorry about that. On Tue, May 2, 2023 at 11:18 PM Samuel Thibault wrote: > But at some point the less funny pieces also need to be done, otherwise > the system becomes irrelevant. Yes; but I can't really think of anyt

Re: Prospectives (Was: hurd: Add expected abilist files for x86_64)

2023-05-03 Thread Sergey Bugaev
On Wed, May 3, 2023 at 11:46 AM Almudena Garcia wrote: > Hi: Hi Almu! > I have this video that i recorded last year. But some days ago, i noticed > that desktop environment is buggy again, and i don't found applications like > midori, arora or vlc > https://www.youtube.com/watch?v=WFPw8WCe7Ew

Re: [PATCH v3 4/6] hurd: Add expected abilist files for x86_64

2023-05-05 Thread Sergey Bugaev
Hello, On Fri, May 5, 2023 at 4:30 PM Samuel Thibault wrote: > FI, I'm having debian hurd-amd64 packages cross-built, I'm getting e.g. > dash built, I'll probably have rumpkernel built too. Essentially, we > should be able to debootstrap a whole chroot. Awesome! Are these (binaries? debs?) avai

Re: [PATCH v3 4/6] hurd: Add expected abilist files for x86_64

2023-05-05 Thread Sergey Bugaev
On Fri, May 5, 2023 at 9:07 PM Luca wrote: > I'll try to build a ramdisk with these packages and see where we get > (not far I suppose, mainly because of the issues introduced by my last > fs/gs base patch... :( ). Quick update, I'm already running ramdisk (with glibc and Hurd built locally, not

Re: [PATCH v3 4/6] hurd: Add expected abilist files for x86_64

2023-05-05 Thread Sergey Bugaev
On Wed, May 3, 2023 at 1:37 AM Samuel Thibault wrote: > > Ah, I don't mean the troubles due to cross-compiling specifically (I > > don't think the Hurd libraries are any more problematic compared to > > the usual cross-compiling issues?), but simply the fact that they > > FTBFS on x86_64-gnu unles

Re: [PATCH 5/5] add setting gs/fsbase

2023-05-06 Thread Sergey Bugaev
Hello, On Tue, Apr 25, 2023 at 1:59 PM Samuel Thibault wrote: > Sergey Bugaev, le mar. 25 avril 2023 13:25:02 +0300, a ecrit: > > @@ -733,6 +734,10 @@ boolean_t thread_invoke( > > > > counter(c_thread_invoke_hits++); > >

Re: [PATCH 5/5] add setting gs/fsbase

2023-05-06 Thread Sergey Bugaev
On Sat, May 6, 2023 at 1:12 PM Sergey Bugaev wrote: > This is ld.so in the exec server task trying to dir_lookup > ("/hurd/exec") -- it then crashes ext2fs when it tries to access the > TCB. But before that, ext2fs starts up, spawns all those > libports/libpager worker threa

Re: [PATCH v3 4/6] hurd: Add expected abilist files for x86_64

2023-05-07 Thread Sergey Bugaev
On Sun, May 7, 2023 at 2:35 AM Samuel Thibault wrote: > Sergey Bugaev, le mar. 02 mai 2023 17:10:17 +0300, a ecrit: > > As for the best way to implement this... I have always thought gnumach > > should have a bootscript directive to expose a multiboot module as a > > memobj.

[PATCH 03/41] libiohelp: Port to x86_64

2023-05-08 Thread Sergey Bugaev
--- libiohelp/iouser-reauth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libiohelp/iouser-reauth.c b/libiohelp/iouser-reauth.c index 9edab7cf..d8fd11d9 100644 --- a/libiohelp/iouser-reauth.c +++ b/libiohelp/iouser-reauth.c @@ -33,7 +33,7 @@ error_t iohelp_reauth (struct io

[PATCH 05/41] libfshelp-tests: Port to x86_64

2023-05-08 Thread Sergey Bugaev
--- libfshelp-tests/race.c | 2 +- libfshelp-tests/test-fcntl.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libfshelp-tests/race.c b/libfshelp-tests/race.c index f44ef624..376ada23 100644 --- a/libfshelp-tests/race.c +++ b/libfshelp-tests/race.c @@ -33,7 +33,7 @@

[PATCH 11/41] libps: Port to x86_64

2023-05-08 Thread Sergey Bugaev
--- libps/host.c | 6 +++--- libps/proclist.c | 21 - libps/procstat.c | 18 -- libps/ps.h | 7 --- 4 files changed, 31 insertions(+), 21 deletions(-) diff --git a/libps/host.c b/libps/host.c index 3ef83cae..8b45639f 100644 --- a/libps/host.c ++

[PATCH 00/41] The x86_64 port

2023-05-08 Thread Sergey Bugaev
Hello! This is it -- my work on porting the Hurd proper to x86_64, and assorted fixes that came up. I've split into separate patches by components for ease of review. Most of the changes amount to being more strict about integer types: we can no longer use unsigned int, integer_t, size_t, vm_size

[PATCH 07/41] libnetfs: Port to x86_64

2023-05-08 Thread Sergey Bugaev
--- libnetfs/file-exec.c | 33 + libnetfs/io-read.c | 22 -- 2 files changed, 29 insertions(+), 26 deletions(-) diff --git a/libnetfs/file-exec.c b/libnetfs/file-exec.c index da49ac36..b5293afc 100644 --- a/libnetfs/file-exec.c +++ b/libnetfs/

[PATCH 04/41] libfshelp: Port to x86_64

2023-05-08 Thread Sergey Bugaev
--- libfshelp/exec-reauth.c | 4 ++-- libfshelp/fshelp.h| 19 --- libfshelp/start-translator-long.c | 16 ++-- libfshelp/start-translator.c | 5 +++-- 4 files changed, 27 insertions(+), 17 deletions(-) diff --git a/libfshelp/exec-reauth

[PATCH 01/41] libshouldbeinlibc: Port to x86_64

2023-05-08 Thread Sergey Bugaev
--- libshouldbeinlibc/fsysops.c| 2 +- libshouldbeinlibc/idvec-auth.c | 4 ++-- libshouldbeinlibc/portinfo.c | 14 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libshouldbeinlibc/fsysops.c b/libshouldbeinlibc/fsysops.c index dbcae672..eb04c397 100644 --- a

[PATCH 14/41] utils: Port to x86_64

2023-05-08 Thread Sergey Bugaev
--- utils/fakeauth.c | 36 +--- utils/frobauth.h | 2 +- utils/fsysopts.c | 5 +++-- utils/ftpdir.c| 3 ++- utils/login.c | 2 +- utils/pids.c | 9 + utils/pids.h | 11 +++ utils/ps.c| 2 +- utils/rpctrace.c | 8 +

[PATCH 37/41] console-client: Port to x86_64

2023-05-08 Thread Sergey Bugaev
--- console-client/trans.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/console-client/trans.h b/console-client/trans.h index c7ca6a79..6089b987 100644 --- a/console-client/trans.h +++ b/console-client/trans.h @@ -39,7 +39,7 @@ struct consnode does. */ error_t (*wr

[PATCH 13/41] libmachdev: Port to x86_64

2023-05-08 Thread Sergey Bugaev
--- libmachdev/trivfs_server.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmachdev/trivfs_server.c b/libmachdev/trivfs_server.c index 9c9f817d..71993f0b 100644 --- a/libmachdev/trivfs_server.c +++ b/libmachdev/trivfs_server.c @@ -32,7 +32,7 @@ #include #include #inc

[PATCH 08/41] libdiskfs: Port to x86_64

2023-05-08 Thread Sergey Bugaev
--- libdiskfs/dir-lookup.c | 2 +- libdiskfs/dir-readdir.c | 14 +++--- libdiskfs/diskfs.h | 5 +++-- libdiskfs/file-exec.c| 31 --- libdiskfs/file-get-fs-opts.c | 4 ++-- libdiskfs/file-get-trans.c | 10 +- libdiskfs/fi

[PATCH 15/41] utils: Avoid warnings about prototype mismatch

2023-05-08 Thread Sergey Bugaev
--- utils/parse.c | 5 - utils/ps.c| 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/utils/parse.c b/utils/parse.c index c3d28e5c..719494a4 100644 --- a/utils/parse.c +++ b/utils/parse.c @@ -119,7 +119,10 @@ parse_numlist (char *arg, int (*lookup_fn)(con

[PATCH 34/41] ext2fs: Port to x86_64

2023-05-08 Thread Sergey Bugaev
--- ext2fs/dir.c| 13 - ext2fs/ext2fs.c | 3 ++- ext2fs/hyper.c | 3 ++- ext2fs/ialloc.c | 10 ++ ext2fs/inode.c | 3 ++- ext2fs/pager.c | 5 +++-- 6 files changed, 23 insertions(+), 14 deletions(-) diff --git a/ext2fs/dir.c b/ext2fs/dir.c index 963f0843..ede3eda5 1

[PATCH 09/41] libstore: Port to x86_64

2023-05-08 Thread Sergey Bugaev
--- libstore/argp.c | 6 -- libstore/copy.c | 16 libstore/device.c | 28 +--- libstore/file.c | 32 libstore/nbd.c| 5 +++-- libstore/store.h | 9 - libstore/task.c | 8 +++- 7 files changed

[PATCH 33/41] fatfs: Port to x86_64

2023-05-08 Thread Sergey Bugaev
--- fatfs/dir.c | 6 +++--- fatfs/main.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fatfs/dir.c b/fatfs/dir.c index 2679a0ce..71974642 100644 --- a/fatfs/dir.c +++ b/fatfs/dir.c @@ -659,7 +659,7 @@ diskfs_direnter_hard (struct node *dp, const char *name, struct node *

[PATCH 02/41] libports: Port to x86_64

2023-05-08 Thread Sergey Bugaev
--- libports/manage-multithread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libports/manage-multithread.c b/libports/manage-multithread.c index 9f397b26..0f8af8ea 100644 --- a/libports/manage-multithread.c +++ b/libports/manage-multithread.c @@ -229,7 +229,7 @@ ports_mana

[PATCH 32/41] tmpfs: Port to x86_64

2023-05-08 Thread Sergey Bugaev
--- tmpfs/tmpfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmpfs/tmpfs.c b/tmpfs/tmpfs.c index 5483ec87..195813c4 100644 --- a/tmpfs/tmpfs.c +++ b/tmpfs/tmpfs.c @@ -282,7 +282,7 @@ diskfs_append_args (char **argz, size_t *argz_len) #define S(n, c) if ((lim & ((1 << n) -

[PATCH 12/41] libps: Silence a warning

2023-05-08 Thread Sergey Bugaev
GCC was complaining about the mismatch in types between the 'fn' pointer and the function pointers assigned to it. Since fn is meant to be used with different function types, represent it as a 'void *' and not a pointer to any particular function type. --- libps/ps.h | 2 +- 1 file changed, 1 inse

[PATCH 35/41] procfs: Port to x86_64

2023-05-08 Thread Sergey Bugaev
--- procfs/process.c | 18 +- procfs/rootdir.c | 8 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/procfs/process.c b/procfs/process.c index eaf5f45b..3170b775 100644 --- a/procfs/process.c +++ b/procfs/process.c @@ -162,17 +162,17 @@ process_file_gc_map

[PATCH 41/41] Style tweaks

2023-05-08 Thread Sergey Bugaev
--- console-client/trans.c| 80 +-- console-client/trans.h| 10 ++--- fatfs/dir.c | 12 +++--- libpager/pager-memcpy.c | 8 ++-- libports/manage-multithread.c | 6 +-- libps/proclist.c | 2 +- pflocal/pf.c

[PATCH 10/41] libpipe: Fix use-after-realloc

2023-05-08 Thread Sergey Bugaev
We cannot use old_buf after we realloc it, even just for subtracting it from another pointer. Instead, compute the offsets in advance. --- libpipe/pq.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libpipe/pq.c b/libpipe/pq.c index af380274..fff03e67 100644 --- a/lib

[PATCH 21/41] sutils: Port to x86_64

2023-05-08 Thread Sergey Bugaev
--- sutils/swapon.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sutils/swapon.c b/sutils/swapon.c index c965d8e2..30e2e2d6 100644 --- a/sutils/swapon.c +++ b/sutils/swapon.c @@ -523,11 +523,11 @@ main (int argc, char *argv[]) if (show) { vm_size_t *free

[PATCH 26/41] boot: Fix use-after-realloc

2023-05-08 Thread Sergey Bugaev
--- boot/boot.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/boot/boot.c b/boot/boot.c index b661f09c..144ca1c3 100644 --- a/boot/boot.c +++ b/boot/boot.c @@ -486,15 +486,16 @@ read_boot_script (char **buffer, size_t *length) if (p == buf + len) {

[PATCH 29/41] pflocal: Port to x86_64

2023-05-08 Thread Sergey Bugaev
--- pflocal/io.c | 12 +++- pflocal/pf.c | 6 -- pflocal/socket.c | 21 - 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/pflocal/io.c b/pflocal/io.c index 06749756..f621bbb3 100644 --- a/pflocal/io.c +++ b/pflocal/io.c @@ -48,6 +48,7 @@ S_

[PATCH 20/41] elfcore: Add support for saving x86_64 registers

2023-05-08 Thread Sergey Bugaev
--- exec/elfcore.c | 72 +- 1 file changed, 71 insertions(+), 1 deletion(-) diff --git a/exec/elfcore.c b/exec/elfcore.c index ab6dc2ba..c6aa2bc8 100644 --- a/exec/elfcore.c +++ b/exec/elfcore.c @@ -23,6 +23,7 @@ #include #include #include +#i

[PATCH 27/41] boot: Port to x64_64

2023-05-08 Thread Sergey Bugaev
--- boot/boot.c | 68 +++- boot/boot_script.c | 32 ++--- boot/boot_script.h | 4 +-- boot/userland-boot.c | 11 +-- 4 files changed, 61 insertions(+), 54 deletions(-) diff --git a/boot/boot.c b/boot/boot.c index 144ca1c3..

[PATCH 23/41] storeio: Port to x86_64

2023-05-08 Thread Sergey Bugaev
--- storeio/io.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/storeio/io.c b/storeio/io.c index 3c4cb9ff..f01e1918 100644 --- a/storeio/io.c +++ b/storeio/io.c @@ -86,13 +86,20 @@ trivfs_S_io_read (struct trivfs_protid *cred, data_t *data, ma

[PATCH 40/41] Disable Linux-based pfinet on x86_64

2023-05-08 Thread Sergey Bugaev
--- Makefile | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 874349c0..c611a9ea 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ lib-subdirs = libshouldbeinlibc libihash libiohelp libports \ # Hurd programs prog-subdirs = auth proc exec te

[PATCH 19/41] exec: Port to x86_64

2023-05-08 Thread Sergey Bugaev
--- exec/elfcore.c | 6 +++--- exec/exec.c| 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/exec/elfcore.c b/exec/elfcore.c index 5f489a1e..ab6dc2ba 100644 --- a/exec/elfcore.c +++ b/exec/elfcore.c @@ -168,7 +168,7 @@ dump_core (task_t task, file_t file, off_t corelimit,

[PATCH 24/41] devnode: Port to x86_64

2023-05-08 Thread Sergey Bugaev
--- devnode/devnode.c | 20 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/devnode/devnode.c b/devnode/devnode.c index f5a00f1b..3db098a2 100644 --- a/devnode/devnode.c +++ b/devnode/devnode.c @@ -193,8 +193,8 @@ ds_device_close (device_t device) kern_return_t

[PATCH 25/41] daemons: Port to x86_64

2023-05-08 Thread Sergey Bugaev
--- daemons/lmail.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/daemons/lmail.c b/daemons/lmail.c index 33ccf66b..ee6b6fdc 100644 --- a/daemons/lmail.c +++ b/daemons/lmail.c @@ -146,10 +146,11 @@ bfree (char *blk, size_t blk_len) /* Read up to MAX chars from IN in

[PATCH 30/41] startup: Port to x86_64

2023-05-08 Thread Sergey Bugaev
--- startup/startup.c | 20 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/startup/startup.c b/startup/startup.c index fd7503f4..feb7d265 100644 --- a/startup/startup.c +++ b/startup/startup.c @@ -266,7 +266,7 @@ reboot_system (int flags) if (fakeboot)

[PATCH 36/41] term: Port to x86_64

2023-05-08 Thread Sergey Bugaev
--- term/devio.c | 8 term/hurdio.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/term/devio.c b/term/devio.c index 65dea5d5..3b4e4845 100644 --- a/term/devio.c +++ b/term/devio.c @@ -536,7 +536,7 @@ device_open_reply (mach_port_t replyport, ma

[PATCH 39/41] Look for mach_i386 in mach/machine/

2023-05-08 Thread Sergey Bugaev
There's no mach/i386/ on x8_64. --- Makeconf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makeconf b/Makeconf index c2bf9926..7585260d 100644 --- a/Makeconf +++ b/Makeconf @@ -610,7 +610,7 @@ device_defs = $(addsuffix .defs,$(device_defs_names)) $(mach_defs): %.defs:

[PATCH 18/41] proc: Fix use-after-realloc

2023-05-08 Thread Sergey Bugaev
--- proc/info.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/proc/info.c b/proc/info.c index 12743465..d84fdd45 100644 --- a/proc/info.c +++ b/proc/info.c @@ -941,6 +941,8 @@ S_proc_getloginpids (struct proc *callerp, if (new - parray > parraysize)

[PATCH 06/41] libtrivfs: Port to x86_64

2023-05-08 Thread Sergey Bugaev
--- libtrivfs/file-get-trans.c | 7 --- libtrivfs/file-getfh.c | 2 +- libtrivfs/file-set-trans.c | 2 +- libtrivfs/fsys-forward.c | 3 ++- libtrivfs/fsys-getroot.c | 6 -- libtrivfs/fsys-stubs.c | 6 +++--- libtrivfs/io-restrict-auth.c | 10 ++ 7 file

[PATCH 28/41] eth-multiplexer: Port to x86_64

2023-05-08 Thread Sergey Bugaev
--- eth-multiplexer/device_impl.c | 18 ++ eth-multiplexer/ethernet.c| 4 ++-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/eth-multiplexer/device_impl.c b/eth-multiplexer/device_impl.c index 6a67fbd9..8a22793a 100644 --- a/eth-multiplexer/device_impl.c +++

[PATCH 16/41] auth: Port to x86_64

2023-05-08 Thread Sergey Bugaev
--- auth/auth.c | 29 +++-- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/auth/auth.c b/auth/auth.c index 925f790f..761185a8 100644 --- a/auth/auth.c +++ b/auth/auth.c @@ -79,7 +79,8 @@ destroy_authhandle (void *p) /* id management. */ static inline v

[PATCH 31/41] mach-defpager: Port to x86_64

2023-05-08 Thread Sergey Bugaev
--- mach-defpager/default_pager.c | 28 ++-- mach-defpager/file_io.h | 4 ++-- mach-defpager/setup.c | 4 ++-- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/mach-defpager/default_pager.c b/mach-defpager/default_pager.c index 82e8f526..2aaa

[PATCH 22/41] sutils: Avoid warnings about prototype mismatch

2023-05-08 Thread Sergey Bugaev
--- sutils/fsck.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sutils/fsck.c b/sutils/fsck.c index 0d3b1d46..6953f7fa 100644 --- a/sutils/fsck.c +++ b/sutils/fsck.c @@ -99,12 +99,12 @@ static int _debug = 0; static int got_sigquit = 0, got_sigint = 0; -static void

[PATCH 38/41] trans: Port to x86_64

2023-05-08 Thread Sergey Bugaev
--- trans/crash.c| 2 +- trans/fakeroot.c | 36 +++- trans/fifo.c | 4 +++- trans/magic.c| 8 trans/mtab.c | 11 ++- trans/new-fifo.c | 7 +-- trans/streamio.c | 7 +-- trans/symlink.c | 6 -- 8 files changed, 47 i

[PATCH 17/41] proc: Port to x86_64

2023-05-08 Thread Sergey Bugaev
--- proc/host.c | 10 +- proc/info.c | 24 proc/mgt.c | 12 ++-- proc/msg.c | 5 +++-- proc/pgrp.c | 6 +++--- 5 files changed, 29 insertions(+), 28 deletions(-) diff --git a/proc/host.c b/proc/host.c index e78e70da..e9f36f51 100644 --- a/proc/host.c +

Re: [PATCH 01/41] libshouldbeinlibc: Port to x86_64

2023-05-08 Thread Sergey Bugaev
On Tue, May 9, 2023 at 12:40 AM Samuel Thibault wrote: > > - size_t opts_len = sizeof opts; > > + mach_msg_type_number_t opts_len = sizeof opts; > > ? That doesn't make sense, sizeof does return size_t. sizeof returns size_t, yes. But this code later passes opts_len *by pointer* to fsys_get_opt

Re: [PATCH glibc] Stop checking if MiG supports retcode.

2023-05-09 Thread Sergey Bugaev
Hello, On Wed, May 10, 2023, 08:21 Flavio Cruz wrote: > HAVE_MIG_RETCODE is removed completely since this will be a no-op either > way (compiling against old Hurd headers will work the same, new Hurd > headers will result in the same stubs since retcode is a no-op). It is a no-op currently, but

Re: [PATCH 00/41] The x86_64 port

2023-05-10 Thread Sergey Bugaev
Hello, On Wed, May 10, 2023 at 3:55 AM Samuel Thibault wrote: > With the available .debs you should now be able to enable these. I'm afraid I'm going to need more guidance here. Your little tutorial in readme [0] is helpful (thank you!), but I still have questions. [0]: https://people.debian.or

Re: [PATCH 00/41] The x86_64 port

2023-05-10 Thread Sergey Bugaev
On Wed, May 10, 2023 at 1:43 PM Samuel Thibault wrote: > For now you'll just be faced with library dependencies, so I'd say just > unpack all lib*.deb (+zlib1g*.deb) and you'll be done. I see, thanks. By the way, I'm now getting ../../isofs/lookup.c:224:1: error: conflicting types for ‘diskfs_g

Re: [PATCH 00/41] The x86_64 port

2023-05-10 Thread Sergey Bugaev
An update from me: /hurd/startup starts up (which means that exec is now working -- how cool is that!) and then spawns auth and proc. But then proc task_terminate's itself (= exists with some error, likely), seemingly somewhere early, maybe even during ld.so startup -- before it gets a chance to o

Re: [PATCH 00/41] The x86_64 port

2023-05-10 Thread Sergey Bugaev
On Wed, May 10, 2023 at 7:39 PM Samuel Thibault wrote: > Sergey Bugaev, le mer. 10 mai 2023 19:30:20 +0300, a ecrit: > > Dynamic linking also adds its share of complexity, > > You can always create static builds of the various translators, by > running e.g. make proc.static i

Re: [PATCH 00/41] The x86_64 port

2023-05-10 Thread Sergey Bugaev
On Wed, May 10, 2023 at 9:05 PM Sergey Bugaev wrote: > _hurd_startup crashes on accessing 'args' it has just received from > the exec server in the __exec_startup_get_info. The data arrives > out-of-line, and... broken: > > > > argvType is { msgt_inline = 0, msg

[RFC PATCH 2/2] x86_64: Check for AST when exiting a syscall

2023-05-11 Thread Sergey Bugaev
...like it's already done when exiting a trap. This is required, since handing a syscall can result in an AST; in particular this happens when the current thread is being terminated, which sets AST_TERMINATE and expects the thread to never return to userspace. Fixes a kernel crash upon calling exi

[RFC PATCH 1/2] x86_64: Fix updating fsgs base on context switch

2023-05-11 Thread Sergey Bugaev
Commit 31dd30a94a682955c3c9e2f42252b4a07687067a "add setting gs/fsbase" added the code to set fs and gs bases on context_switch. However, this was only being done when switching context via the explicit switch_context() method, but not in other cases where the context is switched, such as with call

[PATCH] exec: Allow loading x86_64 executables on x86_64

2023-05-11 Thread Sergey Bugaev
Since we don't support mixing i386 and x86_64 binaries on the same system (as running them requires different build-time gnumach configurations), the exec server can simply require the binary being loaded to have been built for the same architecture as the exec server itself. --- exec/exec.c |

Re: [PATCH] exec: Allow loading x86_64 executables on x86_64

2023-05-11 Thread Sergey Bugaev
On Thu, May 11, 2023 at 5:34 PM Samuel Thibault wrote: > Note that I have added to gnumach CPU_TYPE_X86_64, used on 64bit gnumach > so that uname -m properly reports a 64bit architecture. So you'll rather > add the case CPU_TYPE_X86_64 there. Oh, I see -- that wasn't in my tree when I checked. H

Re: [PATCH] exec: Allow loading x86_64 executables on x86_64

2023-05-11 Thread Sergey Bugaev
On Thu, May 11, 2023 at 6:02 PM Samuel Thibault wrote: > See the commit I had just pushed ;) Hm, but that doesn't make sense to me. If we want a particular tool -- Unix uname(1) -- to output "i386" when running i386-gnu software on x86_64 hardware (and I don't actually know whether we want that,

__pthread_setcancelstate called unconditionally, crashes at 0

2023-05-11 Thread Sergey Bugaev
Hello, I'm hitting a crash with the following backtrace: #0 0x in ?? () #1 0x004660dd in __error_internal (status=1, errnum=1073741826, message=0x9adcef1c, args=0x9adcef18, args@entry=0x156aa48, mode_flags=2598170400, mode_flags@entry=0) at error.c:243 #2 0x0046

Re: __pthread_setcancelstate called unconditionally, crashes at 0

2023-05-11 Thread Sergey Bugaev
On Thu, May 11, 2023 at 8:44 PM Florian Weimer wrote: > Apparently, Hurd does not support async cancellation? Then > __pthread_setcancelstate never has to unwind, so you just turn it into a > non-weak symbol. It does in theory, htl/pt-cancel.c has a PTHREAD_CANCEL_ASYNCHRONOUS branch that calls i

Re: __pthread_setcancelstate called unconditionally, crashes at 0

2023-05-11 Thread Sergey Bugaev
On Thu, May 11, 2023 at 9:12 PM Florian Weimer wrote: > I'd expect __pthread_setcancelstate to act on asynchronous cancellation > if it is enabled. Once you implement that and have a strong symbol > reference to __pthread_setcancelstate, you'd pull in the cancellation > unwinder without additiona

[RFC PATCH v2] x86_64: Check for AST when exiting a syscall

2023-05-11 Thread Sergey Bugaev
...like it's already done when exiting a trap. This is required, since handing a syscall can result in an AST; in particular this happens when the current thread is being terminated, which sets AST_TERMINATE and expects the thread to never return to userspace. Fixes a kernel crash upon calling exi

It runs!

2023-05-12 Thread Sergey Bugaev
Hello everyone, I've got some exciting news :) /bin/sh runs!!! Things start up all the way -- exec, proc, auth, all that. Then /hurd/startup exec's /libexec/console-run; I placed a little shell script there. The shell (dash) starts up, loads the script, and starts executing it! And (this required

Re: sigsp on Hurd/x86_64

2023-05-12 Thread Sergey Bugaev
Hello, On Fri, May 12, 2023 at 10:15 PM Bruno Haible wrote: > make no sense to me. After this statement, sigsp is > either 0x > or 0x0010. > > If aligning SP is intended, the line should read > > sigsp = (void *) ((uintptr_t) sigsp & -16UL); Indeed -- thank you

Re: struct sigcontext in Hurd/x86_64

2023-05-12 Thread Sergey Bugaev
Hello, On Fri, May 12, 2023 at 10:12 PM Bruno Haible wrote: > * glibc/sysdeps/mach/hurd/x86_64/bits/sigcontext.h lines 57..79 > * glibc/sysdeps/mach/hurd/x86/trampoline.c lines 239..247. > This code copies the values from the stack into a 'struct sigcontext'. > But here the order of the regis

<    1   2   3   4   5   6   7   8   9   >