aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-powerpc/auxvec.h
blob: 19a099b62cd6aae4100129e52bfa1679e0bba9e8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#ifndef _ASM_POWERPC_AUXVEC_H
#define _ASM_POWERPC_AUXVEC_H

/*
 * We need to put in some extra aux table entries to tell glibc what
 * the cache block size is, so it can use the dcbz instruction safely.
 */
#define AT_DCACHEBSIZE		19
#define AT_ICACHEBSIZE		20
#define AT_UCACHEBSIZE		21
/* A special ignored type value for PPC, for glibc compatibility.  */
#define AT_IGNOREPPC		22

/* The vDSO location. We have to use the same value as x86 for glibc's
 * sake :-)
 */
#define AT_SYSINFO_EHDR		33

#endif
]: Basic network namespace infrastructure.' href='/cgit/cgit.cgi/litmus-rt-ext-res.git/commit/net/core/net_namespace.c?id=5f256becd868bf63b70da8f2769033d6734670e9'>5f256becd868
734b65417b24


ff4b950277b6
5f256becd868
dec827d174d7

073862ba5d24













05fceb4ad7e8






1c87733d0682


05fceb4ad7e8


073862ba5d24
05fceb4ad7e8













05fceb4ad7e8


04d4dfed8e64
05fceb4ad7e8




f875bae06533

b922934d017f


f875bae06533
b922934d017f
f875bae06533
b922934d017f
f875bae06533

b922934d017f

f875bae06533
b922934d017f
f875bae06533
b922934d017f








f875bae06533









72ad937abd0a







72ad937abd0a













5f256becd868


038e7332b8d4
5f256becd868

f875bae06533
486a87f1e562
72ad937abd0a
5f256becd868
5f256becd868
a685e08987d1
4e985adaa504
038e7332b8d4
486a87f1e562
5d1e4468a770
5f256becd868
5d1e4468a770
5f256becd868
768f3591e2b1
f875bae06533


5f256becd868


768f3591e2b1
5f256becd868



72ad937abd0a
f875bae06533
72ad937abd0a


f875bae06533

72ad937abd0a
310928d9633b

5f256becd868


6a1a3b9f686b
ebe47d47b7b7



486a87f1e562
45a19b0a725a
486a87f1e562







45a19b0a725a
486a87f1e562
45a19b0a725a
486a87f1e562










5d1e4468a770
45a19b0a725a
e005d193d55e

45a19b0a725a

5d1e4468a770
4ef079ccc1d9
45a19b0a725a


a685e08987d1






038e7332b8d4

9dd776b6d7b0
088eb2d905de

9dd776b6d7b0
911cb193f3eb


088eb2d905de


038e7332b8d4


9dd776b6d7b0
038e7332b8d4
088eb2d905de
486a87f1e562
11a28d373ed2
486a87f1e562

9dd776b6d7b0
088eb2d905de
038e7332b8d4
a685e08987d1
088eb2d905de



486a87f1e562
2b035b399707


6a1a3b9f686b

f875bae06533
2b035b399707
1818ce4dc59a
72ad937abd0a
6a1a3b9f686b
2b035b399707



6a1a3b9f686b




72ad937abd0a
2b035b399707
72ad937abd0a

6a1a3b9f686b

11a28d373ed2






6a1a3b9f686b
72ad937abd0a


f875bae06533
72ad937abd0a

6a1a3b9f686b








72ad937abd0a

038e7332b8d4
a685e08987d1
2b035b399707
6a1a3b9f686b
2b035b399707
6a1a3b9f686b



2b035b399707






6a1a3b9f686b


956c92078669

0bb80f240520
956c92078669


956c92078669
c316e6a3084c

956c92078669
0bb80f240520
c316e6a3084c



956c92078669
c316e6a3084c
956c92078669


6a1a3b9f686b
956c92078669



6a1a3b9f686b

30ffee8480c1










728dba3a39c6

30ffee8480c1

728dba3a39c6
30ffee8480c1





98f842e675f9














5f256becd868

486a87f1e562
5f256becd868
d57a9212e007
5f256becd868


3ef1355dcb85




d57a9212e007
3ef1355dcb85
486a87f1e562





5f256becd868
038e7332b8d4
ca0f31125c5c
5f256becd868
f4618d39a34d
11a28d373ed2
f4618d39a34d
5f256becd868

5f256becd868
98f842e675f9

5f256becd868




ed160e839d2e
f875bae06533

5f256becd868
72ad937abd0a
5f256becd868
72ad937abd0a
5f256becd868
5f256becd868
f875bae06533
1dba323b3f92
f875bae06533
5f256becd868

72ad937abd0a
5f256becd868

1dba323b3f92
5f256becd868



72ad937abd0a

1dba323b3f92
5f256becd868

f875bae06533
5f256becd868

72ad937abd0a
5f256becd868

72ad937abd0a



5f256becd868

ed160e839d2e

f875bae06533

ed160e839d2e
b922934d017f
ed160e839d2e

f875bae06533
ed160e839d2e
72ad937abd0a



ed160e839d2e
f875bae06533

ed160e839d2e
c93cf61fd1d5

f875bae06533














073862ba5d24
f875bae06533

3a765edadb28




f875bae06533







3a765edadb28
f875bae06533



5f256becd868

































53379e57a770
5f256becd868


b3c981d2bbbe
5f256becd868

b3c981d2bbbe
5f256becd868







































53379e57a770
5f256becd868











13b6f57623bc



f063052947f7


728dba3a39c6

f063052947f7

728dba3a39c6
f063052947f7
13b6f57623bc









142e1d1d5f08

5e4a08476b50
c7b96acf1456
142e1d1d5f08

13b6f57623bc
142e1d1d5f08
13b6f57623bc


98f842e675f9





13b6f57623bc





98f842e675f9
13b6f57623bc

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678

                                           





                            
                        
                      
                          
                          

                          
                       
                         
                                 
                              
                              






                                                          
                        
 
                              
                                      
 


                                                                
                        
 

                                                                   













                                                                              






                                                                  


                                                                        


                              
                                 













                                                                 


                                                                    
                               




                               

                                                                         


                          
                                   
                                                      
                          
                                 

                                                              

                                     
         
                
                      








                                     









                                                                          







                                                                  













                                                                  


                                                                    
                                                                                

                                                
                                                        
                      
                                 
 
                                   
                                     
                              
                               
 
                         
                                       
      
 
                                                      


                                           


                     
 



                                                                     
                                                  
                        


                                                                     

                                                                     
                                                   

                      


                 
 



                                         
                                  
 







                                                        
                 
                              
 










                                         
                         
                                                          

                                                                   

                       
      
                        


                                         






                                                    

                                                                            
 

                        
 


                                        


                                        


                             
                               
                                     
                      
                            
                                                                   

                              
                                 
                     
                                     
                                 



                                   
 


                                                                           

                                                 
                                            
                              
                                       
                                 
 



                                                                   




                                            
                                                                
                                         

                                                               

                      






                                                                    
                                                           


                                                            
                                            

                                                            








                                                                       

                                                                       
                                          
                                 
         
 
                                                   



                                                              






                                                          


                             

                                    
                           


                          
                                

                                      
 
                                           



                                            
 
                   


                   
     



                                    

      










                                          

                                       

                                                       
                                 





                                     














                                                             

                                   
                               
 
                    


                                                                           




                                                          
      
 





                                                          
                               
                                                
                                                                       
 
                    
                                                               
                      

                                 
 

                                            




                           
                    

                                                                      
 
                        
                  
                                 
 
                                        
                                                  
                                   
                                                   

                                              
                                                                       

                 
                 



                                                                     

                                           
                     

 
                                                                         

                        
                                 

                             



                                                               

 

     

                                                                      
 
                                        

 
                                                                         
 



                                                      
 

                          
 

                                   














                                                                          
                                                                           

                                                        




                                                               







                                                                       
                      



                                                       

































                                                                           
                                                                  


                                                             
                                                            

                               
                                          







































                                                                           
                                                                  











                                                             



                                                


                                

                                

                                               
                          
 









                                                           

                             
                                                       
                                                          

                              
                                 
                                       


                 





                                        





                                                    
                                     

      
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/workqueue.h>
#include <linux/rtnetlink.h>
#include <linux/cache.h>
#include <linux/slab.h>
#include <linux/list.h>
#include <linux/delay.h>
#include <linux/sched.h>
#include <linux/idr.h>
#include <linux/rculist.h>
#include <linux/nsproxy.h>
#include <linux/fs.h>
#include <linux/proc_ns.h>
#include <linux/file.h>
#include <linux/export.h>
#include <linux/user_namespace.h>
#include <net/net_namespace.h>
#include <net/netns/generic.h>

/*
 *	Our network namespace constructor/destructor lists
 */

static LIST_HEAD(pernet_list);
static struct list_head *first_device = &pernet_list;
DEFINE_MUTEX(net_mutex);

LIST_HEAD(net_namespace_list);
EXPORT_SYMBOL_GPL(net_namespace_list);

struct net init_net = {
	.dev_base_head = LIST_HEAD_INIT(init_net.dev_base_head),
};
EXPORT_SYMBOL(init_net);

#define INITIAL_NET_GEN_PTRS	13 /* +1 for len +2 for rcu_head */

static unsigned int max_gen_ptrs = INITIAL_NET_GEN_PTRS;

static struct net_generic *net_alloc_generic(void)
{
	struct net_generic *ng;
	size_t generic_size = offsetof(struct net_generic, ptr[max_gen_ptrs]);

	ng = kzalloc(generic_size, GFP_KERNEL);
	if (ng)
		ng->len = max_gen_ptrs;

	return ng;
}

static int net_assign_generic(struct net *net, int id, void *data)
{
	struct net_generic *ng, *old_ng;

	BUG_ON(!mutex_is_locked(&net_mutex));
	BUG_ON(id == 0);

	old_ng = rcu_dereference_protected(net->gen,
					   lockdep_is_held(&net_mutex));
	ng = old_ng;
	if (old_ng->len >= id)
		goto assign;

	ng = net_alloc_generic();
	if (ng == NULL)
		return -ENOMEM;

	/*
	 * Some synchronisation notes:
	 *
	 * The net_generic explores the net->gen array inside rcu
	 * read section. Besides once set the net->gen->ptr[x]
	 * pointer never changes (see rules in netns/generic.h).
	 *
	 * That said, we simply duplicate this array and schedule
	 * the old copy for kfree after a grace period.
	 */

	memcpy(&ng->ptr, &old_ng->ptr, old_ng->len * sizeof(void*));

	rcu_assign_pointer(net->gen, ng);
	kfree_rcu(old_ng, rcu);
assign:
	ng->ptr[id - 1] = data;
	return 0;
}

static int ops_init(const struct pernet_operations *ops, struct net *net)
{
	int err = -ENOMEM;
	void *data = NULL;

	if (ops->id && ops->size) {
		data = kzalloc(ops->size, GFP_KERNEL);
		if (!data)
			goto out;

		err = net_assign_generic(net, *ops->id, data);
		if (err)
			goto cleanup;
	}
	err = 0;
	if (ops->init)
		err = ops->init(net);
	if (!err)
		return 0;

cleanup:
	kfree(data);

out:
	return err;
}

static void ops_free(const struct pernet_operations *ops, struct net *net)
{
	if (ops->id && ops->size) {
		int id = *ops->id;
		kfree(net_generic(net, id));
	}
}

static void ops_exit_list(const struct pernet_operations *ops,
			  struct list_head *net_exit_list)
{
	struct net *net;
	if (ops->exit) {
		list_for_each_entry(net, net_exit_list, exit_list)
			ops->exit(net);
	}
	if (ops->exit_batch)
		ops->exit_batch(net_exit_list);
}

static void ops_free_list(const struct pernet_operations *ops,
			  struct list_head *net_exit_list)
{
	struct net *net;
	if (ops->size && ops->id) {
		list_for_each_entry(net, net_exit_list, exit_list)
			ops_free(ops, net);
	}
}

/*
 * setup_net runs the initializers for the network namespace object.
 */
static __net_init int setup_net(struct net *net, struct user_namespace *user_ns)
{
	/* Must be called with net_mutex held */
	const struct pernet_operations *ops, *saved_ops;
	int error = 0;
	LIST_HEAD(net_exit_list);

	atomic_set(&net->count, 1);
	atomic_set(&net->passive, 1);
	net->dev_base_seq = 1;
	net->user_ns = user_ns;

#ifdef NETNS_REFCNT_DEBUG
	atomic_set(&net->use_count, 0);
#endif

	list_for_each_entry(ops, &pernet_list, list) {
		error = ops_init(ops, net);
		if (error < 0)
			goto out_undo;
	}
out:
	return error;

out_undo:
	/* Walk through the list backwards calling the exit functions
	 * for the pernet modules whose init functions did not fail.
	 */
	list_add(&net->exit_list, &net_exit_list);
	saved_ops = ops;
	list_for_each_entry_continue_reverse(ops, &pernet_list, list)
		ops_exit_list(ops, &net_exit_list);

	ops = saved_ops;
	list_for_each_entry_continue_reverse(ops, &pernet_list, list)
		ops_free_list(ops, &net_exit_list);

	rcu_barrier();
	goto out;
}


#ifdef CONFIG_NET_NS
static struct kmem_cache *net_cachep;
static struct workqueue_struct *netns_wq;

static struct net *net_alloc(void)
{
	struct net *net = NULL;
	struct net_generic *ng;

	ng = net_alloc_generic();
	if (!ng)
		goto out;

	net = kmem_cache_zalloc(net_cachep, GFP_KERNEL);
	if (!net)
		goto out_free;

	rcu_assign_pointer(net->gen, ng);
out:
	return net;

out_free:
	kfree(ng);
	goto out;
}

static void net_free(struct net *net)
{
#ifdef NETNS_REFCNT_DEBUG
	if (unlikely(atomic_read(&net->use_count) != 0)) {
		pr_emerg("network namespace not free! Usage: %d\n",
			 atomic_read(&net->use_count));
		return;
	}
#endif
	kfree(net->gen);
	kmem_cache_free(net_cachep, net);
}

void net_drop_ns(void *p)
{
	struct net *ns = p;
	if (ns && atomic_dec_and_test(&ns->passive))
		net_free(ns);