11//@only-target-linux
22
3- #![ feature( exposed_provenance ) ] // Needed for fn test_pointer()
3+ #![ feature( strict_provenance ) ]
44use std:: convert:: TryInto ;
5- use std:: mem:: MaybeUninit ;
65
76fn main ( ) {
87 test_epoll_socketpair ( ) ;
@@ -17,7 +16,6 @@ fn main() {
1716 test_no_notification_for_unregister_flag ( ) ;
1817 test_epoll_ctl_mod ( ) ;
1918 test_epoll_ctl_del ( ) ;
20- test_pointer ( ) ;
2119 test_two_same_fd_in_same_epoll_instance ( ) ;
2220 test_epoll_wait_maxevent_zero ( ) ;
2321 test_socketpair_epollerr ( ) ;
@@ -261,24 +259,6 @@ fn test_epoll_eventfd() {
261259 check_epoll_wait :: < 8 > ( epfd, & [ ( expected_event, expected_value) ] ) ;
262260}
263261
264- fn test_pointer ( ) {
265- // Create an epoll instance.
266- let epfd = unsafe { libc:: epoll_create1 ( 0 ) } ;
267- assert_ne ! ( epfd, -1 ) ;
268-
269- // Create a socketpair instance.
270- let mut fds = [ -1 , -1 ] ;
271- let res = unsafe { libc:: socketpair ( libc:: AF_UNIX , libc:: SOCK_STREAM , 0 , fds. as_mut_ptr ( ) ) } ;
272- assert_eq ! ( res, 0 ) ;
273-
274- // Register fd[1] with EPOLLIN|EPOLLOUT|EPOLLET
275- let data = MaybeUninit :: < u64 > :: uninit ( ) . as_ptr ( ) ;
276- let mut ev =
277- libc:: epoll_event { events : EPOLL_IN_OUT_ET , u64 : data. expose_provenance ( ) as u64 } ;
278- let res = unsafe { libc:: epoll_ctl ( epfd, libc:: EPOLL_CTL_ADD , fds[ 1 ] , & mut ev) } ;
279- assert_eq ! ( res, 0 ) ;
280- }
281-
282262// When read/write happened on one side of the socketpair, only the other side will be notified.
283263fn test_epoll_socketpair_both_sides ( ) {
284264 // Create an epoll instance.
@@ -543,9 +523,9 @@ fn test_epoll_wait_maxevent_zero() {
543523 // Create an epoll instance.
544524 let epfd = unsafe { libc:: epoll_create1 ( 0 ) } ;
545525 assert_ne ! ( epfd, -1 ) ;
546- // It is ok to use uninitialised pointer here because it will error out before the
547- // pointer actually get accessed.
548- let array_ptr = MaybeUninit :: < libc:: epoll_event > :: uninit ( ) . as_mut_ptr ( ) ;
526+ // It is ok to use a dangling pointer here because it will error out before the
527+ // pointer actually gets accessed.
528+ let array_ptr = std :: ptr :: without_provenance_mut :: < libc:: epoll_event > ( 0x100 ) ;
549529 let res = unsafe { libc:: epoll_wait ( epfd, array_ptr, 0 , 0 ) } ;
550530 let e = std:: io:: Error :: last_os_error ( ) ;
551531 assert_eq ! ( e. raw_os_error( ) , Some ( libc:: EINVAL ) ) ;
0 commit comments