Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1698016 > unrolled thread
| Started by | Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com> |
|---|---|
| First post | 2017-07-27 16:20 +0200 |
| Last post | 2017-07-30 01:00 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [RFC v6 17/62] powerpc: implementation for arch_set_user_pkey_access() Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com> - 2017-07-27 16:20 +0200
Re: [RFC v6 17/62] powerpc: implementation for arch_set_user_pkey_access() Ram Pai <linuxram@us.ibm.com> - 2017-07-30 01:00 +0200
| From | Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com> |
|---|---|
| Date | 2017-07-27 16:20 +0200 |
| Subject | Re: [RFC v6 17/62] powerpc: implementation for arch_set_user_pkey_access() |
| Message-ID | <u7RNU-79J-17@gated-at.bofh.it> |
Ram Pai <linuxram@us.ibm.com> writes:
> @@ -113,10 +117,14 @@ static inline int arch_override_mprotect_pkey(struct vm_area_struct *vma,
> return 0;
> }
>
> +extern int __arch_set_user_pkey_access(struct task_struct *tsk, int pkey,
> + unsigned long init_val);
> static inline int arch_set_user_pkey_access(struct task_struct *tsk, int pkey,
> unsigned long init_val)
> {
> - return 0;
> + if (!pkey_inited)
> + return -1;
> + return __arch_set_user_pkey_access(tsk, pkey, init_val);
> }
If non-zero, the return value of this function will be passed to
userspace by the pkey_alloc syscall. Shouldn't it be returning an errno
macro such as -EPERM?
Also, why are there both arch_set_user_pkey_access and
__arch_set_user_pkey_access? Is it a speed optimization so that the
early return is inlined into the caller? Ditto for execute_only_pkey
and __arch_override_mprotect_pkey.
--
Thiago Jung Bauermann
IBM Linux Technology Center
[toc] | [next] | [standalone]
| From | Ram Pai <linuxram@us.ibm.com> |
|---|---|
| Date | 2017-07-30 01:00 +0200 |
| Subject | Re: [RFC v6 17/62] powerpc: implementation for arch_set_user_pkey_access() |
| Message-ID | <u8ISd-kA-1@gated-at.bofh.it> |
| In reply to | #1698016 |
On Thu, Jul 27, 2017 at 11:15:36AM -0300, Thiago Jung Bauermann wrote:
>
> Ram Pai <linuxram@us.ibm.com> writes:
> > @@ -113,10 +117,14 @@ static inline int arch_override_mprotect_pkey(struct vm_area_struct *vma,
> > return 0;
> > }
> >
> > +extern int __arch_set_user_pkey_access(struct task_struct *tsk, int pkey,
> > + unsigned long init_val);
> > static inline int arch_set_user_pkey_access(struct task_struct *tsk, int pkey,
> > unsigned long init_val)
> > {
> > - return 0;
> > + if (!pkey_inited)
> > + return -1;
> > + return __arch_set_user_pkey_access(tsk, pkey, init_val);
> > }
>
> If non-zero, the return value of this function will be passed to
> userspace by the pkey_alloc syscall. Shouldn't it be returning an errno
> macro such as -EPERM?
Yes. it should be -EINVAL. fixed it.
>
> Also, why are there both arch_set_user_pkey_access and
> __arch_set_user_pkey_access? Is it a speed optimization so that the
> early return is inlined into the caller? Ditto for execute_only_pkey
> and __arch_override_mprotect_pkey.
arch_set_user_pkey_access() is the interface expected by the
architecture independent code. The __arch_set_user_pkey_access() is an
powerpc internal function that implements the bulk of the work. It can
be called by any of the pkeys internal code only. This gives me the
flexibility to change implementation without having to worry about
changing the interface.
RP
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web