Re: [RFC PATCH v2 2/3] thread_local_abi: wire up x86 32/64 system call

2015-12-23 Thread Josh Triplett
>CC: Andrew Hunter >CC: Peter Zijlstra >CC: Andy Lutomirski >CC: Andi Kleen >CC: Dave Watson >CC: Chris Lameter >CC: Ingo Molnar >CC: Ben Maurer >CC: Steven Rostedt >CC: "Paul E. McKenney" >CC: Josh Triplett >CC: Linus Torvalds >C

Re: livepatch: reuse module loader code to write relocations

2015-12-10 Thread Josh Poimboeuf
On Thu, Dec 10, 2015 at 04:33:29PM -0500, Jessica Yu wrote: > +++ Josh Poimboeuf [10/12/15 08:28 -0600]: > >On Wed, Dec 09, 2015 at 02:10:14PM -0500, Jessica Yu wrote: > >>+++ Josh Poimboeuf [08/12/15 12:38 -0600]: > >>>>+ /* For each _

Re: [RFC PATCH v2 4/6] livepatch: reuse module loader code to write relocations

2015-12-10 Thread Josh Poimboeuf
hdrs, pmod->core_strtab, > > > + pmod->index.sym, relindex, pmod); > > > > It is more appropiate to test the ret. > > And if error is encountered ... then you'd propose to do what? > > The code is correct as is; the return value

Re: module: preserve Elf information for livepatch modules

2015-12-10 Thread Josh Poimboeuf
On Wed, Dec 09, 2015 at 03:05:23PM -0500, Jessica Yu wrote: > +++ Josh Poimboeuf [08/12/15 12:32 -0600]: > >On Mon, Nov 30, 2015 at 11:21:15PM -0500, Jessica Yu wrote: > >>For livepatch modules, copy Elf section, symbol, and string information > >>from the load_info

Re: livepatch: reuse module loader code to write relocations

2015-12-10 Thread Josh Poimboeuf
On Wed, Dec 09, 2015 at 02:10:14PM -0500, Jessica Yu wrote: > +++ Josh Poimboeuf [08/12/15 12:38 -0600]: > >>+ /* For each __klp_rela section for this object */ > >>+ klp_for_each_reloc_sec(obj, reloc_sec) { > >>+ relindex = reloc_sec->index; > >

Re: [RFC PATCH v2 5/6] samples: livepatch: init reloc section array and mark as klp module

2015-12-08 Thread Josh Poimboeuf
eing NULL means vmlinux */ > .funcs = funcs, > + .reloc_secs = reloc_secs, > }, { } > }; > > @@ -89,3 +94,4 @@ static void livepatch_exit(void) > module_init(livepatch_init); > module_exit(livepatch_exit); > MODULE_LICENSE("GPL"

Re: [RFC PATCH v2 4/6] livepatch: reuse module loader code to write relocations

2015-12-08 Thread Josh Poimboeuf
lue)? > + } > } > + ret = apply_relocate_add(pmod->sechdrs, pmod->core_strtab, > + pmod->index.sym, relindex, pmod); > } > > - return 0; > + return ret; > } >

Re: [RFC PATCH v2 2/6] module: preserve Elf information for livepatch modules

2015-12-08 Thread Josh Poimboeuf
milar to the is_livepatch_module() function I suggested, this can be put in a function so that mod->klp can be abstracted away for the !LIVEPATCH case. Maybe there should be a check_livepatch_modinfo() function: 1. the !LIVEPATCH version of the function could return an error if modinfo has "livepa

Re: livepatch: reuse module loader code to write relocations

2015-11-12 Thread Josh Poimboeuf
the benefit of caching the klp_rela section indices. What problem does it solve? It seems simpler to just iterate over all the sections in klp_write_object_relocations(). -- Josh -- To unsubscribe from this list: send the line "unsubscribe linux-api" in the body of a mess

Re: [RFC PATCH 5/5] livepatch: x86: remove unused relocation code

2015-11-12 Thread Josh Poimboeuf
o module loader. > >has been > > I would personally merge this with the 3rd patch. It will be more > clear what code has been replaced there. But it is a matter of taste. Ditto. -- Josh -- To unsubscribe from this list: send the line "unsubscribe lin

Re: [RFC PATCH 3/5] livepatch: reuse module loader code to write relocations

2015-11-12 Thread Josh Poimboeuf
, > @@ -741,12 +751,23 @@ static int klp_init_object_loaded(struct klp_patch > *patch, > struct klp_object *obj) > { > struct klp_func *func; > + struct module *pmod; > int ret; > > - if (obj->relocs) { > -

Re: livepatch: reuse module loader code to write relocations

2015-11-12 Thread Josh Poimboeuf
er. I think we don't need klp_reloc_sec > if there is only one dynrela section for patched object (and I currently > cannot see why this is not possible. It is possible even with one dynrela > section for whole patch module, that is for all patched objects.). I think I agree that we

Re: [RFC PATCH 2/5] module: save load_info for livepatch modules

2015-11-12 Thread Josh Poimboeuf
< 0) > goto bug_cleanup; > > +#ifdef CONFIG_LIVEPATCH > + /* > + * Save sechdrs, indices, and other data from info > + * in order to patch to-be-loaded modules. > + * Do not call free_copy() for livepatch modules. > + */ > + if (get_modinfo((struct load_info *)info, "livepatch")) > + klp_prepare_patch_module(mod, info); > + else > + free_copy(info); > +#else > /* Get rid of temporary copy. */ > free_copy(info); > +#endif > > /* Done! */ > trace_module_load(mod); > -- > 2.4.3 > -- Josh -- To unsubscribe from this list: send the line "unsubscribe linux-api" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [RFC PATCH 2/5] module: save load_info for livepatch modules

2015-11-12 Thread Josh Poimboeuf
ug_cleanup; > > +#ifdef CONFIG_LIVEPATCH > + /* > + * Save sechdrs, indices, and other data from info > + * in order to patch to-be-loaded modules. > + * Do not call free_copy() for livepatch modules. > + */ > + if (get_modinfo((struct load_info *)i

Re: module: save load_info for livepatch modules

2015-11-12 Thread Josh Poimboeuf
arch_syminfo struct: 24 bytes by my reckoning. So between info, info->hdr, and s390 mod_arch_syminfo, we're talking about 184 bytes on s390 and 160 bytes on x86_64. That seems like peanuts compared to the size of a typical module. The benefit is that the code would be simpler because we don

Re: [RFC PATCH 1/5] elf: add livepatch-specific elf constants

2015-11-12 Thread Josh Poimboeuf
l section indexes */ > #define SHN_UNDEF0 > @@ -295,6 +297,7 @@ typedef struct elf64_phdr { > #define SHN_ABS 0xfff1 > #define SHN_COMMON 0xfff2 > #define SHN_HIRESERVE0xffff > +#define SHN_LIVEPATCH 0xff21 Similar question here, why not use 0xff20 (SHN_LO

Re: [RFC PATCH 1/5] elf: add livepatch-specific elf constants

2015-11-12 Thread Josh Poimboeuf
typedef struct elf32_shdr { >Elf32_Word sh_name; For all of these it would be good to re-indent the surrounding macros so their values are all vertically aligned with the new LIVEPATCH ones. -- Josh -- To unsubscribe from this list: send the line "unsubscribe linux-api" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH 3/3 v4] livepatch: old_name,number scheme in livepatch sysfs directory

2015-11-11 Thread Josh Poimboeuf
_sympos, then 1 will be used since a unique symbol will be the > + * first occurrence. > + */ > return kobject_init_and_add(&func->kobj, &klp_ktype_func, > - &obj->kobj, "%s", func->old_name); > +

Re: [RFC PATCH 0/5] Arch-independent livepatch

2015-11-11 Thread Josh Poimboeuf
ime, so this work would simplify > our effort as well. I haven't yet reviewed the code in-depth, but overall I think this patch set is a good idea. It simplifies livepatch itself as well as the patch creation process (for both kGraft and kpatch-build), so it's a win-win.

Re: [RFC PATCH 4/5] samples: livepatch: init reloc list and mark as klp module

2015-11-10 Thread Josh Poimboeuf
tead be an array of klp_reloc_sec structs, with the last entry being 0, similar to how we do other "lists" in the klp interface (e.g., klp_patch.objs, klp_object.funcs). -- Josh -- To unsubscribe from this list: send the line "unsubscribe linux-api" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH v3] livepatch: old_name,number scheme in livepatch sysfs directory

2015-11-10 Thread Josh Poimboeuf
On Tue, Nov 10, 2015 at 09:49:09AM +0100, Miroslav Benes wrote: > On Mon, 9 Nov 2015, Josh Poimboeuf wrote: > > > On Mon, Nov 09, 2015 at 05:01:18PM -0600, Chris J Arges wrote: > > > On 11/09/2015 02:56 PM, Josh Poimboeuf wrote: > > > > I'd recommend split

Re: [PATCH v3] livepatch: old_name,number scheme in livepatch sysfs directory

2015-11-09 Thread Josh Poimboeuf
On Mon, Nov 09, 2015 at 05:01:18PM -0600, Chris J Arges wrote: > On 11/09/2015 02:56 PM, Josh Poimboeuf wrote: > > I'd recommend splitting this up into two separate patches: > > > > 1. introduce old_sympos > > 2. change the sysfs interface > > > > On

Re: [PATCH v3] livepatch: old_name,number scheme in livepatch sysfs directory

2015-11-09 Thread Josh Poimboeuf
- return kobject_init_and_add(&func->kobj, &klp_ktype_func, > - &obj->kobj, "%s", func->old_name); > + return 0; > } The sysfs entry can still be created here, since the function name and sympos are both already known. > > /* parts of the initialization that is done only when the object is loaded */ > @@ -755,6 +765,18 @@ static int klp_init_object_loaded(struct klp_patch > *patch, > return ret; > } > > + /* > + * for each function initialize and add, old_sympos will be already > + * verified at this point > + */ > + klp_for_each_func(obj, func) { > + ret = kobject_init_and_add(&func->kobj, &klp_ktype_func, > + &obj->kobj, "%s,%lu", func->old_name, > + func->old_sympos ? func->old_sympos : 0); > + if (ret) > + return ret; > + } > + > return 0; > } > > -- > 1.9.1 > -- Josh -- To unsubscribe from this list: send the line "unsubscribe linux-api" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH v2] livepatch: old_name.number scheme in livepatch sysfs directory

2015-11-05 Thread Josh Poimboeuf
On Thu, Nov 05, 2015 at 04:18:12PM +0100, Miroslav Benes wrote: > On Wed, 4 Nov 2015, Josh Poimboeuf wrote: > > > On Wed, Nov 04, 2015 at 10:52:52AM +0100, Miroslav Benes wrote: > > > On Tue, 3 Nov 2015, Josh Poimboeuf wrote: > > > > > Object entry would be

Re: [PATCH v2] livepatch: old_name.number scheme in livepatch sysfs directory

2015-11-04 Thread Josh Poimboeuf
On Wed, Nov 04, 2015 at 10:52:52AM +0100, Miroslav Benes wrote: > On Tue, 3 Nov 2015, Josh Poimboeuf wrote: > > > Object entry would be empty for not loaded object. I would not > > > dare to propose to remove such object entries. It would make things > > > worse.

Re: [PATCH v2] livepatch: old_name.number scheme in livepatch sysfs directory

2015-11-03 Thread Josh Poimboeuf
ate namespace and wouldn't create a conflict. -- Josh -- To unsubscribe from this list: send the line "unsubscribe linux-api" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH v2] livepatch: old_name.number scheme in livepatch sysfs directory

2015-11-03 Thread Josh Poimboeuf
On Tue, Nov 03, 2015 at 05:09:48PM +0100, Miroslav Benes wrote: > On Tue, 3 Nov 2015, Josh Poimboeuf wrote: > > > On Tue, Nov 03, 2015 at 11:52:08AM +0100, Miroslav Benes wrote: > > > On Mon, 2 Nov 2015, Chris J Arges wrote: > > > > > > [...] > > >

Re: [PATCH v2] livepatch: old_name.number scheme in livepatch sysfs directory

2015-11-03 Thread Josh Poimboeuf
ere is still a period here and in the documentation :) and in the subject :-) -- Josh -- To unsubscribe from this list: send the line "unsubscribe linux-api" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH v2] livepatch: old_name.number scheme in livepatch sysfs directory

2015-11-03 Thread Josh Poimboeuf
s have the suffix, so it's consistent and there are no surprises. -- Josh -- To unsubscribe from this list: send the line "unsubscribe linux-api" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH v2] livepatch: old_name.number scheme in livepatch sysfs directory

2015-11-03 Thread Josh Poimboeuf
func->old_addr is either not verified yet or worse it is still 0. This > means that klp_get_func_pos_callback() never returns 1 and is thus called > on each symbol. So if you for example patched cmdline_proc_show the > resulting directory in sysfs would be called cmdline_proc_show,1 becau

Re: [PATCH] livepatch: old_name.number scheme in livepatch sysfs directory

2015-11-02 Thread Josh Poimboeuf
On Mon, Nov 02, 2015 at 02:16:16PM -0600, Chris J Arges wrote: > On Mon, Nov 02, 2015 at 01:52:44PM -0600, Josh Poimboeuf wrote: > > On Mon, Nov 02, 2015 at 11:58:47AM -0600, Chris J Arges wrote: > > > The following directory structure will allow for cases when the same > >

Re: [PATCH] livepatch: old_name.number scheme in livepatch sysfs directory

2015-11-02 Thread Josh Poimboeuf
on was patched. For example: $ grep " t_next" /proc/kallsyms 811597d0 t t_next 81163bb0 t t_next ... In my kernel there are 6 functions named t_next in vmlinux. "t_next 0" would refer to the function at 0x811597d0. "t_next 1" would

Re: [PATCH] kselftest: replace $(RM) with rm -f command

2015-10-03 Thread Josh Triplett
On Sat, Oct 03, 2015 at 02:11:57PM +, Mathieu Desnoyers wrote: > - On Oct 3, 2015, at 12:38 AM, dvhart dvh...@infradead.org wrote: > > > On Mon, Sep 28, 2015 at 03:16:53AM +, Mathieu Desnoyers wrote: > >> - On Sep 27, 2015, at 10:10 PM, Wang Long long.wangl...@huawei.com > >> wrot

Re: [PATCH 04/13] Always expose MAP_UNINITIALIZED to userspace

2015-09-15 Thread Josh Triplett
On Tue, Sep 15, 2015 at 12:42:00PM +0300, Kirill A. Shutemov wrote: > On Mon, Sep 14, 2015 at 10:19:19PM -0700, Josh Triplett wrote: > > On Tue, Sep 15, 2015 at 03:23:58AM +0300, Kirill A. Shutemov wrote: > > > On Mon, Sep 14, 2015 at 03:50:38PM -0700, Palmer Dabbelt wrote: >

Re: [PATCH 04/13] Always expose MAP_UNINITIALIZED to userspace

2015-09-14 Thread Josh Triplett
ve an MMU (which is useful for things like fork()), a system without user separation (for instance, without CONFIG_MULTIUSER) can reasonably use MAP_UNINITIALIZED. > P.S. MAP_UNINITIALIZED itself looks very broken to me. I probably need dig > mailing list on why it was allowed. That's w

Re: [PATCHv2 1/1] Documentation: describe how to add a system call

2015-07-31 Thread Josh Triplett
On Fri, Jul 31, 2015 at 09:56:46PM -0700, H. Peter Anvin wrote: > On 07/31/2015 09:32 PM, Josh Triplett wrote: > > > > Sure, agreed. But I really hope we don't create new kernel ABIs that > > involve constructs like that. > > > > It's worth noting I

Re: [PATCHv2 1/1] Documentation: describe how to add a system call

2015-07-31 Thread Josh Triplett
st automatically running copy_from_user and > > copy_param_struct on appropriate sets of __user parameters identified as > > such in a structured text file seems quite sufficient. (Plus > > automatically generating syscalls.h from that.) > > If a param struct does the trick, then I ag

Re: [PATCHv2 1/1] Documentation: describe how to add a system call

2015-07-31 Thread josh
On Fri, Jul 31, 2015 at 02:19:29PM -0700, Andy Lutomirski wrote: > On Fri, Jul 31, 2015 at 1:59 PM, wrote: > > Agreed. I think the proposal above would be a net improvement, but > > ideally you'd want something that's annotated and generates automatic > > marshalling code. > > > > I assume this

Re: [PATCHv2 1/1] Documentation: describe how to add a system call

2015-07-31 Thread josh
On Fri, Jul 31, 2015 at 11:56:06AM -0700, Kees Cook wrote: > On Thu, Jul 30, 2015 at 6:02 PM, Josh Triplett wrote: > > On Thu, Jul 30, 2015 at 01:03:43PM -0700, Kees Cook wrote: > >> On Thu, Jul 30, 2015 at 12:04 PM, Josh Triplett > >> wrote: > >> > O

Re: [PATCHv3 1/1] Documentation: describe how to add a system call

2015-07-31 Thread Josh Triplett
d-off-by: David Drysdale > Reviewed-by: Michael Kerrisk > Reviewed-by: Eric B Munson > Reviewed-by: Kees Cook > Reviewed-by: Randy Dunlap Other than the change to the mention of capabilities, this now looks ready to me. With that item fixed: Reviewed-by: Josh Triplett > Doc

Re: [PATCHv2 1/1] Documentation: describe how to add a system call

2015-07-31 Thread Josh Triplett
On Fri, Jul 31, 2015 at 10:48:32AM +0100, David Drysdale wrote: > On Thu, Jul 30, 2015 at 7:50 PM, Josh Triplett wrote: > > On Thu, Jul 30, 2015 at 08:52:11AM +0100, David Drysdale wrote: > >> Add a document describing the process of adding a new system call, > >> inc

Re: [PATCHv2 1/1] Documentation: describe how to add a system call

2015-07-30 Thread Josh Triplett
On Thu, Jul 30, 2015 at 06:02:34PM -0700, Josh Triplett wrote: > On Thu, Jul 30, 2015 at 01:03:43PM -0700, Kees Cook wrote: > > On Thu, Jul 30, 2015 at 12:04 PM, Josh Triplett > > wrote: > > > On Thu, Jul 30, 2015 at 11:21:54AM -0700, Kees Cook wrote: > > >>

Re: [PATCHv2 1/1] Documentation: describe how to add a system call

2015-07-30 Thread Josh Triplett
On Thu, Jul 30, 2015 at 01:03:43PM -0700, Kees Cook wrote: > On Thu, Jul 30, 2015 at 12:04 PM, Josh Triplett wrote: > > On Thu, Jul 30, 2015 at 11:21:54AM -0700, Kees Cook wrote: > >> I like this, it's a good description of both options. I'm still biased > >&g

Re: [PATCHv2 1/1] Documentation: describe how to add a system call

2015-07-30 Thread Josh Triplett
longer be tampered with). - Josh Triplett -- To unsubscribe from this list: send the line "unsubscribe linux-api" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCHv2 1/1] Documentation: describe how to add a system call

2015-07-30 Thread Josh Triplett
On Thu, Jul 30, 2015 at 08:52:11AM +0100, David Drysdale wrote: > Add a document describing the process of adding a new system call, > including the need for a flags argument for future compatibility, and > covering 32-bit/64-bit concerns (albeit in an x86-centric way). > > Signed-off-by: David Dr

Re: [PATCHv2 1/1] Documentation: describe how to add a system call

2015-07-30 Thread Josh Triplett
stand. If you don't need param_4, don't use the version of the structure that has param_4. That also means the kernel doesn't need to copy and read those values. Either approach works, though. - Josh Triplett -- To unsubscribe from this list: send the line "uns

Re: [RFC PATCH] getcpu_cache system call: caching current CPU number (x86)

2015-07-20 Thread josh
thinking of doing with it. > > > > How is this possible if it's process-global attribute and glibc or some > > library in the process starts using it? > > > > glibc will have to expose a way to turn it off, I guess. (ELF flag?) Or a way to turn it on. - Josh Triplett -- To unsubscribe from this list: send the line "unsubscribe linux-api" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [RFC PATCH] thread_local_abi system call: caching current CPU number (x86)

2015-07-17 Thread Josh Triplett
you pass non-zero, the pointer must be valid or you get -EFAULT (or an actual segfault). - Josh Triplett -- To unsubscribe from this list: send the line "unsubscribe linux-api" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [RFC PATCH] getcpu_cache system call: caching current CPU number (x86)

2015-07-12 Thread Josh Triplett
ADDR_LIMIT_32BIT or ADDR_LIMIT_3GB? > + /* Will update *gcp on resume */ > + if (gcp) Minor nit: you're using the pointer as a boolean here, but comparing it to NULL elsewhere; you should be consistent. I'd suggest consistently using gcp and !gcp, without the comparison to NULL. - Josh Triplett -- To unsubscribe from this list: send the line "unsubscribe linux-api" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

[PATCH 1/2] clone: Support passing tls argument via C rather than pt_regs magic

2015-04-21 Thread Josh Triplett
re the C argument to sys_clone in favor of the pt_regs captured at kernel entry, and thus will be unable to introduce new versions of the clone syscall. Signed-off-by: Josh Triplett Signed-off-by: Thiago Macieira Acked-by: Andy Lutomirski --- arch/Kconfig | 7 ++ include/l

[PATCH 2/2] x86: Opt into HAVE_COPY_THREAD_TLS, for both 32-bit and 64-bit

2015-04-21 Thread Josh Triplett
For 32-bit userspace on a 64-bit kernel, this requires modifying stub32_clone to actually swap the appropriate arguments to match CONFIG_CLONE_BACKWARDS, rather than just leaving the C argument for tls broken. Signed-off-by: Josh Triplett Signed-off-by: Thiago Macieira Acked-by: Andy Lutomirski

[PATCH 0/2] clone: Support passing tls argument via C rather than pt_regs magic

2015-04-21 Thread Josh Triplett
ersial and have acks. I'd like to go ahead and submit these two so that other architectures can begin building on top of this and opting into HAVE_COPY_THREAD_TLS. However, I'm also happy to wait and send these through the next merge window (along with v3 of clone4) if anyone would

Re: [PATCH v2 0/7] CLONE_FD: Task exit notification via file descriptor

2015-04-08 Thread Josh Triplett
hen include any necessary disambiguating flags/IDs/etc. No need for them to match the current clonefd_info structure if userspace has opted into a new version. - Josh Triplett -- To unsubscribe from this list: send the line "unsubscribe linux-api" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH v2 7/7] clone4: Add a CLONE_FD flag to get task exit notification via fd

2015-04-06 Thread Josh Triplett
On Mon, Apr 06, 2015 at 05:30:35PM +0900, Sergey Senozhatsky wrote: > On (03/15/15 01:00), Josh Triplett wrote: > [..] > > + > > +/* Handle the CLONE_FD case for copy_process. */ > > +int clonefd_do_clone(u64 clone_flags, struct task_struct *p, > > +st

Re: [PATCH v2 0/7] CLONE_FD: Task exit notification via file descriptor

2015-03-31 Thread josh
e new thing". So, for instance, if you want to receive SIGSTOP/SIGCONT messages for child processes through this descriptor, we could add a flag for that. - Josh Triplett -- To unsubscribe from this list: send the line "unsubscribe linux-api" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH v2 7/7] clone4: Add a CLONE_FD flag to get task exit notification via fd

2015-03-25 Thread Josh Triplett
On Mon, Mar 23, 2015 at 05:38:45PM +, David Drysdale wrote: > On Sun, Mar 15, 2015 at 8:00 AM, Josh Triplett wrote: > > diff --git a/include/linux/sched.h b/include/linux/sched.h > > index 9daa017..1dc680b 100644 > > --- a/include/linux/sched.h > > +++ b/include/l

Re: [PATCH v2 3/7] Introduce a new clone4 syscall with more flag bits and extensible arguments

2015-03-23 Thread josh
On Mon, Mar 23, 2015 at 02:11:45PM +, David Drysdale wrote: > On Sun, Mar 15, 2015 at 7:59 AM, Josh Triplett wrote: > > diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S > > index 0286735..ba28306 100644 > > --- a/arch/x86/ia32/ia32entry.S > > +++

Re: [PATCH v2 0/7] CLONE_FD: Task exit notification via file descriptor

2015-03-23 Thread josh
> > Quick query: does CLONE_AUTOREAP also affect waiting for non-exit > events (i.e. WUNTRACED / WCONTINUED), by original parent and/or ptracer? It shouldn't, no. You can't wait on the process to exit (you'll get -ECHLD after it wakes up), but you can wait on it to contin

Re: [PATCH v2 5/7] clone4: Add a CLONE_AUTOREAP flag to automatically reap the child process

2015-03-20 Thread josh
SIGNAL) && (clone_flags && CLONE_AUTOREAP)) > return -EINVAL; > > so that we still can change this behaviour later. I'm fine with that, as it would handle the particular use case we care about. However, the reset-signal-on-reparent thing might still mak

Re: [PATCH v2 0/7] CLONE_FD: Task exit notification via file descriptor

2015-03-16 Thread josh
t's fine. There's no semantic meaning attached to reading from the clonefd; you still have to wait on the process if you don't pass CLONE_AUTOREAP. (Or you can block SIGCHLD or use SA_NOCLDWAIT, if you control the calling process's signal handling; AUTOREAP just lets you avoid in

Re: [PATCH v2 0/7] CLONE_FD: Task exit notification via file descriptor

2015-03-16 Thread josh
emantics we implemented; you'll *always* get an exit notification via the clonefd if you have it open, with or without autoreap and whether or not a wait has occurred yet. And reading from the clonefd does not serve as a wait; if you don't pass CLONE_AUTOREAP, you'll still need to wait

Re: [PATCH v2 0/7] CLONE_FD: Task exit notification via file descriptor

2015-03-16 Thread josh
On Mon, Mar 16, 2015 at 02:44:20PM -0700, Kees Cook wrote: > On Sun, Mar 15, 2015 at 12:59 AM, Josh Triplett wrote: > > - Make poll on a CLONE_FD for an exited task also return POLLHUP, for > > compatibility with FreeBSD's pdfork. Thanks to David Drysdale for calling >

Re: [PATCH v2 5/7] clone4: Add a CLONE_AUTOREAP flag to automatically reap the child process

2015-03-15 Thread Josh Triplett
On Sun, Mar 15, 2015 at 08:55:06PM +0100, Oleg Nesterov wrote: > On 03/15, Josh Triplett wrote: > > On Sun, Mar 15, 2015 at 03:52:23PM +0100, Oleg Nesterov wrote: > > > On 03/15, Josh Triplett wrote: > > > > Add a CLONE_AUTOREAP flag to request this behavior un

Re: [PATCH v2 5/7] clone4: Add a CLONE_AUTOREAP flag to automatically reap the child process

2015-03-15 Thread Josh Triplett
On Sun, Mar 15, 2015 at 03:52:23PM +0100, Oleg Nesterov wrote: > On 03/15, Josh Triplett wrote: > > Add a CLONE_AUTOREAP flag to request this behavior unconditionally, > > Yes, CLONE_AUTOREAP is much better. And I agree (mostly) with that > we should rely on do_notify_parent(

Re: [PATCH 0/6] CLONE_FD: Task exit notification via file descriptor

2015-03-15 Thread Josh Triplett
On Sun, Mar 15, 2015 at 10:18:05AM +, David Drysdale wrote: > On Sat, Mar 14, 2015 at 7:29 PM, Josh Triplett wrote: > > On Sat, Mar 14, 2015 at 12:03:12PM -0700, Thiago Macieira wrote: > >> On Friday 13 March 2015 18:11:32 Thiago Macieira wrote: > >> > On Frid

Re: [PATCH v2 0/7] CLONE_FD: Task exit notification via file descriptor

2015-03-15 Thread Josh Triplett
On Sun, Mar 15, 2015 at 12:59:17AM -0700, Josh Triplett wrote: > This patch series also introduces a clone flag CLONE_AUTOREAP, which causes > the > kernel to automatically reap the child process when it exits, just as it does > for processes using SIGCHLD when the parent has SIGCHL

[PATCH v2 4/7] kernel/fork.c: Pass arguments to _do_fork and copy_process using clone4_args

2015-03-15 Thread Josh Triplett
structure initializers to only initialize the arguments they care about. Future extensions to clone4_args will thus not need to touch clone4, fork, vfork, or other callers of _do_fork. Signed-off-by: Josh Triplett Signed-off-by: Thiago Macieira --- kernel/fork.c | 77

[PATCH v2 1/7] clone: Support passing tls argument via C rather than pt_regs magic

2015-03-15 Thread Josh Triplett
re the C argument to sys_clone in favor of the pt_regs captured at kernel entry, and thus will be unable to introduce new versions of the clone syscall. Signed-off-by: Josh Triplett Signed-off-by: Thiago Macieira Acked-by: Andy Lutomirski --- arch/Kconfig | 7 ++ include/l

[PATCH v2 5/7] clone4: Add a CLONE_AUTOREAP flag to automatically reap the child process

2015-03-15 Thread Josh Triplett
he calling process's signal handling or wait loop. Signed-off-by: Josh Triplett Signed-off-by: Thiago Macieira --- include/linux/sched.h | 2 ++ include/uapi/linux/sched.h | 7 ++- kernel/fork.c | 2 ++ kernel/signal.c| 2 ++ 4 files changed, 12 insertions

[PATCH v2 6/7] signal: Factor out a helper function to process task_struct exit_code

2015-03-15 Thread Josh Triplett
do_notify_parent includes the code to convert the exit_code field of struct task_struct to the code and status fields that accompany SIGCHLD. Factor that out into a new helper function task_exit_code_status, to allow other methods of task exit notification to share that code. Signed-off-by: Josh

[PATCH v2 man-pages] clone4.2: New manpage documenting clone4(2)

2015-03-15 Thread Josh Triplett
Also includes new cross-reference from clone.2. Signed-off-by: Josh Triplett --- man2/clone.2 | 1 + man2/clone4.2 | 345 ++ 2 files changed, 346 insertions(+) create mode 100644 man2/clone4.2 diff --git a/man2/clone.2 b/man2/clone.2

[PATCH v2 7/7] clone4: Add a CLONE_FD flag to get task exit notification via fd

2015-03-15 Thread Josh Triplett
ignal handler or a signalfd. Signed-off-by: Josh Triplett Signed-off-by: Thiago Macieira --- include/linux/compat.h | 2 + include/linux/sched.h | 5 ++ include/uapi/linux/sched.h | 16 +- init/Kconfig | 11 + kernel/Makefile| 1 + kernel/clon

[PATCH v2 2/7] x86: Opt into HAVE_COPY_THREAD_TLS, for both 32-bit and 64-bit

2015-03-15 Thread Josh Triplett
For 32-bit userspace on a 64-bit kernel, this requires modifying stub32_clone to actually swap the appropriate arguments to match CONFIG_CLONE_BACKWARDS, rather than just leaving the C argument for tls broken. Signed-off-by: Josh Triplett Signed-off-by: Thiago Macieira Acked-by: Andy Lutomirski

[PATCH v2 3/7] Introduce a new clone4 syscall with more flag bits and extensible arguments

2015-03-15 Thread Josh Triplett
ned-off-by: Josh Triplett Signed-off-by: Thiago Macieira --- arch/x86/ia32/ia32entry.S | 1 + arch/x86/kernel/entry_64.S| 1 + arch/x86/syscalls/syscall_32.tbl | 1 + arch/x86/syscalls/syscall_64.tbl | 2 ++ include/linux/compat.h| 12 + include/uapi/a

[PATCH v2 0/7] CLONE_FD: Task exit notification via file descriptor

2015-03-15 Thread Josh Triplett
ed in programs intended to be portable. SEE ALSO clone(2), epoll(7), poll(2), pthreads(7), read(2), select(2) Linux 2015-03-14 CLONE4(2) Josh Triplett and Thiago Macieira (7): clone: Support passing tls argument vi

Re: [PATCH 6/6] clone4: Introduce new CLONE_FD flag to get task exit notification via fd

2015-03-14 Thread Josh Triplett
On Sat, Mar 14, 2015 at 09:30:29PM +0100, Oleg Nesterov wrote: > On 03/14, Josh Triplett wrote: > > > > What I was proposing was that a task that isn't yet dead, but that is > > going to be autoreaped, is not eligible for waiting either. All the > > various wait

Re: [PATCH 6/6] clone4: Introduce new CLONE_FD flag to get task exit notification via fd

2015-03-14 Thread Josh Triplett
gnal handling is set up. So you'd pass a 0 signal, and CLONE_AUTOREAP. And then if you *want* the exit notification, you can get it via the file descriptor. - Josh Triplett -- To unsubscribe from this list: send the line "unsubscribe linux-api" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH 6/6] clone4: Introduce new CLONE_FD flag to get task exit notification via fd

2015-03-14 Thread Josh Triplett
criptor instead (to allow a library to handle job control for a process without touching process-wide signal handling), but that can come later. > At the same time, if we add autoreap then probably it also makes sense to add > WEXITIED_UNLESS_AUTOREAP. Potentially, though for many a

Re: [PATCH 6/6] clone4: Introduce new CLONE_FD flag to get task exit notification via fd

2015-03-14 Thread Josh Triplett
On Sat, Mar 14, 2015 at 08:47:21PM +0100, Oleg Nesterov wrote: > On 03/14, Oleg Nesterov wrote: > > > > On 03/14, Josh Triplett wrote: > > > > > > On Sat, Mar 14, 2015 at 11:38:29AM -0700, Thiago Macieira wrote: > > > > On Saturday 14 March 2015 15:3

Re: [PATCH 6/6] clone4: Introduce new CLONE_FD flag to get task exit notification via fd

2015-03-14 Thread Josh Triplett
On Sat, Mar 14, 2015 at 08:18:36PM +0100, Oleg Nesterov wrote: > On 03/14, Josh Triplett wrote: > > > > On Sat, Mar 14, 2015 at 11:38:29AM -0700, Thiago Macieira wrote: > > > On Saturday 14 March 2015 15:32:35 Oleg Nesterov wrote: > > > > It is not clear

Re: [PATCH 6/6] clone4: Introduce new CLONE_FD flag to get task exit notification via fd

2015-03-14 Thread Josh Triplett
On Sat, Mar 14, 2015 at 08:24:56PM +0100, Oleg Nesterov wrote: > On 03/14, Josh Triplett wrote: > > > > On Sat, Mar 14, 2015 at 03:35:58PM +0100, Oleg Nesterov wrote: > > > On 03/12, Josh Triplett wrote: > > > > > > > > @@ -598,7 +600,9 @@

Re: [PATCH 0/6] CLONE_FD: Task exit notification via file descriptor

2015-03-14 Thread Josh Triplett
> - pdkill: needs an ioctl [or just write()] I think that should be a dedicated syscall, not an ioctl. It's unfortunate that rt_sigqueueinfo doesn't take a flags argument. However, I just realized that it takes a 32-bit "int" for the signal number, yet signal numbers fit in

Re: [PATCH 6/6] clone4: Introduce new CLONE_FD flag to get task exit notification via fd

2015-03-14 Thread Josh Triplett
On Sat, Mar 14, 2015 at 03:35:58PM +0100, Oleg Nesterov wrote: > On 03/12, Josh Triplett wrote: > > > > @@ -598,7 +600,9 @@ static void exit_notify(struct task_struct *tsk, int > > group_dead) > > if (group_dead) > > kill_orphaned_pgrp(tsk->g

Re: [PATCH 6/6] clone4: Introduce new CLONE_FD flag to get task exit notification via fd

2015-03-14 Thread Josh Triplett
ink we need to change wait_consider_task to early-return for ->autoreap just as it does for task_state == EXIT_DEAD. I'll do that in v2. - Josh Triplett -- To unsubscribe from this list: send the line "unsubscribe linux-api" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH 2/6] x86: Opt into HAVE_COPY_THREAD_TLS, for both 32-bit and 64-bit

2015-03-13 Thread josh
M -0700, Andy Lutomirski wrote: > >> >> On Thu, Mar 12, 2015 at 6:40 PM, Josh Triplett > >> >> wrote: > >> >> > For 32-bit userspace on a 64-bit kernel, this requires modifying > >> >> > stub32_clone to actually swap the appropriate

Re: [PATCH 2/6] x86: Opt into HAVE_COPY_THREAD_TLS, for both 32-bit and 64-bit

2015-03-13 Thread josh
On Fri, Mar 13, 2015 at 03:38:31PM -0700, Andy Lutomirski wrote: > On Fri, Mar 13, 2015 at 3:31 PM, wrote: > > On Fri, Mar 13, 2015 at 03:01:16PM -0700, Andy Lutomirski wrote: > >> On Thu, Mar 12, 2015 at 6:40 PM, Josh Triplett > >> wrote: > >> > For 32

Re: [PATCH 6/6] clone4: Introduce new CLONE_FD flag to get task exit notification via fd

2015-03-13 Thread josh
t; avoid. (We don't want to have magic "reap on read(2)" semantics, > > because among other things, what if we add a means in the future to get > > an additional file descriptor corresponding to an existing process?) > > Do we not already have a state "dead, successfully

Re: [PATCH 2/6] x86: Opt into HAVE_COPY_THREAD_TLS, for both 32-bit and 64-bit

2015-03-13 Thread josh
On Fri, Mar 13, 2015 at 03:01:16PM -0700, Andy Lutomirski wrote: > On Thu, Mar 12, 2015 at 6:40 PM, Josh Triplett wrote: > > For 32-bit userspace on a 64-bit kernel, this requires modifying > > stub32_clone to actually swap the appropriate arguments to match > > CONFIG_CL

Re: [PATCH 6/6] clone4: Introduce new CLONE_FD flag to get task exit notification via fd

2015-03-13 Thread josh
process, which we'd like to avoid. (We don't want to have magic "reap on read(2)" semantics, because among other things, what if we add a means in the future to get an additional file descriptor corresponding to an existing process?) - Josh Triplett -- To unsubs

Re: [PATCH 0/6] CLONE_FD: Task exit notification via file descriptor

2015-03-13 Thread josh
On Fri, Mar 13, 2015 at 02:33:44PM -0700, Andy Lutomirski wrote: > On Fri, Mar 13, 2015 at 12:42 PM, Josh Triplett wrote: > > On Fri, Mar 13, 2015 at 04:05:29PM +, David Drysdale wrote: > >> On Fri, Mar 13, 2015 at 1:40 AM, Josh Triplett > >> wrote: > >>

Re: [PATCH 0/6] CLONE_FD: Task exit notification via file descriptor

2015-03-13 Thread josh
On Fri, Mar 13, 2015 at 02:16:07PM -0700, Thiago Macieira wrote: > On Friday 13 March 2015 12:42:52 Josh Triplett wrote: > > > Hi Josh, > > > > > > From the overall description (i.e. I haven't looked at the code yet) > > > this looks very interesti

Re: [PATCH 6/6] clone4: Introduce new CLONE_FD flag to get task exit notification via fd

2015-03-13 Thread josh
On Fri, Mar 13, 2015 at 05:21:13PM +0100, Oleg Nesterov wrote: > Josh, > > I'll certainly try to read this series, but not before next week. Thanks for looking at it. > but a couple of nits right now. > > On 03/12, Josh Triplett wrote: > > > > When passed

Re: [PATCH 0/6] CLONE_FD: Task exit notification via file descriptor

2015-03-13 Thread Josh Triplett
On Fri, Mar 13, 2015 at 04:05:29PM +, David Drysdale wrote: > On Fri, Mar 13, 2015 at 1:40 AM, Josh Triplett wrote: > > This patch series introduces a new clone flag, CLONE_FD, which lets the > > caller > > handle child process exit notification via a file descriptor ra

[PATCH 0/6] CLONE_FD: Task exit notification via file descriptor

2015-03-12 Thread Josh Triplett
FORMING TO clone4() is Linux-specific and should not be used in programs intended to be portable. SEE ALSO clone(2), epoll(7), poll(2), pthreads(7), read(2), select(2) Linux 2015-03-01 CLONE4(2) Josh Triplett and Thiago Mac

[PATCH 3/6] Introduce a new clone4 syscall with more flag bits and extensible arguments

2015-03-12 Thread Josh Triplett
ned-off-by: Josh Triplett Signed-off-by: Thiago Macieira --- arch/x86/ia32/ia32entry.S| 1 + arch/x86/kernel/entry_64.S | 1 + arch/x86/syscalls/syscall_32.tbl | 1 + arch/x86/syscalls/syscall_64.tbl | 2 ++ include/linux/compat.h | 12 include/uapi/lin

[PATCH 1/6] clone: Support passing tls argument via C rather than pt_regs magic

2015-03-12 Thread Josh Triplett
re the C argument to sys_clone in favor of the pt_regs captured at kernel entry, and thus will be unable to introduce new versions of the clone syscall. Signed-off-by: Josh Triplett Signed-off-by: Thiago Macieira --- arch/Kconfig | 7 ++ include/linux/sched.h| 14 +++

[PATCH 4/6] signal: Factor out a helper function to process task_struct exit_code

2015-03-12 Thread Josh Triplett
do_notify_parent includes the code to convert the exit_code field of struct task_struct to the code and status fields that accompany SIGCHLD. Factor that out into a new helper function task_exit_code_status, to allow other methods of task exit notification to share that code. Signed-off-by: Josh

[PATCH 6/6] clone4: Introduce new CLONE_FD flag to get task exit notification via fd

2015-03-12 Thread Josh Triplett
can use it. Signed-off-by: Josh Triplett Signed-off-by: Thiago Macieira --- include/linux/sched.h | 5 ++ include/uapi/linux/sched.h | 23 - init/Kconfig | 11 kernel/Makefile| 1 + kernel/clonefd.c

[PATCH] clone4.2: New manpage documenting clone4(2)

2015-03-12 Thread Josh Triplett
Also includes new cross-reference from clone.2. Signed-off-by: Josh Triplett Signed-off-by: Thiago Macieira --- man2/clone.2 | 1 + man2/clone4.2 | 332 ++ 2 files changed, 333 insertions(+) create mode 100644 man2/clone4.2 diff

[PATCH 5/6] fs: Make alloc_fd non-private

2015-03-12 Thread Josh Triplett
This allows callers to allocate a file descriptor with a defined minimum value, without directly calling the lower-level __alloc_fd. Signed-off-by: Josh Triplett Signed-off-by: Thiago Macieira --- fs/file.c| 2 +- include/linux/file.h | 1 + 2 files changed, 2 insertions(+), 1

  1   2   >