Skip to content

Commit f3de272

Browse files
Roland McGrathtorvalds
authored andcommitted
signals: use HAVE_SET_RESTORE_SIGMASK
Change all the #ifdef TIF_RESTORE_SIGMASK conditionals in non-arch code to #ifdef HAVE_SET_RESTORE_SIGMASK. If arch code defines it first, the generic set_restore_sigmask() using TIF_RESTORE_SIGMASK is not defined. Signed-off-by: Roland McGrath <roland@redhat.com> Cc: Oleg Nesterov <oleg@tv-sign.ru> Cc: Ingo Molnar <mingo@elte.hu> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: "Luck, Tony" <tony.luck@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 49eaeb4 commit f3de272

File tree

5 files changed

+19
-13
lines changed

5 files changed

+19
-13
lines changed

fs/compat.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1634,7 +1634,7 @@ asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp,
16341634
return ret;
16351635
}
16361636

1637-
#ifdef TIF_RESTORE_SIGMASK
1637+
#ifdef HAVE_SET_RESTORE_SIGMASK
16381638
asmlinkage long compat_sys_pselect7(int n, compat_ulong_t __user *inp,
16391639
compat_ulong_t __user *outp, compat_ulong_t __user *exp,
16401640
struct compat_timespec __user *tsp, compat_sigset_t __user *sigmask,
@@ -1825,7 +1825,7 @@ asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds,
18251825

18261826
return ret;
18271827
}
1828-
#endif /* TIF_RESTORE_SIGMASK */
1828+
#endif /* HAVE_SET_RESTORE_SIGMASK */
18291829

18301830
#if defined(CONFIG_NFSD) || defined(CONFIG_NFSD_MODULE)
18311831
/* Stuff for NFS server syscalls... */
@@ -2080,7 +2080,7 @@ long asmlinkage compat_sys_nfsservctl(int cmd, void *notused, void *notused2)
20802080

20812081
#ifdef CONFIG_EPOLL
20822082

2083-
#ifdef TIF_RESTORE_SIGMASK
2083+
#ifdef HAVE_SET_RESTORE_SIGMASK
20842084
asmlinkage long compat_sys_epoll_pwait(int epfd,
20852085
struct compat_epoll_event __user *events,
20862086
int maxevents, int timeout,
@@ -2124,7 +2124,7 @@ asmlinkage long compat_sys_epoll_pwait(int epfd,
21242124

21252125
return err;
21262126
}
2127-
#endif /* TIF_RESTORE_SIGMASK */
2127+
#endif /* HAVE_SET_RESTORE_SIGMASK */
21282128

21292129
#endif /* CONFIG_EPOLL */
21302130

fs/eventpoll.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,7 +1241,7 @@ asmlinkage long sys_epoll_wait(int epfd, struct epoll_event __user *events,
12411241
return error;
12421242
}
12431243

1244-
#ifdef TIF_RESTORE_SIGMASK
1244+
#ifdef HAVE_SET_RESTORE_SIGMASK
12451245

12461246
/*
12471247
* Implement the event wait interface for the eventpoll file. It is the kernel
@@ -1287,7 +1287,7 @@ asmlinkage long sys_epoll_pwait(int epfd, struct epoll_event __user *events,
12871287
return error;
12881288
}
12891289

1290-
#endif /* #ifdef TIF_RESTORE_SIGMASK */
1290+
#endif /* HAVE_SET_RESTORE_SIGMASK */
12911291

12921292
static int __init eventpoll_init(void)
12931293
{

fs/select.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ asmlinkage long sys_select(int n, fd_set __user *inp, fd_set __user *outp,
425425
return ret;
426426
}
427427

428-
#ifdef TIF_RESTORE_SIGMASK
428+
#ifdef HAVE_SET_RESTORE_SIGMASK
429429
asmlinkage long sys_pselect7(int n, fd_set __user *inp, fd_set __user *outp,
430430
fd_set __user *exp, struct timespec __user *tsp,
431431
const sigset_t __user *sigmask, size_t sigsetsize)
@@ -528,7 +528,7 @@ asmlinkage long sys_pselect6(int n, fd_set __user *inp, fd_set __user *outp,
528528

529529
return sys_pselect7(n, inp, outp, exp, tsp, up, sigsetsize);
530530
}
531-
#endif /* TIF_RESTORE_SIGMASK */
531+
#endif /* HAVE_SET_RESTORE_SIGMASK */
532532

533533
struct poll_list {
534534
struct poll_list *next;
@@ -759,7 +759,7 @@ asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds,
759759
return ret;
760760
}
761761

762-
#ifdef TIF_RESTORE_SIGMASK
762+
#ifdef HAVE_SET_RESTORE_SIGMASK
763763
asmlinkage long sys_ppoll(struct pollfd __user *ufds, unsigned int nfds,
764764
struct timespec __user *tsp, const sigset_t __user *sigmask,
765765
size_t sigsetsize)
@@ -839,4 +839,4 @@ asmlinkage long sys_ppoll(struct pollfd __user *ufds, unsigned int nfds,
839839

840840
return ret;
841841
}
842-
#endif /* TIF_RESTORE_SIGMASK */
842+
#endif /* HAVE_SET_RESTORE_SIGMASK */

include/linux/sched.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1175,7 +1175,7 @@ struct task_struct {
11751175
struct sighand_struct *sighand;
11761176

11771177
sigset_t blocked, real_blocked;
1178-
sigset_t saved_sigmask; /* To be restored with TIF_RESTORE_SIGMASK */
1178+
sigset_t saved_sigmask; /* restored if set_restore_sigmask() was used */
11791179
struct sigpending pending;
11801180

11811181
unsigned long sas_ss_sp;

include/linux/thread_info.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,13 @@ static inline int test_ti_thread_flag(struct thread_info *ti, int flag)
9292
#define set_need_resched() set_thread_flag(TIF_NEED_RESCHED)
9393
#define clear_need_resched() clear_thread_flag(TIF_NEED_RESCHED)
9494

95-
#ifdef TIF_RESTORE_SIGMASK
95+
#if defined TIF_RESTORE_SIGMASK && !defined HAVE_SET_RESTORE_SIGMASK
96+
/*
97+
* An arch can define its own version of set_restore_sigmask() to get the
98+
* job done however works, with or without TIF_RESTORE_SIGMASK.
99+
*/
100+
#define HAVE_SET_RESTORE_SIGMASK 1
101+
96102
/**
97103
* set_restore_sigmask() - make sure saved_sigmask processing gets done
98104
*
@@ -109,7 +115,7 @@ static inline void set_restore_sigmask(void)
109115
set_thread_flag(TIF_RESTORE_SIGMASK);
110116
set_thread_flag(TIF_SIGPENDING);
111117
}
112-
#endif /* TIF_RESTORE_SIGMASK */
118+
#endif /* TIF_RESTORE_SIGMASK && !HAVE_SET_RESTORE_SIGMASK */
113119

114120
#endif /* __KERNEL__ */
115121

0 commit comments

Comments
 (0)