rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Martin Uecker <uecker@tugraz.at>
Cc: Boqun Feng <boqun.feng@gmail.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>,
	Christoph Hellwig <hch@infradead.org>,
	rust-for-linux <rust-for-linux@vger.kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	David Airlie <airlied@gmail.com>,
	linux-kernel@vger.kernel.org, ksummit@lists.linux.dev
Subject: Re: Rust kernel policy
Date: Thu, 20 Feb 2025 15:53:50 +0100	[thread overview]
Message-ID: <2025022042-jot-favored-e755@gregkh> (raw)
In-Reply-To: <1d43700546b82cf035e24d192e1f301c930432a3.camel@tugraz.at>

On Thu, Feb 20, 2025 at 09:57:29AM +0100, Martin Uecker wrote:
> Am Donnerstag, dem 20.02.2025 um 08:10 +0100 schrieb Greg KH:
> > On Thu, Feb 20, 2025 at 08:03:02AM +0100, Martin Uecker wrote:
> > > Am Mittwoch, dem 19.02.2025 um 06:39 +0100 schrieb Greg KH:
> > > > On Tue, Feb 18, 2025 at 07:04:59PM -0800, Boqun Feng wrote:
> > > > > On Tue, Feb 18, 2025 at 04:58:27PM -0800, H. Peter Anvin wrote:
> > > > > [...]
> > > > > > > > 
> > > ...
> > > > 
> > > > 
> > > > I'm all for moving our C codebase toward making these types of problems
> > > > impossible to hit, the work that Kees and Gustavo and others are doing
> > > > here is wonderful and totally needed, we have 30 million lines of C code
> > > > that isn't going anywhere any year soon.  That's a worthy effort and is
> > > > not going to stop and should not stop no matter what.
> > > 
> > > It seems to me that these efforts do not see nearly as much attention
> > > as they deserve.
> > 
> > What more do you think needs to be done here?  The LF, and other
> > companies, fund developers explicitly to work on this effort.  Should we
> > be doing more, and if so, what can we do better?
> 
> Kees communicates with the GCC side and sometimes this leads to
> improvements, e.g. counted_by (I was peripherily involved in the
> GCC implementation). But I think much much more could be done,
> if there was a collaboration between compilers, the ISO C working
> group, and the kernel community to design and implement such
> extensions and to standardize them in ISO C.

Sorry, I was referring to the kernel work happening here by Kees and
Gustavo and others.  Not ISO C stuff, I don't know of any company that
wants to fund that :(

> > > I also would like to point out that there is not much investments
> > > done on C compiler frontends (I started to fix bugs in my spare time
> > > in GCC because nobody fixed the bugs I filed), and the kernel 
> > > community also is not currently involved in ISO C standardization.
> > 
> > There are kernel developers involved in the C standard committee work,
> > one of them emails a few of us short summaries of what is going on every
> > few months.  Again, is there something there that you think needs to be
> > done better, and if so, what can we do?
> > 
> > But note, ISO standards work is really rough work, I wouldn't recommend
> > it for anyone :)
> 
> I am a member of the ISO C working group. Yes it it can be painful, but
> it is also interesting and people a generally very nice.
> 
> There is currently no kernel developer actively involved, but this would
> be very helpful.
> 
> (Paul McKenney is involved in C++ regarding atomics and Miguel is
> also following what we do.)

Yes, some of us get reports from them and a few others at times as to
what's going on, but finding people, and companies, that want to do this
work is hard.  I recommend it for people that want to do this, and
applaud those that do, and am involved in other specification work at
the moment so I know the issues around all of this.

> > > I find this strange, because to me it is very obvious that a lot more
> > > could be done towards making C a lot safer (with many low hanging fruits),
> > > and also adding a memory safe subset seems possible.
> > 
> > Are there proposals to C that you feel we should be supporting more?
> 
> There are many things.
> 
> For example, there is an effort to remove cases of UB.  There are about
> 87 cases of UB in the core language (exlcuding preprocessor and library)
> as of C23, and we have removed 17 already for C2Y (accepted by WG14 into
> the working draft) and we have concrete propsoals for 12 more.  This
> currently focusses on low-hanging fruits, and I hope we get most of the
> simple cases removed this year to be able to focus on the harder issues.
> 
> In particulary, I have a relatively concrete plan to have a memory safe
> mode for C that can be toggled for some region of code and would make
> sure there is no UB or memory safety issues left (I am experimenting with
> this in the GCC FE).  So the idea is that one could start to activate this
> for certain critical regions of code to make sure there is no signed
> integer overflow or OOB access in it.   This is still in early stages, but
> seems promising. Temporal memory safety is harder and it is less clear
> how to do this ergonomically, but Rust shows that this can be done.

What do you mean by "memory safe" when it comes to C?  Any pointers to
that (pun intended)?

> I also have a proposal for a length-prefixed string type and for 
> polymorhic types / genericity, but this may not be so relevant to the
> kernel at this point.

We have a string type in the kernel much like this, it's just going to
take some work in plumbing it up everywhere.  Christoph touched on that
in one of his emails in this thread many messages ago.  Just grinding
out those patches is "all" that is needed, no need for us to wait for
any standard committee stuff.

> Even more important than ISO C proposals would be compiler extensions
> that can be tested before standardization.

We support a few already for gcc, and I don't think we've refused
patches to add more in the past, but I might have missed them.

thanks,

greg k-h

  parent reply	other threads:[~2025-02-20 14:53 UTC|newest]

Thread overview: 183+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-09 20:56 Rust kernel policy Miguel Ojeda
2025-02-18 16:08 ` Christoph Hellwig
2025-02-18 16:35   ` Jarkko Sakkinen
2025-02-18 16:39     ` Jarkko Sakkinen
2025-02-18 18:08       ` Jarkko Sakkinen
2025-02-18 21:22         ` Boqun Feng
2025-02-19  6:20           ` Jarkko Sakkinen
2025-02-19  6:35             ` Dave Airlie
2025-02-19 11:37               ` Jarkko Sakkinen
2025-02-19 13:25                 ` Geert Uytterhoeven
2025-02-19 13:40                   ` Jarkko Sakkinen
2025-02-19  7:05             ` Boqun Feng
2025-02-19 11:32               ` Jarkko Sakkinen
2025-02-18 17:36   ` Jiri Kosina
2025-02-20  6:33     ` Christoph Hellwig
2025-02-20 18:40       ` Alexei Starovoitov
2025-02-18 18:46   ` Miguel Ojeda
2025-02-18 21:49     ` H. Peter Anvin
2025-02-18 22:38       ` Dave Airlie
2025-02-18 22:54       ` Miguel Ojeda
2025-02-19  0:58         ` H. Peter Anvin
2025-02-19  3:04           ` Boqun Feng
2025-02-19  5:07             ` NeilBrown
2025-02-19  5:39             ` Greg KH
2025-02-19 15:05               ` Laurent Pinchart
2025-02-20 20:49                 ` Lyude Paul
2025-02-21 19:24                   ` Laurent Pinchart
2025-02-20  7:03               ` Martin Uecker
2025-02-20  7:10                 ` Greg KH
2025-02-20  8:57                   ` Martin Uecker
2025-02-20 13:46                     ` Dan Carpenter
2025-02-20 14:09                       ` Martin Uecker
2025-02-20 14:38                         ` H. Peter Anvin
2025-02-20 15:25                         ` Dan Carpenter
2025-02-20 15:49                         ` Willy Tarreau
2025-02-22 15:30                         ` Kent Overstreet
2025-02-20 14:53                     ` Greg KH [this message]
2025-02-20 15:40                       ` Martin Uecker
2025-02-21  0:46                         ` Miguel Ojeda
2025-02-21  9:48                         ` Dan Carpenter
2025-02-21 16:28                           ` Martin Uecker
2025-02-21 17:43                             ` Steven Rostedt
2025-02-21 18:07                               ` Linus Torvalds
2025-02-21 18:19                                 ` Steven Rostedt
2025-02-21 18:31                                 ` Martin Uecker
2025-02-21 19:30                                   ` Linus Torvalds
2025-02-21 19:59                                     ` Martin Uecker
2025-02-21 20:11                                       ` Linus Torvalds
2025-02-22  7:20                                         ` Martin Uecker
2025-02-21 22:24                                     ` Steven Rostedt
2025-02-21 23:04                                       ` Linus Torvalds
2025-02-22 17:53                                         ` Kent Overstreet
2025-02-22 18:44                                           ` Linus Torvalds
2025-02-23 16:42                                         ` David Laight
2025-02-22 18:42                                       ` Linus Torvalds
2025-02-22  9:45                                   ` Dan Carpenter
2025-02-22 10:25                                     ` Martin Uecker
2025-02-22 11:07                                       ` Greg KH
2025-02-21 18:23                               ` Martin Uecker
2025-02-21 22:14                                 ` Steven Rostedt
2025-03-01 13:22                             ` Askar Safin
2025-03-01 13:55                               ` Martin Uecker
2025-03-02  6:50                               ` Kees Cook
2025-02-21 18:11                           ` Theodore Ts'o
2025-02-24  8:12                             ` Dan Carpenter
2025-02-20 22:08                     ` Paul E. McKenney
2025-02-22 23:42                     ` Piotr Masłowski
2025-02-23  8:10                       ` Martin Uecker
2025-02-23 23:31                       ` comex
2025-02-24  9:08                         ` Ventura Jack
2025-02-24 18:03                           ` Martin Uecker
2025-02-20 12:28               ` Jan Engelhardt
2025-02-20 12:37                 ` Greg KH
2025-02-20 13:23                   ` H. Peter Anvin
2025-02-20 13:51                     ` Willy Tarreau
2025-02-20 15:17                     ` C aggregate passing (Rust kernel policy) Jan Engelhardt
2025-02-20 16:46                       ` Linus Torvalds
2025-02-20 20:34                       ` H. Peter Anvin
2025-02-21  8:31                       ` HUANG Zhaobin
2025-02-21 18:34                       ` David Laight
2025-02-21 19:12                         ` Linus Torvalds
2025-02-21 20:07                           ` comex
2025-02-21 21:45                           ` David Laight
2025-02-22  6:32                             ` Willy Tarreau
2025-02-22  6:37                               ` Willy Tarreau
2025-02-22  8:41                                 ` David Laight
2025-02-22  9:11                                   ` Willy Tarreau
2025-02-21 20:06                         ` Jan Engelhardt
2025-02-21 20:23                           ` Laurent Pinchart
2025-02-21 20:24                             ` Laurent Pinchart
2025-02-21 22:02                             ` David Laight
2025-02-21 22:13                               ` Bart Van Assche
2025-02-22  5:56                                 ` comex
2025-02-21 20:26                           ` Linus Torvalds
2025-02-20 22:13               ` Rust kernel policy Paul E. McKenney
2025-02-21  5:19               ` Felipe Contreras
2025-02-21  5:36                 ` Boqun Feng
2025-02-21  5:59                   ` Felipe Contreras
2025-02-21  7:04                     ` Dave Airlie
2025-02-24 20:27                       ` Felipe Contreras
2025-02-24 20:37                     ` Boqun Feng
2025-02-26  2:42                       ` Felipe Contreras
2025-02-22 16:04               ` Kent Overstreet
2025-02-22 17:10                 ` Ventura Jack
2025-02-22 17:34                   ` Kent Overstreet
2025-02-23  2:08                 ` Bart Van Assche
2025-02-19  5:53             ` Alexey Dobriyan
2025-02-19  5:59           ` Dave Airlie
2025-02-22 18:46             ` Kent Overstreet
2025-02-19 12:37           ` Miguel Ojeda
2025-02-20 11:26       ` Askar Safin
2025-02-20 12:33       ` vpotach
2025-02-19 18:52     ` Kees Cook
2025-02-19 19:08       ` Steven Rostedt
2025-02-19 19:17         ` Kees Cook
2025-02-19 20:27           ` Jason Gunthorpe
2025-02-19 20:46             ` Steven Rostedt
2025-02-19 20:52               ` Bart Van Assche
2025-02-19 21:07                 ` Steven Rostedt
2025-02-20 16:05                   ` Jason Gunthorpe
2025-02-20  8:13                 ` Jarkko Sakkinen
2025-02-20  8:16                   ` Jarkko Sakkinen
2025-02-20 11:57                   ` Fiona Behrens
2025-02-20 14:07                     ` Jarkko Sakkinen
2025-02-21 10:19                       ` Jarkko Sakkinen
2025-02-22 12:10                         ` Miguel Ojeda
2025-03-04 11:17                       ` Fiona Behrens
2025-03-04 17:48                         ` Jarkko Sakkinen
2025-02-20  9:55                 ` Leon Romanovsky
2025-02-19 19:33       ` H. Peter Anvin
2025-02-20  6:32         ` Alexey Dobriyan
2025-02-20  6:53           ` Greg KH
2025-02-20  8:44             ` Alexey Dobriyan
2025-02-20 13:53             ` Willy Tarreau
2025-02-20 16:04             ` Jason Gunthorpe
2025-02-20 12:01           ` H. Peter Anvin
2025-02-20 12:13             ` H. Peter Anvin
2025-02-20 23:42         ` Miguel Ojeda
2025-02-22 15:21           ` Kent Overstreet
2025-02-20  6:42     ` Christoph Hellwig
2025-02-20 23:44       ` Miguel Ojeda
2025-02-21 15:24         ` Simona Vetter
2025-02-22 12:10           ` Miguel Ojeda
2025-02-26 13:17           ` Fiona Behrens
2025-02-21  0:39       ` Linus Torvalds
2025-02-21 12:16         ` Danilo Krummrich
2025-02-21 15:59           ` Steven Rostedt
2025-02-23 18:03           ` Laurent Pinchart
2025-02-23 18:31             ` Linus Torvalds
2025-02-26 16:05               ` Jason Gunthorpe
2025-02-26 19:32                 ` Linus Torvalds
2025-02-19  8:05   ` Dan Carpenter
2025-02-19 14:14     ` James Bottomley
2025-02-19 14:30       ` Geert Uytterhoeven
2025-02-19 14:46       ` Martin K. Petersen
2025-02-19 14:51         ` Bartosz Golaszewski
2025-02-19 15:15         ` James Bottomley
2025-02-19 15:33           ` Willy Tarreau
2025-02-19 15:45             ` Laurent Pinchart
2025-02-19 15:46             ` James Bottomley
2025-02-19 15:56               ` Willy Tarreau
2025-02-19 16:07                 ` Laurent Pinchart
2025-02-19 16:15                   ` Willy Tarreau
2025-02-19 16:32                     ` Laurent Pinchart
2025-02-19 16:34                       ` Willy Tarreau
2025-02-19 16:33                     ` Steven Rostedt
2025-02-19 16:47                       ` Andrew Lunn
2025-02-19 18:22                       ` Jarkko Sakkinen
2025-02-20  6:26                       ` Alexey Dobriyan
2025-02-20 15:37                         ` Steven Rostedt
2025-02-19 17:00           ` Martin K. Petersen
2025-02-19 15:13       ` Steven Rostedt
2025-02-19 14:05   ` James Bottomley
2025-02-19 15:08     ` Miguel Ojeda
2025-02-19 16:03       ` James Bottomley
2025-02-19 16:44         ` Miguel Ojeda
2025-02-19 17:06           ` Theodore Ts'o
2025-02-20 23:40             ` Miguel Ojeda
2025-02-22 15:03             ` Kent Overstreet
2025-02-20 16:03           ` James Bottomley
2025-02-20 23:47             ` Miguel Ojeda
2025-02-20  6:48         ` Christoph Hellwig
2025-02-20 12:56           ` James Bottomley

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=2025022042-jot-favored-e755@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=airlied@gmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=hch@infradead.org \
    --cc=hpa@zytor.com \
    --cc=ksummit@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=uecker@tugraz.at \
    /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;
as well as URLs for NNTP newsgroup(s).