public inbox for linux-riscv@lists.infradead.org
 help / color / mirror / Atom feed
From: "Rémi Denis-Courmont" <remi@remlab.net>
To: linux-riscv@lists.infradead.org
Subject: Re: [PATCH] RISC-V: Clobber V registers on syscalls
Date: Fri, 16 Jun 2023 22:58:31 +0300	[thread overview]
Message-ID: <7600111.eesqGedGrq@basile.remlab.net> (raw)
In-Reply-To: <mhng-10fcb0a9-cf4a-4416-ae30-120838a45bdb@palmer-ri-x1c9a>

Le torstaina 15. kesäkuuta 2023, 23.33.44 EEST Palmer Dabbelt a écrit :
> > The kernel cannot simply clobber registers, as that would likely cause
> > data leakage from kernel to user mode. So it is unclear what the benefits
> > would be
> What's the data leakage?

Typically "clobbering" the register means that you are writing something else 
in them. If you don't restore them (or expressly reset them to zero or some 
other fixed value), then you leak daata.

Of course, if you don't actually use the register, then you don't leak 
anything in them. But then it's unclear what the benefit of marking them as 
clobbered is.

(...)
> It'd have to be a pretty special case: at least in libstdc++ and glibc
> the futex calls are behind function calls,

Traditionally, atomic variable methods are intrinsics, which result in either 
inline or outline C runtime calls (with some ad-hoc ABI that clobbers very 
little). They cannot be C functions, since they accept parameters of several 
different types.

atomic_notify_one, atomic_notify_all, and atomic_wait or however their 
standardised names end up, will presumably be outlines of the later type, that 
just happen to wrap futex() on Linux.

But anyway, if the spec says that registers are clobbered by system calls as 
Björn pointed out, then that's that.

-- 
Rémi Denis-Courmont
http://www.remlab.net/




_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2023-06-16 19:58 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-14 16:35 [PATCH] RISC-V: Clobber V registers on syscalls Palmer Dabbelt
2023-06-15 17:36 ` Rémi Denis-Courmont
2023-06-15 20:33   ` Palmer Dabbelt
2023-06-16 19:58     ` Rémi Denis-Courmont [this message]
2023-06-16 19:47   ` Björn Töpel
2023-06-16 20:12 ` Björn Töpel
2023-06-19 18:18   ` Palmer Dabbelt
2023-06-19 19:01     ` Björn Töpel
2023-06-19 19:05       ` Palmer Dabbelt
2023-06-21 14:26         ` Björn Töpel
2023-06-21 14:44           ` Darius Rad
2023-06-21 18:16             ` Palmer Dabbelt
2023-06-21 14:50           ` Andy Chiu
2023-06-21 21:40             ` Björn Töpel
2023-06-22 15:47               ` Andy Chiu
2023-06-22 16:38                 ` Björn Töpel
2023-06-24  6:54                   ` Andy Chiu
2023-06-26 15:36                     ` Björn Töpel
2023-06-27  1:07                       ` Andy Chiu
2023-06-27  6:33                         ` Björn Töpel
2023-06-24  8:41                   ` Andy Chiu
2023-06-26 14:54                     ` Björn Töpel
2023-06-21 16:47           ` Rémi Denis-Courmont
2023-06-21 18:16             ` Palmer Dabbelt
2023-06-21 21:42               ` Björn Töpel
2025-06-16 22:30         ` Drew Fustini
2025-06-16 22:48           ` Drew Fustini

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=7600111.eesqGedGrq@basile.remlab.net \
    --to=remi@remlab.net \
    --cc=linux-riscv@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox