Re: [RFC PATCH] Drop some asm from copy_user_64.S

From: Ingo Molnar
Date: Wed May 13 2015 - 02:20:13 EST



* Borislav Petkov <bp@xxxxxxxxx> wrote:

> Hi guys,
>
> this is just an RFC first to sanity-check what I'm trying to do:
>
> I want to get rid of the asm glue in arch/x86/lib/copy_user_64.S which
> prepares the copy_user* alternatives calls. And replace it with nice and
> clean C.
>
> The other intention is to switch to using copy_user_generic() which does
> CALL <copy_user_function> directly instead of as it is now with CALL
> _copy_*_user and inside the JMP to the proper <copy_user_function>,
> i.e., to save us that JMP.
>
> I'm not 100% sure about the equivalence between the addition carry and
> segment limit check we're doing in asm in arch/x86/lib/copy_user_64.S
> now and with the access_ok() I've replaced it with.
>
> I mean, it *looks* like access_ok() and __chk_range_not_ok() especially
> does the proper checks - addition carry and segment limit with
> user_addr_max() but I'd like for someone much more experienced than me
> to double-check that.
>
> So, without much further ado, here is the diff. It looks simple enough...

Looks nice. Would be useful to do before/after analysis of the
generated asm with a defconfig and document that in the changelog.

I'd keep any changes to inlining decisions a separate patch and do
vmlinux before/after size analysis as well, so that we don't mix the
effects of the various enhancements.

Thanks,

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/