lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2023050937-scouring-truck-d7c0@gregkh>
Date:   Tue, 9 May 2023 10:46:37 +0200
From:   Greg KH <gregkh@...uxfoundation.org>
To:     Alice Ryhl <aliceryhl@...gle.com>
Cc:     gary@...yguo.net, alex.gaynor@...il.com, benno.lossin@...ton.me,
        bjorn3_gh@...tonmail.com, boqun.feng@...il.com,
        linux-kernel@...r.kernel.org, ojeda@...nel.org,
        patches@...ts.linux.dev, rust-for-linux@...r.kernel.org,
        wedsonaf@...il.com
Subject: Re: [PATCH v2] rust: error: add missing error codes

On Tue, May 09, 2023 at 08:07:00AM +0000, Alice Ryhl wrote:
> On Mon, 8 May 2023 12:47:01 +0100
> Gary Guo <gary@...yguo.net> wrote:
> > On Thu,  4 May 2023 06:48:54 +0000
> > Alice Ryhl <aliceryhl@...gle.com> wrote:
> > > This adds the error codes from `include/linux/errno.h` to the list of
> > > Rust error constants. These errors were not included originally, because
> > > they are not supposed to be visible from userspace. However, they are
> > > still a perfectly valid error to use when writing a kernel driver. For
> > > example, you might want to return ERESTARTSYS if you receive a signal
> > > during a call to `schedule`.
> > 
> > `include/linux/errno.h` also includes all of `asm/errno.h`,
> > which defines EDEADLK - EHWPOISON, which is not included in this patch.
> > I feel like these error codes should be added first?
> 
> It seems like there are a lot of asm/errno.h files:
> 
> $ find . -name errno.h
> ./arch/powerpc/include/uapi/asm/errno.h
> ./arch/mips/include/asm/errno.h
> ./arch/mips/include/uapi/asm/errno.h
> ./arch/alpha/include/uapi/asm/errno.h
> ./arch/parisc/include/uapi/asm/errno.h
> ./arch/sparc/include/uapi/asm/errno.h
> ./arch/x86/include/generated/uapi/asm/errno.h
> ./tools/arch/powerpc/include/uapi/asm/errno.h
> ./tools/arch/mips/include/asm/errno.h
> ./tools/arch/mips/include/uapi/asm/errno.h
> ./tools/arch/alpha/include/uapi/asm/errno.h
> ./tools/arch/parisc/include/uapi/asm/errno.h
> ./tools/arch/sparc/include/uapi/asm/errno.h
> ./tools/arch/x86/include/uapi/asm/errno.h
> ./tools/include/nolibc/errno.h
> ./tools/include/uapi/asm/errno.h
> ./tools/include/uapi/asm-generic/errno.h

You can ignore the tool ones.

> ./include/uapi/asm-generic/errno.h
> ./include/uapi/linux/errno.h
> ./include/linux/errno.h
> 
> How should I proceed with this? You mention EDEADLK - EHWPOISON, but its
> not clear to me which asm/errno.h file I should base this on.

It depends on which arch you are building for.  That's why we have
per-platform errno.h files, the values are different for different ones.
So you need to handle them all properly somehow.  How is rust going to
handle per-arch stuff like this?

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ