* [PATCH v2 1/3] arm64: ptrace: Add is_syscall_success to handle compat
@ 2021-04-23 10:35 He Zhe
2021-04-23 10:35 ` [PATCH v2 2/3] arm64: syscall.h: Add sign extension handling in syscall_get_return_value for compat He Zhe
2021-04-23 10:35 ` [PATCH v2 3/3] audit: Use syscall_get_return_value to get syscall return code in audit_syscall_exit He Zhe
0 siblings, 2 replies; 9+ messages in thread
From: He Zhe @ 2021-04-23 10:35 UTC (permalink / raw)
To: oleg, catalin.marinas, will, linux-arm-kernel, paul, eparis,
linux-audit, linux-kernel, zhe.he
The general version of is_syscall_success does not handle 32-bit
compatible case, which would cause 32-bit negative return code to be
recoganized as a positive number later and seen as a "success".
Since syscall_get_return_value is defined in syscall.h, implementing
is_syscall_success in ptrace.h would introduce build failure due to
recursive inclusion of some basic headers like mutex.h. Let's put the
implementation to ptrace.c
Signed-off-by: He Zhe <zhe.he@windriver.com>
---
v1 to v2: Call syscall_get_return_value to reduce code duplication
arch/arm64/include/asm/ptrace.h | 3 +++
arch/arm64/kernel/ptrace.c | 5 +++++
2 files changed, 8 insertions(+)
diff --git a/arch/arm64/include/asm/ptrace.h b/arch/arm64/include/asm/ptrace.h
index e58bca832dff..3c415e9e5d85 100644
--- a/arch/arm64/include/asm/ptrace.h
+++ b/arch/arm64/include/asm/ptrace.h
@@ -328,6 +328,9 @@ static inline void regs_set_return_value(struct pt_regs *regs, unsigned long rc)
regs->regs[0] = rc;
}
+extern inline int is_syscall_success(struct pt_regs *regs);
+#define is_syscall_success(regs) is_syscall_success(regs)
+
/**
* regs_get_kernel_argument() - get Nth function argument in kernel
* @regs: pt_regs of that context
diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
index 170f42fd6101..2c84255e1e41 100644
--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -1909,3 +1909,8 @@ int valid_user_regs(struct user_pt_regs *regs, struct task_struct *task)
else
return valid_native_regs(regs);
}
+
+inline int is_syscall_success(struct pt_regs *regs)
+{
+ return !IS_ERR_VALUE(syscall_get_return_value(current, regs));
+}
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 2/3] arm64: syscall.h: Add sign extension handling in syscall_get_return_value for compat
2021-04-23 10:35 [PATCH v2 1/3] arm64: ptrace: Add is_syscall_success to handle compat He Zhe
@ 2021-04-23 10:35 ` He Zhe
2021-05-05 17:30 ` Mark Rutland
2021-04-23 10:35 ` [PATCH v2 3/3] audit: Use syscall_get_return_value to get syscall return code in audit_syscall_exit He Zhe
1 sibling, 1 reply; 9+ messages in thread
From: He Zhe @ 2021-04-23 10:35 UTC (permalink / raw)
To: oleg, catalin.marinas, will, linux-arm-kernel, paul, eparis,
linux-audit, linux-kernel, zhe.he
Add sign extension handling in syscall_get_return_value so that it can
handle 32-bit compatible case and can be used by for example audit, just
like what syscall_get_error does.
Suggested-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: He Zhe <zhe.he@windriver.com>
---
v1 to v2: Improve error code check suggested by Mark
arch/arm64/include/asm/syscall.h | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/include/asm/syscall.h b/arch/arm64/include/asm/syscall.h
index cfc0672013f6..c3b5fca82ff4 100644
--- a/arch/arm64/include/asm/syscall.h
+++ b/arch/arm64/include/asm/syscall.h
@@ -44,7 +44,20 @@ static inline long syscall_get_error(struct task_struct *task,
static inline long syscall_get_return_value(struct task_struct *task,
struct pt_regs *regs)
{
- return regs->regs[0];
+ long val = regs->regs[0];
+ long error = val;
+
+ if (compat_user_mode(regs))
+ error = sign_extend64(error, 31);
+
+ /*
+ * Return codes with bit 31 set may or may not be an error code.
+ * For example, mmap may return a legal 32 bit address with bit 31 set
+ * for 32 bit thread, in which case the untouched val should be
+ * returned. Otherwise, the sign-extended error should be returned if
+ * it still falls in error number range.
+ */
+ return IS_ERR_VALUE(error) ? error : val;
}
static inline void syscall_set_return_value(struct task_struct *task,
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 3/3] audit: Use syscall_get_return_value to get syscall return code in audit_syscall_exit
2021-04-23 10:35 [PATCH v2 1/3] arm64: ptrace: Add is_syscall_success to handle compat He Zhe
2021-04-23 10:35 ` [PATCH v2 2/3] arm64: syscall.h: Add sign extension handling in syscall_get_return_value for compat He Zhe
@ 2021-04-23 10:35 ` He Zhe
2021-05-10 22:38 ` Paul Moore
1 sibling, 1 reply; 9+ messages in thread
From: He Zhe @ 2021-04-23 10:35 UTC (permalink / raw)
To: oleg, catalin.marinas, will, linux-arm-kernel, paul, eparis,
linux-audit, linux-kernel, zhe.he
regs_return_value for some architectures like arm64 simply retrieve
register value from pt_regs without sign extension in 32-bit compatible
case and cause audit to have false syscall return code. For example,
32-bit -13 would be treated as 4294967283 below.
type=SYSCALL msg=audit(1611110715.887:582): arch=40000028 syscall=322
success=yes exit=4294967283
We just added proper sign extension in syscall_get_return_value which
should be used instead.
Signed-off-by: He Zhe <zhe.he@windriver.com>
---
v1 to v2: No change
include/linux/audit.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 82b7c1116a85..135adbe22c19 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -334,7 +334,7 @@ static inline void audit_syscall_exit(void *pt_regs)
{
if (unlikely(audit_context())) {
int success = is_syscall_success(pt_regs);
- long return_code = regs_return_value(pt_regs);
+ long return_code = syscall_get_return_value(current, pt_regs);
__audit_syscall_exit(success, return_code);
}
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2 2/3] arm64: syscall.h: Add sign extension handling in syscall_get_return_value for compat
2021-04-23 10:35 ` [PATCH v2 2/3] arm64: syscall.h: Add sign extension handling in syscall_get_return_value for compat He Zhe
@ 2021-05-05 17:30 ` Mark Rutland
0 siblings, 0 replies; 9+ messages in thread
From: Mark Rutland @ 2021-05-05 17:30 UTC (permalink / raw)
To: He Zhe
Cc: oleg, catalin.marinas, will, linux-arm-kernel, paul, eparis,
linux-audit, linux-kernel
Hi,
On Fri, Apr 23, 2021 at 06:35:32PM +0800, He Zhe wrote:
> Add sign extension handling in syscall_get_return_value so that it can
> handle 32-bit compatible case and can be used by for example audit, just
> like what syscall_get_error does.
>
> Suggested-by: Mark Rutland <mark.rutland@arm.com>
> Signed-off-by: He Zhe <zhe.he@windriver.com>
> ---
> v1 to v2: Improve error code check suggested by Mark
>
> arch/arm64/include/asm/syscall.h | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/include/asm/syscall.h b/arch/arm64/include/asm/syscall.h
> index cfc0672013f6..c3b5fca82ff4 100644
> --- a/arch/arm64/include/asm/syscall.h
> +++ b/arch/arm64/include/asm/syscall.h
> @@ -44,7 +44,20 @@ static inline long syscall_get_error(struct task_struct *task,
> static inline long syscall_get_return_value(struct task_struct *task,
> struct pt_regs *regs)
> {
> - return regs->regs[0];
> + long val = regs->regs[0];
> + long error = val;
> +
> + if (compat_user_mode(regs))
> + error = sign_extend64(error, 31);
> +
> + /*
> + * Return codes with bit 31 set may or may not be an error code.
> + * For example, mmap may return a legal 32 bit address with bit 31 set
> + * for 32 bit thread, in which case the untouched val should be
> + * returned. Otherwise, the sign-extended error should be returned if
> + * it still falls in error number range.
> + */
> + return IS_ERR_VALUE(error) ? error : val;
I'm afraid I have misled you here.
I wrote up a test that uses PTRACE_GET_SYSCALL_INFO, and I found that on
a 32-bit arm (v5.12) kernel, *all* syscall return values get
sign-extended after all. For example, if (on a 32-bit kernel) I use
MAP_FIXED to mmap() at address 0x8bad0000, the return value reported in
ptrace_syscall_info::exit::rval is 0xffffffff8bad0000.
So for that we shoudn't have the IS_ERR_VALUE() check after all, but I'm
not currently sure whether there are other cases where 32-bit arm
wouldn't sign-extend, and I think we'll need to dig into this some more.
Thanks,
Mark.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 3/3] audit: Use syscall_get_return_value to get syscall return code in audit_syscall_exit
2021-04-23 10:35 ` [PATCH v2 3/3] audit: Use syscall_get_return_value to get syscall return code in audit_syscall_exit He Zhe
@ 2021-05-10 22:38 ` Paul Moore
2021-05-11 3:19 ` He Zhe
0 siblings, 1 reply; 9+ messages in thread
From: Paul Moore @ 2021-05-10 22:38 UTC (permalink / raw)
To: He Zhe
Cc: oleg, catalin.marinas, will, linux-arm-kernel, Eric Paris,
linux-audit, linux-kernel
On Fri, Apr 23, 2021 at 6:36 AM He Zhe <zhe.he@windriver.com> wrote:
>
> regs_return_value for some architectures like arm64 simply retrieve
> register value from pt_regs without sign extension in 32-bit compatible
> case and cause audit to have false syscall return code. For example,
> 32-bit -13 would be treated as 4294967283 below.
>
> type=SYSCALL msg=audit(1611110715.887:582): arch=40000028 syscall=322
> success=yes exit=4294967283
>
> We just added proper sign extension in syscall_get_return_value which
> should be used instead.
>
> Signed-off-by: He Zhe <zhe.he@windriver.com>
> ---
> v1 to v2: No change
>
> include/linux/audit.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Perhaps I missed it but did you address the compile error that was
found by the kernel test robot?
Regardless, one comment inline below ...
> diff --git a/include/linux/audit.h b/include/linux/audit.h
> index 82b7c1116a85..135adbe22c19 100644
> --- a/include/linux/audit.h
> +++ b/include/linux/audit.h
> @@ -334,7 +334,7 @@ static inline void audit_syscall_exit(void *pt_regs)
> {
> if (unlikely(audit_context())) {
> int success = is_syscall_success(pt_regs);
Since we are shifting to use syscall_get_return_value() below, would
it also make sense to shift to using syscall_get_error() here instead
of is_syscall_success()?
> - long return_code = regs_return_value(pt_regs);
> + long return_code = syscall_get_return_value(current, pt_regs);
>
> __audit_syscall_exit(success, return_code);
> }
--
paul moore
www.paul-moore.com
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 3/3] audit: Use syscall_get_return_value to get syscall return code in audit_syscall_exit
2021-05-10 22:38 ` Paul Moore
@ 2021-05-11 3:19 ` He Zhe
2021-05-11 14:51 ` Paul Moore
0 siblings, 1 reply; 9+ messages in thread
From: He Zhe @ 2021-05-11 3:19 UTC (permalink / raw)
To: Paul Moore
Cc: oleg, catalin.marinas, will, linux-arm-kernel, Eric Paris,
linux-audit, linux-kernel
On 5/11/21 6:38 AM, Paul Moore wrote:
> On Fri, Apr 23, 2021 at 6:36 AM He Zhe <zhe.he@windriver.com> wrote:
>> regs_return_value for some architectures like arm64 simply retrieve
>> register value from pt_regs without sign extension in 32-bit compatible
>> case and cause audit to have false syscall return code. For example,
>> 32-bit -13 would be treated as 4294967283 below.
>>
>> type=SYSCALL msg=audit(1611110715.887:582): arch=40000028 syscall=322
>> success=yes exit=4294967283
>>
>> We just added proper sign extension in syscall_get_return_value which
>> should be used instead.
>>
>> Signed-off-by: He Zhe <zhe.he@windriver.com>
>> ---
>> v1 to v2: No change
>>
>> include/linux/audit.h | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
> Perhaps I missed it but did you address the compile error that was
> found by the kernel test robot?
I sent a patch adding syscall_get_return_value for alpha to fix this bot warning.
https://lore.kernel.org/lkml/20210426091629.45020-1-zhe.he@windriver.com/
which can be found in this mail thread.
>
> Regardless, one comment inline below ...
>
>> diff --git a/include/linux/audit.h b/include/linux/audit.h
>> index 82b7c1116a85..135adbe22c19 100644
>> --- a/include/linux/audit.h
>> +++ b/include/linux/audit.h
>> @@ -334,7 +334,7 @@ static inline void audit_syscall_exit(void *pt_regs)
>> {
>> if (unlikely(audit_context())) {
>> int success = is_syscall_success(pt_regs);
> Since we are shifting to use syscall_get_return_value() below, would
> it also make sense to shift to using syscall_get_error() here instead
> of is_syscall_success()?
In [PATCH v2 1/3], is_syscall_success calls syscall_get_return_value to take
care of the sign extension issue. Keeping using is_syscall_success is to not
potentially changing other architectures' behavior.
Thanks,
Zhe
>
>> - long return_code = regs_return_value(pt_regs);
>> + long return_code = syscall_get_return_value(current, pt_regs);
>>
>> __audit_syscall_exit(success, return_code);
>> }
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 3/3] audit: Use syscall_get_return_value to get syscall return code in audit_syscall_exit
2021-05-11 3:19 ` He Zhe
@ 2021-05-11 14:51 ` Paul Moore
2021-05-12 8:43 ` He Zhe
0 siblings, 1 reply; 9+ messages in thread
From: Paul Moore @ 2021-05-11 14:51 UTC (permalink / raw)
To: He Zhe
Cc: oleg, catalin.marinas, will, linux-arm-kernel, Eric Paris,
linux-audit, linux-kernel
On Mon, May 10, 2021 at 11:19 PM He Zhe <zhe.he@windriver.com> wrote:
> On 5/11/21 6:38 AM, Paul Moore wrote:
> > On Fri, Apr 23, 2021 at 6:36 AM He Zhe <zhe.he@windriver.com> wrote:
> >> regs_return_value for some architectures like arm64 simply retrieve
> >> register value from pt_regs without sign extension in 32-bit compatible
> >> case and cause audit to have false syscall return code. For example,
> >> 32-bit -13 would be treated as 4294967283 below.
> >>
> >> type=SYSCALL msg=audit(1611110715.887:582): arch=40000028 syscall=322
> >> success=yes exit=4294967283
> >>
> >> We just added proper sign extension in syscall_get_return_value which
> >> should be used instead.
> >>
> >> Signed-off-by: He Zhe <zhe.he@windriver.com>
> >> ---
> >> v1 to v2: No change
> >>
> >> include/linux/audit.h | 2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > Perhaps I missed it but did you address the compile error that was
> > found by the kernel test robot?
>
> I sent a patch adding syscall_get_return_value for alpha to fix this bot warning.
> https://lore.kernel.org/lkml/20210426091629.45020-1-zhe.he@windriver.com/
> which can be found in this mail thread.
At the very least you should respin the patchset with the alpha fix
included in the patchset; it's a bit messy otherwise.
> >> diff --git a/include/linux/audit.h b/include/linux/audit.h
> >> index 82b7c1116a85..135adbe22c19 100644
> >> --- a/include/linux/audit.h
> >> +++ b/include/linux/audit.h
> >> @@ -334,7 +334,7 @@ static inline void audit_syscall_exit(void *pt_regs)
> >> {
> >> if (unlikely(audit_context())) {
> >> int success = is_syscall_success(pt_regs);
> >
> > Since we are shifting to use syscall_get_return_value() below, would
> > it also make sense to shift to using syscall_get_error() here instead
> > of is_syscall_success()?
>
> In [PATCH v2 1/3], is_syscall_success calls syscall_get_return_value to take
> care of the sign extension issue. Keeping using is_syscall_success is to not
> potentially changing other architectures' behavior.
That was only for aarch64, right? What about all the other
architectures? The comment block for syscall_get_return_value()
advises that syscall_get_error() should be used and that appears to be
what is done in the ptrace code.
--
paul moore
www.paul-moore.com
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 3/3] audit: Use syscall_get_return_value to get syscall return code in audit_syscall_exit
2021-05-11 14:51 ` Paul Moore
@ 2021-05-12 8:43 ` He Zhe
2021-05-14 20:33 ` Paul Moore
0 siblings, 1 reply; 9+ messages in thread
From: He Zhe @ 2021-05-12 8:43 UTC (permalink / raw)
To: Paul Moore
Cc: oleg, catalin.marinas, will, linux-arm-kernel, Eric Paris,
linux-audit, linux-kernel
On 5/11/21 10:51 PM, Paul Moore wrote:
> On Mon, May 10, 2021 at 11:19 PM He Zhe <zhe.he@windriver.com> wrote:
>> On 5/11/21 6:38 AM, Paul Moore wrote:
>>> On Fri, Apr 23, 2021 at 6:36 AM He Zhe <zhe.he@windriver.com> wrote:
>>>> regs_return_value for some architectures like arm64 simply retrieve
>>>> register value from pt_regs without sign extension in 32-bit compatible
>>>> case and cause audit to have false syscall return code. For example,
>>>> 32-bit -13 would be treated as 4294967283 below.
>>>>
>>>> type=SYSCALL msg=audit(1611110715.887:582): arch=40000028 syscall=322
>>>> success=yes exit=4294967283
>>>>
>>>> We just added proper sign extension in syscall_get_return_value which
>>>> should be used instead.
>>>>
>>>> Signed-off-by: He Zhe <zhe.he@windriver.com>
>>>> ---
>>>> v1 to v2: No change
>>>>
>>>> include/linux/audit.h | 2 +-
>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>> Perhaps I missed it but did you address the compile error that was
>>> found by the kernel test robot?
>> I sent a patch adding syscall_get_return_value for alpha to fix this bot warning.
>> https://lore.kernel.org/lkml/20210426091629.45020-1-zhe.he@windriver.com/
>> which can be found in this mail thread.
> At the very least you should respin the patchset with the alpha fix
> included in the patchset; it's a bit messy otherwise.
>
>>>> diff --git a/include/linux/audit.h b/include/linux/audit.h
>>>> index 82b7c1116a85..135adbe22c19 100644
>>>> --- a/include/linux/audit.h
>>>> +++ b/include/linux/audit.h
>>>> @@ -334,7 +334,7 @@ static inline void audit_syscall_exit(void *pt_regs)
>>>> {
>>>> if (unlikely(audit_context())) {
>>>> int success = is_syscall_success(pt_regs);
>>> Since we are shifting to use syscall_get_return_value() below, would
>>> it also make sense to shift to using syscall_get_error() here instead
>>> of is_syscall_success()?
>> In [PATCH v2 1/3], is_syscall_success calls syscall_get_return_value to take
>> care of the sign extension issue. Keeping using is_syscall_success is to not
>> potentially changing other architectures' behavior.
> That was only for aarch64, right? What about all the other
> architectures? The comment block for syscall_get_return_value()
> advises that syscall_get_error() should be used and that appears to be
> what is done in the ptrace code.
Yes, it was only for aarch64. No similar issue hasn't observed for other
architectures on my side, so I was trying to minimize the impact.
The "comment block" you mentioned is the following line, right?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/asm-generic/syscall.h#n77
[PATCH v2 2/3] was used to cover this concern. But as we can see in
Mark Rutland's last reply, there'are more things to be considered and we are
still trying to find a proper solution.
Thanks,
Zhe
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 3/3] audit: Use syscall_get_return_value to get syscall return code in audit_syscall_exit
2021-05-12 8:43 ` He Zhe
@ 2021-05-14 20:33 ` Paul Moore
0 siblings, 0 replies; 9+ messages in thread
From: Paul Moore @ 2021-05-14 20:33 UTC (permalink / raw)
To: He Zhe
Cc: oleg, catalin.marinas, will, linux-arm-kernel, Eric Paris,
linux-audit, linux-kernel
On Wed, May 12, 2021 at 4:43 AM He Zhe <zhe.he@windriver.com> wrote:
> On 5/11/21 10:51 PM, Paul Moore wrote:
> > On Mon, May 10, 2021 at 11:19 PM He Zhe <zhe.he@windriver.com> wrote:
> >> On 5/11/21 6:38 AM, Paul Moore wrote:
> >>> On Fri, Apr 23, 2021 at 6:36 AM He Zhe <zhe.he@windriver.com> wrote:
> >>>> regs_return_value for some architectures like arm64 simply retrieve
> >>>> register value from pt_regs without sign extension in 32-bit compatible
> >>>> case and cause audit to have false syscall return code. For example,
> >>>> 32-bit -13 would be treated as 4294967283 below.
> >>>>
> >>>> type=SYSCALL msg=audit(1611110715.887:582): arch=40000028 syscall=322
> >>>> success=yes exit=4294967283
> >>>>
> >>>> We just added proper sign extension in syscall_get_return_value which
> >>>> should be used instead.
> >>>>
> >>>> Signed-off-by: He Zhe <zhe.he@windriver.com>
> >>>> ---
> >>>> v1 to v2: No change
> >>>>
> >>>> include/linux/audit.h | 2 +-
> >>>> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>> Perhaps I missed it but did you address the compile error that was
> >>> found by the kernel test robot?
> >> I sent a patch adding syscall_get_return_value for alpha to fix this bot warning.
> >> https://lore.kernel.org/lkml/20210426091629.45020-1-zhe.he@windriver.com/
> >> which can be found in this mail thread.
> > At the very least you should respin the patchset with the alpha fix
> > included in the patchset; it's a bit messy otherwise.
> >
> >>>> diff --git a/include/linux/audit.h b/include/linux/audit.h
> >>>> index 82b7c1116a85..135adbe22c19 100644
> >>>> --- a/include/linux/audit.h
> >>>> +++ b/include/linux/audit.h
> >>>> @@ -334,7 +334,7 @@ static inline void audit_syscall_exit(void *pt_regs)
> >>>> {
> >>>> if (unlikely(audit_context())) {
> >>>> int success = is_syscall_success(pt_regs);
> >>> Since we are shifting to use syscall_get_return_value() below, would
> >>> it also make sense to shift to using syscall_get_error() here instead
> >>> of is_syscall_success()?
> >> In [PATCH v2 1/3], is_syscall_success calls syscall_get_return_value to take
> >> care of the sign extension issue. Keeping using is_syscall_success is to not
> >> potentially changing other architectures' behavior.
> > That was only for aarch64, right? What about all the other
> > architectures? The comment block for syscall_get_return_value()
> > advises that syscall_get_error() should be used and that appears to be
> > what is done in the ptrace code.
>
> Yes, it was only for aarch64. No similar issue hasn't observed for other
> architectures on my side, so I was trying to minimize the impact.
>
> The "comment block" you mentioned is the following line, right?
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/asm-generic/syscall.h#n77
> [PATCH v2 2/3] was used to cover this concern. But as we can see in
> Mark Rutland's last reply, there'are more things to be considered and we are
> still trying to find a proper solution.
It sounds like you are going to be submitting another patchset at some
point in the future - that's good - when you do please use
syscall_get_error() in conjunction with syscall_get_return_value() or
explain why doing so is wrong. The explanation should be in a code
comment, not just an email and/or commit description.
--
paul moore
www.paul-moore.com
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2021-05-14 20:35 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-23 10:35 [PATCH v2 1/3] arm64: ptrace: Add is_syscall_success to handle compat He Zhe
2021-04-23 10:35 ` [PATCH v2 2/3] arm64: syscall.h: Add sign extension handling in syscall_get_return_value for compat He Zhe
2021-05-05 17:30 ` Mark Rutland
2021-04-23 10:35 ` [PATCH v2 3/3] audit: Use syscall_get_return_value to get syscall return code in audit_syscall_exit He Zhe
2021-05-10 22:38 ` Paul Moore
2021-05-11 3:19 ` He Zhe
2021-05-11 14:51 ` Paul Moore
2021-05-12 8:43 ` He Zhe
2021-05-14 20:33 ` Paul Moore
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).