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]
Date:   Mon, 14 Feb 2022 14:27:03 +0900
From:   Sergey Senozhatsky <senozhatsky@...omium.org>
To:     Miguel Ojeda <ojeda@...nel.org>
Cc:     Linus Torvalds <torvalds@...ux-foundation.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org,
        Wedson Almeida Filho <wedsonaf@...gle.com>,
        Alex Gaynor <alex.gaynor@...il.com>,
        Geoffrey Thomas <geofft@...reload.com>,
        Finn Behrens <me@...enk.de>,
        Adam Bratschi-Kaye <ark.email@...il.com>,
        Michael Ellerman <mpe@...erman.id.au>,
        Sumera Priyadarsini <sylphrenadin@...il.com>,
        Sven Van Asbroeck <thesven73@...il.com>,
        Gary Guo <gary@...yguo.net>,
        Boris-Chengbiao Zhou <bobo1239@....de>,
        Boqun Feng <boqun.feng@...il.com>,
        Fox Chen <foxhlchen@...il.com>,
        Dan Robertson <daniel.robertson@...rlab.io>,
        Viktor Garske <viktor@...ar.de>,
        Dariusz Sosnowski <dsosnowski@...snowski.pl>,
        Léo Lanteri Thauvin 
        <leseulartichaut@...il.com>, Niklas Mohrin <dev@...lasmohrin.de>,
        Gioh Kim <gurugio@...il.com>, Daniel Xu <dxu@...uu.xyz>,
        Milan Landaverde <milan@...verde.com>,
        Morgan Bartlett <mjmouse9999@...il.com>,
        Maciej Falkowski <m.falkowski@...sung.com>,
        Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>,
        Petr Mladek <pmladek@...e.com>,
        Sergey Senozhatsky <senozhatsky@...omium.org>,
        Steven Rostedt <rostedt@...dmis.org>,
        John Ogness <john.ogness@...utronix.de>
Subject: Re: [PATCH v4 10/20] rust: add `kernel` crate

On (22/02/12 14:03), Miguel Ojeda wrote:
[..]
> +unsafe impl GlobalAlloc for KernelAllocator {
> +    unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
> +        // `krealloc()` is used instead of `kmalloc()` because the latter is
> +        // an inline function and cannot be bound to as a result.
> +        unsafe { bindings::krealloc(ptr::null(), layout.size(), bindings::GFP_KERNEL) as *mut u8 }

[..]

> +impl<const ORDER: u32> Pages<ORDER> {
> +    /// Allocates a new set of contiguous pages.
> +    pub fn new() -> Result<Self> {
> +        // TODO: Consider whether we want to allow callers to specify flags.
> +        // SAFETY: This only allocates pages. We check that it succeeds in the next statement.
> +        let pages = unsafe {
> +            bindings::alloc_pages(
> +                bindings::GFP_KERNEL | bindings::__GFP_ZERO | bindings::__GFP_HIGHMEM,
> +                ORDER,
> +            )
> +        };

[..]

Is this flexible enough? Why not let user pass bindings::GFP_* bitmask,
just like what the underlying kernel API does.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ