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: <CALvZod6k3Bm77xt4y=Mvf1Oi8XH25UJwLQaJaFNBFsBAcRuO_Q@mail.gmail.com>
Date:   Fri, 6 Aug 2021 02:23:17 -0700
From:   Shakeel Butt <shakeelb@...gle.com>
To:     Michal Hocko <mhocko@...e.com>
Cc:     Suren Baghdasaryan <surenb@...gle.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        David Rientjes <rientjes@...gle.com>,
        Matthew Wilcox <willy@...radead.org>,
        Johannes Weiner <hannes@...xchg.org>,
        Roman Gushchin <guro@...com>, Rik van Riel <riel@...riel.com>,
        Minchan Kim <minchan@...nel.org>,
        Christian Brauner <christian@...uner.io>,
        Christoph Hellwig <hch@...radead.org>,
        Oleg Nesterov <oleg@...hat.com>,
        David Hildenbrand <david@...hat.com>,
        Jann Horn <jannh@...gle.com>,
        Andy Lutomirski <luto@...nel.org>,
        Christian Brauner <christian.brauner@...ntu.com>,
        Florian Weimer <fweimer@...hat.com>,
        Jan Engelhardt <jengelh@...i.de>,
        Tim Murray <timmurray@...gle.com>,
        Linux API <linux-api@...r.kernel.org>,
        Linux MM <linux-mm@...ck.org>,
        LKML <linux-kernel@...r.kernel.org>,
        kernel-team <kernel-team@...roid.com>
Subject: Re: [PATCH v7 1/2] mm: introduce process_mrelease system call

On Thu, Aug 5, 2021 at 11:40 PM Michal Hocko <mhocko@...e.com> wrote:
>
[...]
> I think you really want something like this:
>
>         if (flags)
>                 return -EINVAL;
>
>         pid = pidfd_get_pid(fd, &f_flags);
>         if (IS_ERR(pid))
>                 return PTR_ERR(pid);
>         task = get_pid_task(pid, PIDTYPE_PID);
>         if (!task) {
>                 ret = -ESRCH;
>                 goto put_pid;
>         }
>
>         /*
>          * Make sure to chose a thread which still has a reference to mm
>          * during the group exit
>          */
>         p = find_lock_task_mm(task);
>         if (!p) {
>                 ret = -ESRCH;
>                 goto put_task;
>         }
>
>         mm = task->mm;

mm = p->mm;

>         mmgrab(mm);
>         reap = true;
>         /* If the work has been done already, just exit with success */
>         if (test_bit(MMF_OOM_SKIP, &mm->flags)) {
>                 reap = false;
>         } else if (!task_will_free_mem(p)) {
>                 reap = false;
>                 ret = -EINVAL;
>         }
>         task_unlock(p);
>
>         if (!reap)
>                 goto dropmm;;
>
>         /* Do the work*/
>
>
> dropmm:
>         mmdrop(mm);
> put_task:
>         put_task(task);
> put_pid:
>         put_pid(pid);
>
>         return ret;
>
> --
> Michal Hocko
> SUSE Labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ