All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xiao Yang <yangx.jy@cn.fujitsu.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] syscalls/execveat03: Fix compiler errors
Date: Wed, 22 Aug 2018 09:17:40 +0800	[thread overview]
Message-ID: <5B7CB9B4.9000405@cn.fujitsu.com> (raw)
In-Reply-To: <1642007852.41615039.1534852963645.JavaMail.zimbra@redhat.com>

On 2018/08/21 20:02, Jan Stancek wrote:
>
> ----- Original Message -----
>> According to open(2) and linkat(2) manpages, O_PATH and AT_EMPTY_PATH
>> flags were added since kernel v2.6.39, so these undefined flags led
>> to the following errors on older kernels(e.g. v2.6.32):
>> ---------------------------------------------------------
>> execveat03.c:66: error: ‘O_PATH’ undeclared (first use in this function)
>> execveat03.c:69: error: ‘AT_EMPTY_PATH’ undeclared (first use in this
>> function)
>> ---------------------------------------------------------
>>
>> 1) Add AT_EMPTY_PATH into lapi/fcntl.h
>> 2) Include lapi/fcntl.h in execveat03.c
> Agreed with 1 and 2.
>
>> 3) Check if open(2) supports O_PATH
> Do we need to worry about this one? execveat() has been introduced [1]
> around v3.19. Those kernels should already support O_PATH.
>
> [1] 51f39a1f0cea ("syscalls: implement execveat() system call")
Hi Jan,

Thanks for your review.
It is reasonable to drop this check as you explained.

Thanks,
Xiao Yang
>> Signed-off-by: Xiao Yang<yangx.jy@cn.fujitsu.com>
>> ---
>>   include/lapi/fcntl.h                            |  4 ++++
>>   testcases/kernel/syscalls/execveat/execveat03.c | 10 +++++++++-
>>   2 files changed, 13 insertions(+), 1 deletion(-)
>>
>> diff --git a/include/lapi/fcntl.h b/include/lapi/fcntl.h
>> index 849439d..358230f 100644
>> --- a/include/lapi/fcntl.h
>> +++ b/include/lapi/fcntl.h
>> @@ -103,6 +103,10 @@
>>   # define AT_SYMLINK_NOFOLLOW 0x100
>>   #endif
>>
>> +#ifndef AT_EMPTY_PATH
>> +# define AT_EMPTY_PATH 0x1000
>> +#endif
>> +
>>   #ifndef AT_REMOVEDIR
>>   # define AT_REMOVEDIR 0x200
>>   #endif
>> diff --git a/testcases/kernel/syscalls/execveat/execveat03.c
>> b/testcases/kernel/syscalls/execveat/execveat03.c
>> index df27273..701784e 100644
>> --- a/testcases/kernel/syscalls/execveat/execveat03.c
>> +++ b/testcases/kernel/syscalls/execveat/execveat03.c
>> @@ -49,6 +49,7 @@
>>   #include<fcntl.h>
>>   #include "tst_test.h"
>>   #include "lapi/execveat.h"
>> +#include "lapi/fcntl.h"
>>
>>   #define OVL_MNT "ovl"
>>   #define TEST_APP "execveat_child"
>> @@ -63,7 +64,14 @@ static void do_child(void)
>>
>>   	SAFE_CP(TEST_APP, TEST_FILE_PATH);
>>
>> -	fd = SAFE_OPEN(TEST_FILE_PATH, O_PATH);
>> +	fd = open(TEST_FILE_PATH, O_PATH);
>> +	if (fd == -1) {
>> +		if (errno == EINVAL)
>> +			tst_brk(TCONF, "open() did not support O_PATH");
>> +		else
>> +			tst_brk(TBROK, "open() failed");
>> +	}
>> +
>>   	SAFE_UNLINK(TEST_FILE_PATH);
>>
>>   	TEST(execveat(fd, "", argv, environ, AT_EMPTY_PATH));
>> --
>> 1.8.3.1
>>
>>
>>
>>
>> --
>> Mailing list info: https://lists.linux.it/listinfo/ltp
>>
>
> .
>




  reply	other threads:[~2018-08-22  1:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-20  4:49 [LTP] [PATCH] syscalls/execveat03: Fix compiler errors Xiao Yang
2018-08-21 12:02 ` Jan Stancek
2018-08-22  1:17   ` Xiao Yang [this message]
2018-08-22  1:54   ` [LTP] [PATCH v2] " Xiao Yang
2018-08-22  6:49     ` Jan Stancek

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=5B7CB9B4.9000405@cn.fujitsu.com \
    --to=yangx.jy@cn.fujitsu.com \
    --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.