Re: [PATCH] Implement leftpad syscall

2016-04-01 Thread Scotty Bauer
On 03/31/2016 04:33 PM, Richard Weinberger wrote: > From: David Gstir > > Implement the leftpad() system call such that userspace, > especially node.js applications, can in the near future directly > use it and no longer depend on fragile npm packages. > > Signed-off-by: David Gstir > Signed-

Re: [PATCH v4 0/4] SROP Mitigation: Sigreturn Cookies

2016-03-29 Thread Scotty Bauer
On 03/29/2016 05:25 PM, Linus Torvalds wrote: > On Tue, Mar 29, 2016 at 6:11 PM, Scotty Bauer wrote: >> >> Yeah I had toyed with using hashes, I used hash_64 not md5 which is like 14 >> extra instructions or something. > > That sounds fine. Anything that requires

Re: [PATCH v4 0/4] SROP Mitigation: Sigreturn Cookies

2016-03-29 Thread Scotty Bauer
On 03/29/2016 04:34 PM, Linus Torvalds wrote: > On Tue, Mar 29, 2016 at 4:38 PM, Andy Lutomirski wrote: >> >> Then there's an unanswered question: is this patch acceptable given >> that it's an ABI break? Security fixes are sometimes an exception to >> the "no ABI breaks" rule, but it's by no m

Re: [PATCH v4 0/4] SROP Mitigation: Sigreturn Cookies

2016-03-29 Thread Scotty Bauer
On 03/29/2016 04:54 PM, Linus Torvalds wrote: > On Tue, Mar 29, 2016 at 2:53 PM, Scott Bauer wrote: >> >> These patches implement the necessary changes to generate a cookie >> which will be placed above signal frame upon signal delivery to userland. >> The cookie is generated using a per-process

Re: [PATCH v4 0/4] SROP Mitigation: Sigreturn Cookies

2016-03-29 Thread Scotty Bauer
On 03/29/2016 03:29 PM, Andy Lutomirski wrote: > On Tue, Mar 29, 2016 at 12:53 PM, Scott Bauer wrote: >> Sigreturn-oriented programming is a new attack vector in userland >> where an attacker crafts a fake signal frame on the stack and calls >> sigreturn. The kernel will extract the fake signal

Re: [PATCH v4 3/4] Sysctl: SROP Mitigation: Add Sysctl argument to disable SROP.

2016-03-29 Thread Scotty Bauer
On 03/29/2016 01:59 PM, Andi Kleen wrote: > On Tue, Mar 29, 2016 at 01:53:26PM -0600, Scott Bauer wrote: >> This patch adds a sysctl argument to disable SROP protection. > > Sysctl needs to be documented in Documentation/sysctl/ > > Also negated sysctl is weird, normally they are positive (ena

Re: [PATCH v3 1/3] SROP Mitigation: Architecture independent code for signal cookies

2016-03-09 Thread Scotty Bauer
On 03/09/2016 01:32 AM, Ingo Molnar wrote: > > * Scott Bauer wrote: > >> This patch adds a per-process secret to the task struct which >> will be used during signal delivery and during a sigreturn. >> Also, logic is added in signal.c to generate, place, extract, >> clear and verify the signal

Re: [PATCH v3 1/3] SROP Mitigation: Architecture independent code for signal cookies

2016-03-09 Thread Scotty Bauer
On 03/08/2016 02:57 PM, Andy Lutomirski wrote: > On Tue, Mar 8, 2016 at 1:49 PM, Scotty Bauer wrote: >> >> >> On 03/08/2016 01:58 PM, Andy Lutomirski wrote: >>> On Tue, Mar 8, 2016 at 12:47 PM, Scott Bauer wrote: >>>> This patch adds a per-process se

Re: [PATCH v3 1/3] SROP Mitigation: Architecture independent code for signal cookies

2016-03-08 Thread Scotty Bauer
On 03/08/2016 02:57 PM, Andy Lutomirski wrote: > On Tue, Mar 8, 2016 at 1:49 PM, Scotty Bauer wrote: >> >> >> On 03/08/2016 01:58 PM, Andy Lutomirski wrote: >>> On Tue, Mar 8, 2016 at 12:47 PM, Scott Bauer wrote: >>>> This patch adds a per-process se

Re: [PATCH v3 1/3] SROP Mitigation: Architecture independent code for signal cookies

2016-03-08 Thread Scotty Bauer
On 03/08/2016 01:58 PM, Andy Lutomirski wrote: > On Tue, Mar 8, 2016 at 12:47 PM, Scott Bauer wrote: >> This patch adds a per-process secret to the task struct which >> will be used during signal delivery and during a sigreturn. >> Also, logic is added in signal.c to generate, place, extract, >>

Re: [PATCH v3 2/3] x86: SROP mitigation: implement signal cookies

2016-03-08 Thread Scotty Bauer
On 03/08/2016 02:03 PM, One Thousand Gnomes wrote: >> static int ia32_restore_sigcontext(struct pt_regs *regs, >> - struct sigcontext_32 __user *sc) >> + struct sigcontext_32 __user *sc, >> + void __user **

Re: [PATCHv2 2/2] x86: SROP mitigation: implement signal cookies

2016-02-08 Thread Scotty Bauer
On 02/08/2016 02:50 PM, Andy Lutomirski wrote: > On Sun, Feb 7, 2016 at 12:10 AM, Scotty Bauer wrote: >> >> >> On 02/06/2016 11:35 PM, Mika Penttilä wrote: >>> Hi, >>> >>> >>> On 07.02.2016 01:39, Scott Bauer wrote: >>>> This

Re: [PATCHv2 2/2] x86: SROP mitigation: implement signal cookies

2016-02-07 Thread Scotty Bauer
On 02/06/2016 11:35 PM, Mika Penttilä wrote: > Hi, > > > On 07.02.2016 01:39, Scott Bauer wrote: >> This patch adds SROP mitigation logic to the x86 signal delivery >> and sigreturn code. The cookie is placed in the unused alignment >> space above the saved FP state, if it exists. If there is n

Re: dm ioctl: Access user-land memory through safe functions.

2016-01-06 Thread Scotty Bauer
On 01/05/2016 02:13 PM, Mike Snitzer wrote: > On Tue, Jan 05 2016 at 3:16pm -0500, > Mike Snitzer wrote: > >> On Tue, Dec 08 2015 at 1:26pm -0500, >> Scotty Bauer wrote: >> >>> Friendly ping, is anyone interested in this? >> >> The passed @

Re: [PATCH] dm ioctl: Access user-land memory through safe functions.

2015-12-08 Thread Scotty Bauer
On 12/01/2015 11:11 AM, Scotty wrote: > > 0001-dm-ioctl-Access-user-land-memory-through-safe-functi.patch > > > From b26adf880eba03ac6f2b1dd87426bb96fd2a0282 Mon Sep 17 00:00:00 2001 > From: Scotty Bauer > Date: Tue, 1 Dec 2015 10:52:46 -0700 > Subject: [PATCH] dm

Re: Accessing user-land memory without safe functions

2015-12-03 Thread Scotty Bauer
wrote: > On Thu, 3 Dec 2015 13:54:30 -0700 > Scotty Bauer wrote: > >> Since I've seen this a couple times now I'm wondering if my >> understanding of touching user-land memory is flawed. >> >> For the above example Ioctl, the proper way to get access to th

Accessing user-land memory without safe functions

2015-12-03 Thread Scotty Bauer
I Have been auditing a few drivers and have found some of them are accessing user-land memory without either mapping the pages in, or copying the data via the safe user access apis. The thing I have mostly been seeing is something along the lines of: ioctl(etc, etc, arg) { char buf[32]; __user

Re: [ftrace] possible to implement user-space tracers?

2015-08-11 Thread Scotty Bauer
It is possible to trace from userland, Android does it. Essentially you need to write your data into /sys/kernel/debug/tracing/trace_marker then read it out of /sys/kernel/debug/tracing/trace If you care how the implementation works you can read it in /kernel/tracing/trace.c (http://lxr.fr

Re: [PATCH] x86/smpboot: check if CLFLUSH is actually necessary

2015-02-11 Thread Scotty Bauer
On 02/11/2015 02:55 PM, H. Peter Anvin wrote: > On 01/30/2015 01:26 PM, Scotty Bauer wrote: >> mwait_play_dead previously issued a CLFLUSH to work around a bug on >> some xeon processors. We can now determine if the CPU is a buggy CPU. >> This patch checks if if we're o

Re: [PATCH] x86, smpboot: Call CLFLUSH only on X86_BUG_CLFLUSH_MONITOR-affected CPUs

2015-02-11 Thread Scotty Bauer
0 machines only instead of > punishing all CPUs doing idle with MWAIT with the CLFLUSH penalty. > > Based on a patch originally by Scotty Bauer . > > Cc: Scotty Bauer > Signed-off-by: Borislav Petkov > --- > arch/x86/kernel/smpboot.c | 6 +- > 1 file changed, 5 ins

[PATCH] x86/smpboot: check if CLFLUSH is actually necessary

2015-01-30 Thread Scotty Bauer
mwait_play_dead previously issued a CLFLUSH to work around a bug on some xeon processors. We can now determine if the CPU is a buggy CPU. This patch checks if if we're on a buggy CPU which allows non-buggy cpu's to eliminate the CLFLUSH. >From 3da1be5c998a8d51f98fdba09b3cb477526c5ff3 Mon Se

Re: [PATCH] kern/sys: Compat sysinfo syscall fix undefined behavior

2014-09-04 Thread Scotty Bauer
On 09/04/2014 02:14 PM, Andrew Morton wrote: > If I'm reading it correctly, this is all dead code because si_meminfo() > unconditionally sets sysinfo.mem_unit to PAGE_SIZE. It could all do with a > bit of a cleanup, I suspect. I'll do a little more research on this and do further clean up, if r

[PATCH] kern/sys: Compat sysinfo syscall fix undefined behavior

2014-09-04 Thread Scotty Bauer
Fix undefined behavior and compiler warning by replacing right shift 32 with upper_32_bits macro Signed-off-by: Scotty Bauer --- kernel/sys.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sys.c b/kernel/sys.c index ce81291..c78530b 100644 --- a/kernel/sys.c +++ b

Compat sysinfo syscall (kernel/sys.c) relying on undefined behavior?

2014-09-02 Thread Scotty Bauer
am getting acquainted with the linux kernel and to do so I've been browsing the source. In the compat version of sysinfo, kernel/sys.c we see the following: COMPAT_SYSCALL_DEFINE1(sysinfo, struct compat_sysinfo __user *, info) { struct sysinfo s; do_sysinfo(&s); /* Check to see i