Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1297596
| From | Dan Williams <dan.j.williams@intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCHV3 3/3] x86, ras: Add mcsafe_memcpy() function to recover from machine checks |
| Date | 2015-12-23 20:40 +0100 |
| Message-ID | <qIXqq-5hs-15@gated-at.bofh.it> (permalink) |
| References | <qGo3L-4HH-13@gated-at.bofh.it> <qGo3L-4HH-11@gated-at.bofh.it> <qIt8Z-3dF-1@gated-at.bofh.it> <qIAWS-86s-29@gated-at.bofh.it> <qIRbj-1fn-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed, Dec 23, 2015 at 4:58 AM, Borislav Petkov <bp@alien8.de> wrote:
> On Tue, Dec 22, 2015 at 11:38:07AM -0800, Tony Luck wrote:
>> I interpreted that comment as "stop playing with %rax in the fault
>> handler ... just change the IP to point the the .fixup location" ...
>> the target of the fixup being the "landing pad".
>>
>> Right now this function has only one set of fault fixups (for machine
>> checks). When I tackle copy_from_user() it will sprout a second
>> set for page faults, and then will look a bit more like Andy's dual
>> landing pad example.
>>
>> I still need an indicator to the caller which type of fault happened
>> since their actions will be different. So BIT(63) lives on ... but is
>> now set in the .fixup section rather than in the machine check
>> code.
>
> You mean this previous example of yours:
>
> int copy_from_user(void *to, void *from, unsigned long n)
> {
> u64 ret = mcsafe_memcpy(to, from, n);
>
> if (COPY_HAD_MCHECK(r)) {
> if (memory_failure(COPY_MCHECK_PADDR(ret) >> PAGE_SIZE, ...))
> force_sig(SIGBUS, current);
> return something;
> } else
> return ret;
> }
>
> ?
>
> So what's wrong with mcsafe_memcpy() returning a proper retval which
> says what type of fault happened?
>
> I know, memcpy returns the ptr to @dest like a parrot but your version
> mcsafe_memcpy() will be different. It can even be called __mcsafe_memcpy
> and have a wrapper around it which fiddles out the proper retvals and
> returns @dest after all. It would still be cleaner this way IMHO.
We might leave this to the consumer. It's already the case that
mcsafe_memcpy() is arch specific so I'm having to wrap its return
value into a generic value. My current thinking is make
memcpy_from_pmem() return a pmem_cookie_t, and then have an arch
specific pmem_copy_error(pmem_cookit_t cookie) helper that interprets
the value. This is similar to the situation we have with
dma_mapping_error().
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCHV3 3/3] x86, ras: Add mcsafe_memcpy() function to recover from machine checks Tony Luck <tony.luck@intel.com> - 2015-12-16 18:30 +0100
Re: [PATCHV3 3/3] x86, ras: Add mcsafe_memcpy() function to recover from machine checks Borislav Petkov <bp@alien8.de> - 2015-12-22 12:20 +0100
Re: [PATCHV3 3/3] x86, ras: Add mcsafe_memcpy() function to recover from machine checks Tony Luck <tony.luck@gmail.com> - 2015-12-22 20:40 +0100
Re: [PATCHV3 3/3] x86, ras: Add mcsafe_memcpy() function to recover from machine checks Borislav Petkov <bp@alien8.de> - 2015-12-23 14:00 +0100
Re: [PATCHV3 3/3] x86, ras: Add mcsafe_memcpy() function to recover from machine checks Dan Williams <dan.j.williams@intel.com> - 2015-12-23 20:40 +0100
Re: [PATCHV3 3/3] x86, ras: Add mcsafe_memcpy() function to recover from machine checks Tony Luck <tony.luck@gmail.com> - 2015-12-23 21:50 +0100
Re: [PATCHV3 3/3] x86, ras: Add mcsafe_memcpy() function to recover from machine checks Borislav Petkov <bp@alien8.de> - 2015-12-24 14:40 +0100
csiph-web