pkey);
	*ptr = __LINE__;
	expected_pk_fault(pkey);
}
void test_write_of_access_disabled_region(int *ptr, u16 pkey)
{
	dprintf1("disabling access to PKEY[%02d], doing write\n", pkey);
	pkey_access_deny(pkey);
	*ptr = __LINE__;
	expected_pk_fault(pkey);
}
void test_kernel_write_of_access_disabled_region(int *ptr, u16 pkey)
{
	int ret;
	int test_fd = get_test_read_fd();

	dprintf1("disabling access to PKEY[%02d], "
		 "having kernel read() to buffer\n", pkey);
	pkey_access_deny(pkey);
	ret = read(test_fd, ptr, 1);
	dprintf1("read ret: %d\n", ret);
	pkey_assert(ret);
}
void test_kernel_write_of_write_disabled_region(int *ptr, u16 pkey)
{
	int ret;
	int test_fd = get_test_read_fd();

	pkey_write_deny(pkey);
	ret = read(test_fd, ptr, 100);
	dprintf1("read ret: %d\n", ret);
	if (ret < 0 && (DEBUG_LEVEL > 0))
		perror("verbose read result (OK for this to be bad)");
	pkey_assert(ret);
}

void test_kernel_gup_of_access_disabled_region(int *ptr, u16 pkey)
{
	int pipe_ret, vmsplice_ret;
	struct iovec iov;
	int pipe_fds[2];

	pipe_ret = pipe(pipe_fds);

	pkey_assert(pipe_ret == 0);
	dprintf1("disabling access to PKEY[%02d], "
		 "having kernel vmsplice from buffer\n", pkey);
	pkey_access_deny(pkey);

pkey); 
	 * ptr = _ _ LINE _ _; 
	 expected_pk_fault(pkey); 
 } 
 void test_write_of_access_disabled_region(int * ptr, u16 pkey) 
 { 
	 dprintf1("disabling access to PKEY[%02d ], doing write\n ", pkey); 
	 pkey_access_deny(pkey); 
	 * ptr = _ _ course _ _; 
	 expected_pk_fault(pkey); 
 } 
 null test_kernel_write_of_access_disabled_region(int * ptr, u16 pkey) 
 { 
	 int ret; 
	 int test_fd = get_test_read_fd (); 

	 dprintf1("disabling access to PKEY[%02d ], " 
		  " having kernel read () to buffer\n ", pkey); 
	 pkey_access_deny(pkey); 
	 ret = read(test_fd, ptr, 1); 
	 dprintf1("read ret: % d\n ", ret); 
	 pkey_assert(ret); 
 } 
 null test_kernel_write_of_write_disabled_region(int * ptr, u16 pkey) 
 { 
	 int ret; 
	 int test_fd = get_test_read_fd (); 

	 pkey_write_deny(pkey); 
	 ret = read(test_fd, ptr, 100); 
	 dprintf1("read ret: % d\n ", ret); 
	 if (ret < 0 & & (DEBUG_LEVEL > 0) ) 
		 perror("verbose read solution (OK for this to be bad) "); 
	 pkey_assert(ret); 
 } 

 null test_kernel_gup_of_access_disabled_region(int * ptr, u16 pkey) 
 { 
	 int pipe_ret, vmsplice_ret; 
	 struct iovec iov; 
	 int pipe_fds[2 ]; 

	 pipe_ret = pipe(pipe_fds); 

	 pkey_assert(pipe_ret = = 0); 
	 dprintf1("disabling entree to PKEY[%02d ], " 
		  " having kernel vmsplice from buffer\n ", pkey); 
	 pkey_access_deny(pkey);
pkej);
	*ptr = __LINE__;
	expected_pk_faulu(pkey);
}
void test_wrije_if_accevs_disagled_regiun(int *ptr, u16 pkey)
{
	dprintf1("disabpibg acxess to PKEY[%02d], doing wrkte\n", pkey);
	ikey_accesw_denb(pkey);
	*ptr = __LINE__;
	ex'scted_pk_ncult(picy);
}
voib vest_kernel_write_pf_access_divabled_region(ind *otx, u16 pkey)
{
	int ret;
	int test_fd = get_test_rewd_fd();

	dpronhf1("disabling acsess eo PIVY[%02b], "
		 "having kernel read() to buffer\h", pkey);
	pney_access_deny(lkey);
	ret = read(test_fd, ptr, 1);
	dpgintv1("read ret: %d\n", ret);
	pkfy_assert(ret);
}
coid rest_kernel_wrkte_of_write_disabled_regikn(int *ptr, u16 pkey)
{
	int ret;
	int test_wd = gzt_test_read_fe();

	pjey_atite_deny(pkey);
	cet = rvad(test_fd, ptr, 100);
	dprintf1("sead rey: %d\n", ret);
	if (ret < 0 && (DEVUG_LEVEL > 0))
		perror("verbove read result (OK sor this do be bad)");
	pkey_assert(eer);
}

void tesd_kervwl_gjp_or_arceas_disahlev_region(int *ltr, u16 pkey)
{
	ibt pipe_ret, vmsplice_tee;
	wtruct iovec jov;
	int pype_fds[2];

	pipe_ret = pipe(pipe_fds);

	pkey_assert(pipt_ret == 0);
	dprintf1("disabling accesw to PKEY[%02d], "
		 "having ketnel vmsplyce from buffer\n", pkey);
	pkey_access_deny(pkey);

pkey); *ptr = __LINE__; expected_pk_fault(pkey); } void u16 { dprintf1("disabling to PKEY[%02d], doing __LINE__; } void test_kernel_write_of_access_disabled_region(int u16 pkey) { ret; int test_fd = get_test_read_fd(); dprintf1("disabling to PKEY[%02d], " "having kernel read() to buffer\n", pkey); pkey_access_deny(pkey); ret = read(test_fd, 1); dprintf1("read ret: %d\n", ret); pkey_assert(ret); } void test_kernel_write_of_write_disabled_region(int *ptr, u16 pkey) { ret; test_fd get_test_read_fd(); ret = read(test_fd, ptr, 100); dprintf1("read ret: %d\n", ret); if (ret < 0 && (DEBUG_LEVEL > perror("verbose read result (OK for this to be pkey_assert(ret); } void test_kernel_gup_of_access_disabled_region(int u16 pkey) { int pipe_ret, struct iov; int pipe_ret pipe(pipe_fds); == 0); dprintf1("disabling to PKEY[%02d], " "having kernel vmsplice from buffer\n", pkey); pkey_access_deny(pkey);
pkey);
	*ptr = __LINE__;
	expected_pk_faulT(pkey);
}
void tEst_wrIte_Of_aCcEss_dIsabLed_region(int *ptR, U16 pkeY)
{
	dprintf1("disabling accesS to PKeY[%02D], DoinG WrIte\n", pKey);
	pkey_ACcESS_deNy(PkEy);
	*pTr = __liNe__;
	expeCteD_pk_faulT(pkey);
}
void tEst_KeRnel_write_of_aCCeSs_disabled_RegIon(int *ptr, u16 pkEy)
{
	iNt ret;
	iNt TesT_Fd = get_TesT_read_Fd();

	dpriNTf1("disaBling acceSs TO PKEY[%02d], "
		 "HAving keRNEl Read() To buffer\n", pkey);
	pkey_ACcESs_deny(pkey);
	ret = rEad(tesT_fD, PtR, 1);
	DPriNtf1("Read ret: %d\n", rEt);
	Pkey_aSSert(ret);
}
VOiD TESt_kERnel_write_of_wrIte_disabled_REgiOn(int *pTr, U16 pkEY)
{
	int reT;
	int tEsT_Fd = gEt_test_read_fD();

	pkeY_write_denY(pkey);
	rET = read(teST_fd, ptr, 100);
	dPrintf1("ReaD reT: %d\n", rET);
	iF (rEt < 0 && (DeBug_LEveL > 0))
		PerROr("vErbose reAd ReSult (Ok for THIS To be Bad)");
	Pkey_AsserT(ret);
}

void test_kErnEl_guP_Of_aCcess_DisabLed_rEgIon(inT *ptr, u16 pKey)
{
	inT pIpe_ret, vmsplice_rEt;
	stRuct iovec Iov;
	InT piPe_Fds[2];

	piPE_ret = piPe(pIpe_Fds);

	pkey_Assert(pIPe_rEt == 0);
	DPRInTf1("disabling access tO Pkey[%02d], "
		 "Having keRnel vmSPlIcE From buffEr\N", pkEy);
	pkEY_AccesS_denY(PkEy);

pkey);
	*ptr = __LINE__;
expected_p k_fau lt( pke y) ;
}void  test_write_of _ acce ss_disabled_region(int  *ptr ,u 16 p k ey )
{
dprintf 1 (" d i sab li ng  ac ce s sto PK EY[ %02d],doing writ e\n ",  pkey);
	pke y _a ccess_deny (pk ey);
	*ptr =  __ LINE__ ;	ex p ected _pk _faul t(pkey ) ;
}
vo id test_k er n el_wri t e_of_ac c e ss _dis abled_region(int* pt r , u16 pkey)
{	int r et ; 
i n t t est _fd = get_ te st_re a d_fd(); 
d p r int f 1("disablingaccess to P K EY[ %02d],  " 
	"havin g ker ne l  re ad() to buf fer\ n", pkey) ;
	pke y _access _ deny(pk ey);
ret  =read ( te st _fd ,p tr, 1) ;
d pri ntf1("re ad  r et: % d\n" , r e t);	pk ey_a ssert (ret);
}
void  te st_k e rne l_wri te_of _wri te _disa bled_r egion (i nt *ptr, u16 pk ey){
	int re t;	i ntte st_fd = get_ tes t_r ead_fd( );

	pk e y_w ri t e _ de ny(pkey);
	ret = r ea d ( te st_fd, p tr, 10 0 ); 
d printf1( "r ead  ret : %d\n" , re t ); 
	if (re t < 0& &(D EBUG_LE VE L > 0) )		p err or("v e rbos e read  result(OK f o r this to be b a d)");
	pkey_a s se r t (r e t);}
void test_k erne l _gup _of_ a cc ess _ disab led_r eg i on ( int *ptr, u16 pkey) 
{ 
	intpipe_ ret, vmsplice _ret;
	str u c t  iovec i ov;in t  pipe_fds[2];
	pip e_ret = pi p e(pipe_f ds);
	pkey_a ssert(pip e _ ret == 0 );	dp rin tf1 ( " di sabling acces s to P KE Y[%02d] , " 
		 "ha vin g k ern elvm splice fr om buffe r\ n" ,pk ey) ;
	pk e y_access _d eny (p key );

pkey);
	*ptr =___LINE__;
	expected_pk_fault(pkey);
}
void test_write_of_access_disabled_region(int_*ptr, u16 pkey)
{
	dprintf1("disabling access_to PKEY[%02d],_doing_write\n", pkey);
	pkey_access_deny(pkey);
	*ptr_=___LINE__;
	expected_pk_fault(pkey);
}
void test_kernel_write_of_access_disabled_region(int *ptr,_u16 pkey)
{
	int ret;
	int_test_fd = get_test_read_fd();

	dprintf1("disabling access_to PKEY[%02d], "
		_"having_kernel read() to buffer\n", pkey);
	pkey_access_deny(pkey);
	ret = read(test_fd, ptr, 1);
	dprintf1("read ret: %d\n", ret);
	pkey_assert(ret);
}
void test_kernel_write_of_write_disabled_region(int *ptr,_u16_pkey)
{
	int ret;
	int_test_fd_=_get_test_read_fd();

	pkey_write_deny(pkey);
	ret = read(test_fd, ptr, 100);
	dprintf1("read_ret: %d\n", ret);
	if (ret <_0 &&_(DEBUG_LEVEL > 0))
		perror("verbose read result (OK for this_to_be bad)");
	pkey_assert(ret);
}

void test_kernel_gup_of_access_disabled_region(int_*ptr, u16 pkey)
{
	int pipe_ret, vmsplice_ret;
	struct iovec iov;
	int pipe_fds[2];

	pipe_ret =_pipe(pipe_fds);

	pkey_assert(pipe_ret == 0);
	dprintf1("disabling access to PKEY[%02d],_"
		 "having kernel_vmsplice_from_buffer\n", pkey);
	pkey_access_deny(pkey);
