All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] getrlimit/getrlimit03: fix unavailable __NR_getrlimit for arm
Date: Wed, 23 Jun 2021 15:42:24 +0200	[thread overview]
Message-ID: <YNM6QGFYt/bpaPDS@yuki> (raw)
In-Reply-To: <20210623134041.366838-1-balsini@android.com>

Hi!
> __NR_getrlimit has been deprecated from arm EABI, and is only available
> if the OABI_COMPAT config option is defined.
> This causes failures with the current test as it assumes that
> __NR_getrlimit exists if __NR_ugetrlimit is defined, while this
> assumption does not hold anymore.
> 
> Catch this exception by testing if __NR_getrlimit is defined and the
> target is arm.

I suppose that this a proper fix for:

https://github.com/linux-test-project/ltp/issues/819

> Signed-off-by: Alessio Balsini <balsini@android.com>
> ---
>  testcases/kernel/syscalls/getrlimit/getrlimit03.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/testcases/kernel/syscalls/getrlimit/getrlimit03.c b/testcases/kernel/syscalls/getrlimit/getrlimit03.c
> index 319bc494a..e46a25f7b 100644
> --- a/testcases/kernel/syscalls/getrlimit/getrlimit03.c
> +++ b/testcases/kernel/syscalls/getrlimit/getrlimit03.c
> @@ -45,6 +45,14 @@
>  #define __NR_getrlimit_ulong_str	"__NR_getrlimit"
>  #endif
>  
> +/**
> + * __NR_getrlimit has been deprecated from arm EABI and moved to OABI_COMPAT,
> + * so the syscall may or may not be available.
> + */
> +#if defined(__arm__) && __NR_getrlimit == __LTP__NR_INVALID_SYSCALL
> +#define DEPRECATED_GETRLIMIT
> +#endif
> +
>  #ifndef HAVE_STRUCT_RLIMIT64
>  struct rlimit64 {
>  	uint64_t rlim_cur;
> @@ -167,7 +175,7 @@ static void run(unsigned int resource)
>  	tst_res(TPASS, "__NR_prlimit64(%d) and %s(%d) gave consistent results",
>  		resource, __NR_getrlimit_ulong_str, resource);
>  
> -#if SIGNED_GETRLIMIT
> +#if SIGNED_GETRLIMIT && !defined(DEPRECATED_GETRLIMIT)
>  	errno = 0;
>  	ret_l = getrlimit_long(resource, &rlim_l);
>  	errno_l = errno;

I guess that this generates a few unused function warnings, can we fix
all the places with #if SIGNED_GETRLIMIT in the source code please?

-- 
Cyril Hrubis
chrubis@suse.cz

  reply	other threads:[~2021-06-23 13:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-23 13:40 [LTP] [PATCH] getrlimit/getrlimit03: fix unavailable __NR_getrlimit for arm Alessio Balsini
2021-06-23 13:42 ` Cyril Hrubis [this message]
2021-06-24 12:31   ` Alessio Balsini
2021-06-25 11:57     ` Cyril Hrubis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YNM6QGFYt/bpaPDS@yuki \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.