All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hajime Tazaki <thehajime@gmail.com>
To: benjamin@sipsolutions.net
Cc: linux-um@lists.infradead.org, ricarkol@google.com,
	Liam.Howlett@oracle.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v9 07/13] um: nommu: configure fs register on host syscall invocation
Date: Thu, 19 Jun 2025 21:57:55 +0900	[thread overview]
Message-ID: <m25xgr6g8c.wl-thehajime@gmail.com> (raw)
In-Reply-To: <2231a777eef3cdb339fe98af4618f958ed658df6.camel@sipsolutions.net>


On Thu, 19 Jun 2025 21:38:47 +0900,
Benjamin Berg wrote:
> 
> On Thu, 2025-06-19 at 21:22 +0900, Hajime Tazaki wrote:
> > 
> > On Thu, 19 Jun 2025 19:40:49 +0900,
> > Benjamin Berg wrote:
> > > 
> > > On Thu, 2025-06-19 at 10:04 +0900, Hajime Tazaki wrote:
> > > > As userspace on UML/!MMU also need to configure %fs register when
> > > > it is
> > > > running to correctly access thread structure, host syscalls
> > > > implemented
> > > > in os-Linux drivers may be puzzled when they are called.  Thus it
> > > > has to
> > > > configure %fs register via arch_prctl(SET_FS) on every host
> > > > syscalls.
> > > 
> > > Really, I still think that we should "just" get rid of libc
> > > entirely
> > > inside UML. That would avoid so many weird/potential issues …
> > 
> > I'm not sure if I understand your point.
> > 
> > Q1) what do you mean by 'get rid of libc entirely' here ?
> >     do you mean the following code block adds the dependency ?
> > + int os_arch_prctl(int pid, int option, unsigned long *arg2)
> > + {
> > + 	return syscall(SYS_arch_prctl, option, arg2);
> > + }
> > 
> > I guess this can be replaced with inline assembly instead of using
> > libc's one.  but this is the code under os-Linux, which I thought
> > we're
> > allowed to use the host code ?
> > 
> > Q2) "That would avoid so many weird/potential issues …"
> > I'm new to this;  I'm wondering what kind of issues did you see ?
> 
> Oh, I am just being annoyed by libc in general in UM. It isn't specific
> to this patchset.
> 
> An example is that we need to keep malloc() working for libc. Which I
> would think is kind of weird. Or we had issues because libc turned on
> rseq and that was inherited into userspace, causing random crashes and
> such.

I understand, thanks for the input.

> > > Doesn't change the fact that FS/GS needs to be restored when doing
> > > thread switches and such. Though one might be able to do it
> > > entirely
> > > within arch_switch_to then.
> > 
> > I believe this is already done in arch_switch_to.  This particular
> > patch does the control to the host context.
> 
> OK, need to look at that again a bit. I haven't really wrapped my mind
> around how everything fits together, so I probably got some stuff
> wrong.

anyway, thanks for your time to look at this.

-- Hajime


  reply	other threads:[~2025-06-19 15:48 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-19  1:04 [PATCH v9 00/13] nommu UML Hajime Tazaki
2025-06-19  1:04 ` [PATCH v9 01/13] x86/um: nommu: elf loader for fdpic Hajime Tazaki
2025-06-19  1:04 ` [PATCH v9 02/13] um: decouple MMU specific code from the common part Hajime Tazaki
2025-06-19  1:04 ` [PATCH v9 03/13] um: nommu: memory handling Hajime Tazaki
2025-06-19  1:04 ` [PATCH v9 04/13] x86/um: nommu: syscall handling Hajime Tazaki
2025-06-19 10:31   ` Benjamin Berg
2025-06-21 12:40     ` Hajime Tazaki
2025-06-19  1:04 ` [PATCH v9 05/13] um: nommu: seccomp syscalls hook Hajime Tazaki
2025-06-19  1:04 ` [PATCH v9 06/13] x86/um: nommu: process/thread handling Hajime Tazaki
2025-06-19 10:36   ` Benjamin Berg
2025-06-19 12:22     ` Hajime Tazaki
2025-06-19  1:04 ` [PATCH v9 07/13] um: nommu: configure fs register on host syscall invocation Hajime Tazaki
2025-06-19 10:40   ` Benjamin Berg
2025-06-19 12:22     ` Hajime Tazaki
2025-06-19 12:38       ` Benjamin Berg
2025-06-19 12:57         ` Hajime Tazaki [this message]
2025-06-19  1:04 ` [PATCH v9 08/13] x86/um/vdso: nommu: vdso memory update Hajime Tazaki
2025-06-19  1:04 ` [PATCH v9 09/13] x86/um: nommu: signal handling Hajime Tazaki
2025-06-19  1:04 ` [PATCH v9 10/13] um: nommu: a work around for MMU dependency to PCI driver Hajime Tazaki
2025-06-19  1:04 ` [PATCH v9 11/13] um: change machine name for uname output Hajime Tazaki
2025-06-19  1:04 ` [PATCH v9 12/13] um: nommu: add documentation of nommu UML Hajime Tazaki
2025-06-19  1:04 ` [PATCH v9 13/13] um: nommu: plug nommu code into build system Hajime Tazaki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m25xgr6g8c.wl-thehajime@gmail.com \
    --to=thehajime@gmail.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=benjamin@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-um@lists.infradead.org \
    --cc=ricarkol@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.