* Re: [LTP] [RFC PATCH 1/3] ARM64: ILP32: modify struct kernel_sigaction
[not found] ` <1426742198-17967-2-git-send-email-bamvor.zhangjian@huawei.com>
@ 2015-03-19 11:33 ` Jan Stancek
2015-03-19 12:40 ` Jan Stancek
2015-03-19 15:18 ` Bamvor Zhang
0 siblings, 2 replies; 6+ messages in thread
From: Jan Stancek @ 2015-03-19 11:33 UTC (permalink / raw)
To: Zhang Jian(Bamvor)
Cc: dingtianhong, ltp-list, bintian wang, apinski, yangyingliang
----- Original Message -----
> From: "Zhang Jian(Bamvor)" <bamvor.zhangjian@huawei.com>
> To: ltp-list@lists.sourceforge.net
> Cc: "bintian wang" <bintian.wang@huawei.com>, yangyingliang@huawei.com, apinski@cavium.com, dingtianhong@huawei.com
> Sent: Thursday, 19 March, 2015 6:16:36 AM
> Subject: [LTP] [RFC PATCH 1/3] ARM64: ILP32: modify struct kernel_sigaction
>
> From: Yang Yingliang <yangyingliang@huawei.com>
>
> In ILP32, the sigaction struct is the same as AARCH64.
> To allow for this to work, we use a long long fields and
> then add extra casts when converting between the user
> exposed struct and the kernel exposed struct.
> The modify is came from a patch of glibc,
> the commit is 9266f4b060f6("Add kernel_sigaction.h for AARCH64 ILP32").
>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
> include/lapi/rt_sigaction.h | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/include/lapi/rt_sigaction.h b/include/lapi/rt_sigaction.h
> index 46f6a50..2b1365a 100644
> --- a/include/lapi/rt_sigaction.h
> +++ b/include/lapi/rt_sigaction.h
> @@ -34,9 +34,9 @@
> #define INVAL_SA_PTR ((void *)-1)
>
> struct kernel_sigaction {
> - __sighandler_t k_sa_handler;
> - unsigned long sa_flags;
> - void (*sa_restorer) (void);
> + unsigned long long k_sa_handler;
> + unsigned long long sa_flags;
> + unsigned long long sa_restorer;
Isn't this going to break i386? (long is 4, long long is 8).
Regards,
Jan
> sigset_t sa_mask;
> };
>
> @@ -159,7 +159,7 @@ static int ltp_rt_sigaction(int signum, const struct
> sigaction *act,
> if (act == INVAL_SA_PTR) {
> kact_p = INVAL_SA_PTR;
> } else if (act) {
> - kact.k_sa_handler = act->sa_handler;
> + kact.k_sa_handler = (unsigned long long)(uintptr_t)act->sa_handler;
> memcpy(&kact.sa_mask, &act->sa_mask, sizeof(sigset_t));
> kact.sa_flags = act->sa_flags;
> kact.sa_restorer = NULL;
> @@ -203,12 +203,12 @@ static int ltp_rt_sigaction(int signum, const struct
> sigaction *act,
>
> if (ret >= 0) {
> if (oact && (oact != INVAL_SA_PTR)) {
> - oact->sa_handler = koact.k_sa_handler;
> + oact->sa_handler = (void*)(uintptr_t)koact.k_sa_handler;
> memcpy(&oact->sa_mask, &koact.sa_mask,
> sizeof(sigset_t));
> oact->sa_flags = koact.sa_flags;
> #ifdef HAVE_SA_RESTORER
> - oact->sa_restorer = koact.sa_restorer;
> + oact->sa_restorer = (void*)(uintptr_t)koact.sa_restorer;
> #endif
> }
> }
> --
> 1.8.4.5
>
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming The Go Parallel Website,
> sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for
> all
> things parallel software development, from weekly thought leadership blogs to
> news, videos, case studies, tutorials and more. Take a look and join the
> conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list
>
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [LTP] [RFC PATCH 2/3] ARM64: ILP32: cast for negtive off_t
[not found] ` <1426742198-17967-3-git-send-email-bamvor.zhangjian@huawei.com>
@ 2015-03-19 11:49 ` Cyril Hrubis
[not found] ` <18FC2E80-AF7B-408C-8863-B4FC532B5CD4@caviumnetworks.com>
0 siblings, 1 reply; 6+ messages in thread
From: Cyril Hrubis @ 2015-03-19 11:49 UTC (permalink / raw)
To: Zhang Jian(Bamvor)
Cc: dingtianhong, ltp-list, bintian.wang, apinski, yangyingliang
Hi!
> off_t in 64bit in ILP32 ABI while the compiler will default 32bit
> for constant. It lead to pass the negative 32bit integer to kernel,
> and kernel will treat it as 64bit positive integer.
>
> It could also fix in glibc while we think that there are lots of
> advantage if leave off_t remains 64bit.
>
> Signed-off-by: Zhang Jian(Bamvor) <bamvor.zhangjian@huawei.com>
> ---
> testcases/kernel/fs/ftest/ftest02.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/testcases/kernel/fs/ftest/ftest02.c b/testcases/kernel/fs/ftest/ftest02.c
> index ec70d9b..153bd09 100644
> --- a/testcases/kernel/fs/ftest/ftest02.c
> +++ b/testcases/kernel/fs/ftest/ftest02.c
> @@ -268,7 +268,7 @@ static void crfile(int me, int count)
> val = write(fd, crmsg, sizeof(crmsg) - 1);
> warn(val, "write", 0);
>
> - val = lseek(fd, -(sizeof(crmsg) - 1), 1);
> + val = lseek(fd, -(off_t)(sizeof(crmsg) - 1), 1);
Hmm, this is doing lseek(fd, -size_of_message, SEEK_CUR), wouldn't it be
easier to use the offset we passed to the first lseek() with SEEK_SET
instead?
And I do not really understand why this does not work. All I can see
that the expression is evaluated as: sizeof() returns size of the
message as size_t, which is 32 bit, we decrement it by one and then
negate it. We have negative 32 bit number. Then the compiler should pick
up the lseek() prototype from glibc header and figure out that it should
convert the second parameter to off_t. What I'm missing here?
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [LTP] [RFC PATCH 2/3] ARM64: ILP32: cast for negtive off_t
[not found] ` <18FC2E80-AF7B-408C-8863-B4FC532B5CD4@caviumnetworks.com>
@ 2015-03-19 12:00 ` Cyril Hrubis
0 siblings, 0 replies; 6+ messages in thread
From: Cyril Hrubis @ 2015-03-19 12:00 UTC (permalink / raw)
To: Pinski, Andrew
Cc: ltp-list@lists.sourceforge.net, bintian.wang@huawei.com,
yangyingliang@huawei.com, apinski@cavium.com,
dingtianhong@huawei.com
Hi!
> 32bit unsigned value
Ah, right, size_t is unsigned, that explains it.
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [LTP] [RFC PATCH 3/3] ARM64: ILP32: define LTP_USE_64_ABI for ILP32
[not found] ` <1426742198-17967-4-git-send-email-bamvor.zhangjian@huawei.com>
@ 2015-03-19 12:01 ` Cyril Hrubis
0 siblings, 0 replies; 6+ messages in thread
From: Cyril Hrubis @ 2015-03-19 12:01 UTC (permalink / raw)
To: Zhang Jian(Bamvor)
Cc: dingtianhong, ltp-list, bintian.wang, apinski, yangyingliang
Hi!
> It will affect the testcase fallocatexx, fanotifyxx
Pushed, thanks.
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [LTP] [RFC PATCH 1/3] ARM64: ILP32: modify struct kernel_sigaction
2015-03-19 11:33 ` [LTP] [RFC PATCH 1/3] ARM64: ILP32: modify struct kernel_sigaction Jan Stancek
@ 2015-03-19 12:40 ` Jan Stancek
2015-03-19 15:18 ` Bamvor Zhang
1 sibling, 0 replies; 6+ messages in thread
From: Jan Stancek @ 2015-03-19 12:40 UTC (permalink / raw)
To: Zhang Jian(Bamvor)
Cc: ltp-list, bintian wang, yangyingliang, apinski, dingtianhong
[-- Attachment #1: Type: text/plain, Size: 2035 bytes --]
On 03/19/2015 12:33 PM, Jan Stancek wrote:
>
>
>
>
> ----- Original Message -----
>> From: "Zhang Jian(Bamvor)" <bamvor.zhangjian@huawei.com>
>> To: ltp-list@lists.sourceforge.net
>> Cc: "bintian wang" <bintian.wang@huawei.com>, yangyingliang@huawei.com, apinski@cavium.com, dingtianhong@huawei.com
>> Sent: Thursday, 19 March, 2015 6:16:36 AM
>> Subject: [LTP] [RFC PATCH 1/3] ARM64: ILP32: modify struct kernel_sigaction
>>
>> From: Yang Yingliang <yangyingliang@huawei.com>
>>
>> In ILP32, the sigaction struct is the same as AARCH64.
>> To allow for this to work, we use a long long fields and
>> then add extra casts when converting between the user
>> exposed struct and the kernel exposed struct.
>> The modify is came from a patch of glibc,
>> the commit is 9266f4b060f6("Add kernel_sigaction.h for AARCH64 ILP32").
>>
>> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
>> ---
>> include/lapi/rt_sigaction.h | 12 ++++++------
>> 1 file changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/include/lapi/rt_sigaction.h b/include/lapi/rt_sigaction.h
>> index 46f6a50..2b1365a 100644
>> --- a/include/lapi/rt_sigaction.h
>> +++ b/include/lapi/rt_sigaction.h
>> @@ -34,9 +34,9 @@
>> #define INVAL_SA_PTR ((void *)-1)
>>
>> struct kernel_sigaction {
>> - __sighandler_t k_sa_handler;
>> - unsigned long sa_flags;
>> - void (*sa_restorer) (void);
>> + unsigned long long k_sa_handler;
>> + unsigned long long sa_flags;
>> + unsigned long long sa_restorer;
>
> Isn't this going to break i386? (long is 4, long long is 8).
Hi,
Attached is a testcase I put together to check how it behaves.
It's expected that signal handler will run on alternate stack and
testcase will print "frame_addr is within my_stack: 1"
# uname -m
i686
LTP HEAD:
# ./rt_sigaction04
my_stack: 0x0804d260 frame_addr: 0x0844cd08
frame_addr is within my_stack: 1
LTP HEAD + patch that changes kernel_sigaction to long long
# ./rt_sigaction04
my_stack: 0x0804d260 frame_addr: 0xbfda5068
frame_addr is within my_stack: 0
Regards,
Jan
[-- Attachment #2: rt_sigaction04.c --]
[-- Type: text/x-csrc, Size: 1435 bytes --]
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <inttypes.h>
#include <errno.h>
#include <sys/syscall.h>
#include <string.h>
#include "test.h"
#include "linux_syscall_numbers.h"
#include "lapi/rt_sigaction.h"
char *TCID = "rt_sigaction01";
int TST_TOTAL = 1;
static char my_stack[4*1024*1024];
static void handler(int sig)
{
(void) sig;
uintptr_t frame_addr = (uintptr_t) __builtin_frame_address(0);
uintptr_t stack_addr = (uintptr_t) &my_stack;
uintptr_t stack_last = stack_addr + sizeof(my_stack);
printf("my_stack: 0x%08"PRIxPTR " frame_addr: 0x%08"PRIxPTR "\n",
stack_addr, frame_addr);
printf("frame_addr is within my_stack: %d\n",
(frame_addr > stack_addr && frame_addr < stack_last));
}
static int set_handler(int sig, int sig_to_mask, int mask_flags)
{
struct sigaction sa, oldaction;
(void) sig_to_mask;
sa.sa_handler = (void *)handler;
sa.sa_flags = mask_flags;
sigemptyset(&sa.sa_mask);
sigaddset(&sa.sa_mask, sig);
ltp_rt_sigaction(sig, &sa, &oldaction, SIGSETSIZE);
return 0;
}
int main(int ac, char **av)
{
const char *msg;
msg = parse_opts(ac, av, NULL, NULL);
if (msg != NULL)
tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
stack_t stack = {
.ss_sp = (void *)my_stack,
.ss_flags = 0,
.ss_size = sizeof(my_stack)
};
sigaltstack(&stack, NULL);
set_handler(SIGRTMIN, 0, SA_ONSTACK);
kill(getpid(), SIGRTMIN);
tst_exit();
}
[-- Attachment #3: Type: text/plain, Size: 441 bytes --]
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
[-- Attachment #4: Type: text/plain, Size: 155 bytes --]
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [LTP] [RFC PATCH 1/3] ARM64: ILP32: modify struct kernel_sigaction
2015-03-19 11:33 ` [LTP] [RFC PATCH 1/3] ARM64: ILP32: modify struct kernel_sigaction Jan Stancek
2015-03-19 12:40 ` Jan Stancek
@ 2015-03-19 15:18 ` Bamvor Zhang
1 sibling, 0 replies; 6+ messages in thread
From: Bamvor Zhang @ 2015-03-19 15:18 UTC (permalink / raw)
To: Jan Stancek; +Cc: ltp-list, bintian wang, Dingtianhong, apinski, yangyingliang
[-- Attachment #1.1: Type: text/plain, Size: 4493 bytes --]
2015年3月19日 19:34于 "Jan Stancek" <jstancek@redhat.com>写道:
>
>
>
>
>
> ----- Original Message -----
> > From: "Zhang Jian(Bamvor)" <bamvor.zhangjian@huawei.com>
> > To: ltp-list@lists.sourceforge.net
> > Cc: "bintian wang" <bintian.wang@huawei.com>, yangyingliang@huawei.com,
apinski@cavium.com, dingtianhong@huawei.com
> > Sent: Thursday, 19 March, 2015 6:16:36 AM
> > Subject: [LTP] [RFC PATCH 1/3] ARM64: ILP32: modify struct
kernel_sigaction
> >
> > From: Yang Yingliang <yangyingliang@huawei.com>
> >
> > In ILP32, the sigaction struct is the same as AARCH64.
> > To allow for this to work, we use a long long fields and
> > then add extra casts when converting between the user
> > exposed struct and the kernel exposed struct.
> > The modify is came from a patch of glibc,
> > the commit is 9266f4b060f6("Add kernel_sigaction.h for AARCH64 ILP32").
> >
> > Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> > ---
> > include/lapi/rt_sigaction.h | 12 ++++++------
> > 1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/include/lapi/rt_sigaction.h b/include/lapi/rt_sigaction.h
> > index 46f6a50..2b1365a 100644
> > --- a/include/lapi/rt_sigaction.h
> > +++ b/include/lapi/rt_sigaction.h
> > @@ -34,9 +34,9 @@
> > #define INVAL_SA_PTR ((void *)-1)
> >
> > struct kernel_sigaction {
> > - __sighandler_t k_sa_handler;
> > - unsigned long sa_flags;
> > - void (*sa_restorer) (void);
> > + unsigned long long k_sa_handler;
> > + unsigned long long sa_flags;
> > + unsigned long long sa_restorer;
>
> Isn't this going to break i386? (long is 4, long long is 8).
It might be. We just test on the aarch64 platform in different abi(ilp32
and lp64). Sorry for this. I will work on it tomorrow.
regards
bamvor
>
> Regards,
> Jan
>
> > sigset_t sa_mask;
> > };
> >
> > @@ -159,7 +159,7 @@ static int ltp_rt_sigaction(int signum, const struct
> > sigaction *act,
> > if (act == INVAL_SA_PTR) {
> > kact_p = INVAL_SA_PTR;
> > } else if (act) {
> > - kact.k_sa_handler = act->sa_handler;
> > + kact.k_sa_handler = (unsigned long
long)(uintptr_t)act->sa_handler;
> > memcpy(&kact.sa_mask, &act->sa_mask, sizeof(sigset_t));
> > kact.sa_flags = act->sa_flags;
> > kact.sa_restorer = NULL;
> > @@ -203,12 +203,12 @@ static int ltp_rt_sigaction(int signum, const
struct
> > sigaction *act,
> >
> > if (ret >= 0) {
> > if (oact && (oact != INVAL_SA_PTR)) {
> > - oact->sa_handler = koact.k_sa_handler;
> > + oact->sa_handler =
(void*)(uintptr_t)koact.k_sa_handler;
> > memcpy(&oact->sa_mask, &koact.sa_mask,
> > sizeof(sigset_t));
> > oact->sa_flags = koact.sa_flags;
> > #ifdef HAVE_SA_RESTORER
> > - oact->sa_restorer = koact.sa_restorer;
> > + oact->sa_restorer =
(void*)(uintptr_t)koact.sa_restorer;
> > #endif
> > }
> > }
> > --
> > 1.8.4.5
> >
> >
> >
------------------------------------------------------------------------------
> > Dive into the World of Parallel Programming The Go Parallel Website,
> > sponsored
> > by Intel and developed in partnership with Slashdot Media, is your hub
for
> > all
> > things parallel software development, from weekly thought leadership
blogs to
> > news, videos, case studies, tutorials and more. Take a look and join the
> > conversation now. http://goparallel.sourceforge.net/
> > _______________________________________________
> > Ltp-list mailing list
> > Ltp-list@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/ltp-list
> >
>
>
------------------------------------------------------------------------------
> Dive into the World of Parallel Programming The Go Parallel Website,
sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub
for all
> things parallel software development, from weekly thought leadership
blogs to
> news, videos, case studies, tutorials and more. Take a look and join the
> conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list
[-- Attachment #1.2: Type: text/html, Size: 6573 bytes --]
[-- Attachment #2: Type: text/plain, Size: 441 bytes --]
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
[-- Attachment #3: Type: text/plain, Size: 155 bytes --]
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-03-19 15:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1426742198-17967-1-git-send-email-bamvor.zhangjian@huawei.com>
[not found] ` <1426742198-17967-2-git-send-email-bamvor.zhangjian@huawei.com>
2015-03-19 11:33 ` [LTP] [RFC PATCH 1/3] ARM64: ILP32: modify struct kernel_sigaction Jan Stancek
2015-03-19 12:40 ` Jan Stancek
2015-03-19 15:18 ` Bamvor Zhang
[not found] ` <1426742198-17967-3-git-send-email-bamvor.zhangjian@huawei.com>
2015-03-19 11:49 ` [LTP] [RFC PATCH 2/3] ARM64: ILP32: cast for negtive off_t Cyril Hrubis
[not found] ` <18FC2E80-AF7B-408C-8863-B4FC532B5CD4@caviumnetworks.com>
2015-03-19 12:00 ` Cyril Hrubis
[not found] ` <1426742198-17967-4-git-send-email-bamvor.zhangjian@huawei.com>
2015-03-19 12:01 ` [LTP] [RFC PATCH 3/3] ARM64: ILP32: define LTP_USE_64_ABI for ILP32 Cyril Hrubis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox