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
| ||
|
Date: Fri, 6 May 2022 11:55:35 -0400 From: Matthew Rosato <mjrosato@...ux.ibm.com> To: Christian Borntraeger <borntraeger@...ux.ibm.com>, linux-s390@...r.kernel.org Cc: alex.williamson@...hat.com, cohuck@...hat.com, schnelle@...ux.ibm.com, farman@...ux.ibm.com, pmorel@...ux.ibm.com, hca@...ux.ibm.com, gor@...ux.ibm.com, gerald.schaefer@...ux.ibm.com, agordeev@...ux.ibm.com, svens@...ux.ibm.com, frankja@...ux.ibm.com, david@...hat.com, imbrenda@...ux.ibm.com, vneethv@...ux.ibm.com, oberpar@...ux.ibm.com, freude@...ux.ibm.com, thuth@...hat.com, pasic@...ux.ibm.com, pbonzini@...hat.com, corbet@....net, jgg@...dia.com, kvm@...r.kernel.org, linux-kernel@...r.kernel.org, linux-doc@...r.kernel.org Subject: Re: [PATCH v6 14/21] KVM: s390: pci: provide routines for enabling/disabling interrupt forwarding On 5/6/22 11:35 AM, Christian Borntraeger wrote: > > > Am 26.04.22 um 22:08 schrieb Matthew Rosato: > [...] >> +static inline void unaccount_mem(unsigned long nr_pages) >> +{ >> + struct user_struct *user = get_uid(current_user()); >> + >> + if (user) >> + atomic_long_sub(nr_pages, &user->locked_vm); >> + if (current->mm) >> + atomic64_sub(nr_pages, ¤t->mm->pinned_vm); >> +} >> + >> +static inline int account_mem(unsigned long nr_pages) >> +{ >> + struct user_struct *user = get_uid(current_user()); >> + unsigned long page_limit, cur_pages, new_pages; >> + >> + page_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT; >> + >> + do { >> + cur_pages = atomic_long_read(&user->locked_vm); >> + new_pages = cur_pages + nr_pages; >> + if (new_pages > page_limit) >> + return -ENOMEM; >> + } while (atomic_long_cmpxchg(&user->locked_vm, cur_pages, >> + new_pages) != cur_pages); >> + >> + atomic64_add(nr_pages, ¤t->mm->pinned_vm); >> + >> + return 0; > > user->locked_vm is not available unconditionally. Shall we add > > CONFIG_S390 && CONFIG_KVM here? > > include/linux/sched/user.h > #if defined(CONFIG_PERF_EVENTS) || defined(CONFIG_BPF_SYSCALL) || \ > defined(CONFIG_NET) || defined(CONFIG_IO_URING) > atomic_long_t locked_vm; > #endif > Or we could get rid of the user memlock checking for now until this is > more ubiquitous. Oh, good catch. Per my conversation with Jason in a thread on patch 16, we will end up with a CONFIG_VFIO_PCI_ZDEV_KVM (or something like that) -- this could be used instead of CONFIG_S390 && CONFIG_KVM and would imply both of those anyway > > > Otherwise this looks sane > > Reviewed-by: Christian Borntraeger <borntraeger@...ux.ibm.com>
Powered by blists - more mailing lists