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: Thu, 30 May 2019 04:06:39 -0700 From: Matthew Wilcox <willy@...radead.org> To: Anshuman Khandual <anshuman.khandual@....com> Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org, linux-arm-kernel@...ts.infradead.org, linux-ia64@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org, linux-s390@...r.kernel.org, linux-sh@...r.kernel.org, sparclinux@...r.kernel.org, Andrew Morton <akpm@...ux-foundation.org>, Michal Hocko <mhocko@...e.com>, Mark Rutland <mark.rutland@....com>, Christophe Leroy <christophe.leroy@....fr>, Stephen Rothwell <sfr@...b.auug.org.au>, Andrey Konovalov <andreyknvl@...gle.com>, Michael Ellerman <mpe@...erman.id.au>, Paul Mackerras <paulus@...ba.org>, Russell King <linux@...linux.org.uk>, Catalin Marinas <catalin.marinas@....com>, Will Deacon <will.deacon@....com>, Tony Luck <tony.luck@...el.com>, Fenghua Yu <fenghua.yu@...el.com>, Martin Schwidefsky <schwidefsky@...ibm.com>, Heiko Carstens <heiko.carstens@...ibm.com>, Yoshinori Sato <ysato@...rs.sourceforge.jp>, "David S. Miller" <davem@...emloft.net> Subject: Re: [RFC] mm: Generalize notify_page_fault() On Thu, May 30, 2019 at 11:25:13AM +0530, Anshuman Khandual wrote: > Similar notify_page_fault() definitions are being used by architectures > duplicating much of the same code. This attempts to unify them into a > single implementation, generalize it and then move it to a common place. > kprobes_built_in() can detect CONFIG_KPROBES, hence notify_page_fault() > must not be wrapped again within CONFIG_KPROBES. Trap number argument can This is a funny quirk of the English language. "must not" means "is not allowed to be", not "does not have to be". > @@ -141,6 +142,19 @@ static int __init init_zero_pfn(void) > core_initcall(init_zero_pfn); > > > +int __kprobes notify_page_fault(struct pt_regs *regs, unsigned int trap) > +{ > + int ret = 0; > + > + if (kprobes_built_in() && !user_mode(regs)) { > + preempt_disable(); > + if (kprobe_running() && kprobe_fault_handler(regs, trap)) > + ret = 1; > + preempt_enable(); > + } > + return ret; > +} > + > #if defined(SPLIT_RSS_COUNTING) Comparing this to the canonical implementation (ie x86), it looks similar. static nokprobe_inline int kprobes_fault(struct pt_regs *regs) { if (!kprobes_built_in()) return 0; if (user_mode(regs)) return 0; /* * To be potentially processing a kprobe fault and to be allowed to call * kprobe_running(), we have to be non-preemptible. */ if (preemptible()) return 0; if (!kprobe_running()) return 0; return kprobe_fault_handler(regs, X86_TRAP_PF); } The two handle preemption differently. Why is x86 wrong and this one correct?
Powered by blists - more mailing lists