AFS: Add security support and fix bugs
Subsystems (6)
David Howells
maintainercover AFS: Add security support and fix bugs
These patches build on the patchset labelled "AF_RXRPC socket family and AFS rewrite". The patches are also available for http download.
Firstly, the patches fix a number of bugs in AF_RXRPC:
http://people.redhat.com/~dhowells/rxrpc/09-af_rxrpc-own-workqueues.diff
http://people.redhat.com/~dhowells/rxrpc/10-af_rxrpc-fixes.diff
Secondly, they fix some bugs in the AFS filesystem:
http://people.redhat.com/~dhowells/rxrpc/11-afs-callback-wq.diff
http://people.redhat.com/~dhowells/rxrpc/12-afs-vlocation.diff
http://people.redhat.com/~dhowells/rxrpc/13-afs-multimount.diff
And finally, they add security support to AFS:
http://people.redhat.com/~dhowells/rxrpc/14-afs-rxrpc-key.diff
http://people.redhat.com/~dhowells/rxrpc/15-afs-nameidata-key.diff
http://people.redhat.com/~dhowells/rxrpc/16-afs-security.diff
A security key is acquired by running the klog program:
http://people.redhat.com/~dhowells/rxrpc/klog.c
This is compiled by:
make klog CFLAGS="-Wall -g" LDLIBS="-lcrypto -lcrypt -lkrb4 -lkeyutils"
And then run by:
./klog
Note that at the moment this is a rough and ready test program that has the username, realm, password and proposed key timeout compiled in. Note also that it will only talk to the AFS kaserver.
If a security key is acquired, then all subsequent operations - including VL lookups and mounts - performed with that session keyring will be authenticated using that key. The key can be viewed like so:
[root@andromeda ~]# keyctl show Session Keyring -3 --alswrv 0 0 keyring: _ses.3268 2 --alswrv 0 0 \_ keyring: _uid.0 111416553 --als--v 0 0 \_ rxrpc: [email protected]
David
David Howells
maintainerPATCH 1/8 AF_RXRPC: Use own workqueues
Make the AF_RXRPC module use its own workqueues with their own per-CPU threads. Currently it uses keventd to do the following tasks, amongst others:
(*) Security negotiation
(*) Packet encryption and decryption
(*) Packet resending
(*) ACK, abort and busy packet generation
(*) Timeout handling
(*) Missing packet catchup
(*) Parts of incoming call management
(*) Destruction of structures we've finished with
Some of these conflict with AFS's use of keventd, however, and can lead to effective deadlock of resources. Having discussed this, it has been suggested that encryption and decryption shouldn't be done in keventd (that's not unreasonable - it is potentially quite slow), and so the AF_RXRPC service is given its own threads rather than AFS.
It might be useful to consider using the rpciod threads for this, if they were separated out from the SunRPC module.
---
net/rxrpc/af_rxrpc.c | 17 ++++++++++++++--- net/rxrpc/ar-accept.c | 12 ++++++------ net/rxrpc/ar-ack.c | 10 +++++----- net/rxrpc/ar-call.c | 16 ++++++++-------- net/rxrpc/ar-connection.c | 8 ++++---- net/rxrpc/ar-connevent.c | 20 ++++++++++++++++++-- net/rxrpc/ar-error.c | 6 +++--- net/rxrpc/ar-input.c | 24 ++++++++++++------------ net/rxrpc/ar-internal.h | 28 ++++++++++++---------------- net/rxrpc/ar-local.c | 2 +- net/rxrpc/ar-output.c | 4 ++-- net/rxrpc/ar-peer.c | 2 +- net/rxrpc/ar-recvmsg.c | 2 +- net/rxrpc/ar-skbuff.c | 2 +- net/rxrpc/ar-transport.c | 8 ++++---- 15 files changed, 92 insertions(+), 69 deletions(-)
net/rxrpc/af_rxrpc.c +14 -3
@@ -41,6 +41,8 @@ atomic_t rxrpc_debug_id;/* count of skbs currently in use */ atomic_t rxrpc_n_skbs; +struct workqueue_struct *rxrpc_workqueue; +static void rxrpc_sock_destructor (struct sock *);/*
@@ -688,7 +690,7 @@ static int rxrpc_release_sock(struct sock *sk)/* try to flush out this socket */ rxrpc_release_calls_on_socket (rx); -flush_scheduled_work (); +flush_workqueue (rxrpc_workqueue);rxrpc_purge_queue (&sk->sk_receive_queue);if (rx->conn) {
@@ -785,15 +787,21 @@ static int __init af_rxrpc_init(void) rxrpc_epoch =htonl (xtime.tv_sec); + ret = -ENOMEM ; rxrpc_call_jar =kmem_cache_create ("rxrpc_call_jar" ,sizeof (struct rxrpc_call ),0 ,SLAB_HWCACHE_ALIGN ,NULL ,NULL );if (!rxrpc_call_jar) {printk (KERN_NOTICE "RxRPC: Failed to allocate call jar\n" ); - ret = -ENOMEM ; goto error_call_jar; } + rxrpc_workqueue =create_workqueue ("krxrpcd" ); +if (!rxrpc_workqueue) { +printk (KERN_NOTICE "RxRPC: Failed to allocate work queue\n" ); + goto error_work_queue; + } + ret =proto_register (&rxrpc_proto,1 );if (ret <0 ) {printk (KERN_CRIT "RxRPC: Cannot register protocol\n" );
@@ -831,6 +839,8 @@ error_key_type: error_sock:proto_unregister (&rxrpc_proto); error_proto: +destroy_workqueue (rxrpc_workqueue); +error_work_queue:kmem_cache_destroy (rxrpc_call_jar); error_call_jar:return ret;
@@ -855,9 +865,10 @@ static void __exit af_rxrpc_exit(void) ASSERTCMP(atomic_read(&rxrpc_n_skbs), ==, 0);_debug ("flush scheduled work" ); -flush_scheduled_work (); +flush_workqueue (rxrpc_workqueue);proc_net_remove ("rxrpc_conns" );proc_net_remove ("rxrpc_calls" ); +destroy_workqueue (rxrpc_workqueue);kmem_cache_destroy (rxrpc_call_jar);_leave ("" ); }
net/rxrpc/ar-accept.c +6 -6
@@ -139,7 +139,7 @@ static int rxrpc_accept_incoming_call(struct rxrpc_local *local, call->conn->state =RXRPC_CONN_SERVER_CHALLENGING ;atomic_inc (&call->conn->usage);set_bit (RXRPC_CONN_CHALLENGE , &call->conn->events); -schedule_work (&call->conn->processor); +rxrpc_queue_conn (call->conn); }else {_debug ("conn ready" ); call->state =RXRPC_CALL_SERVER_ACCEPTING ;
@@ -183,7 +183,7 @@ invalid_service:if (!test_bit (RXRPC_CALL_RELEASE , &call->flags) && !test_and_set_bit (RXRPC_CALL_RELEASE , &call->events)) {rxrpc_get_call (call); -schedule_work (&call->processor); +rxrpc_queue_call (call); }read_unlock_bh (&call->state_lock);rxrpc_put_call (call);
@@ -375,7 +375,7 @@ struct rxrpc_call *rxrpc_accept_call(struct rxrpc_sock *rx,BUG ();if (test_and_set_bit (RXRPC_CALL_ACCEPTED , &call->events))BUG (); -schedule_work (&call->processor); +rxrpc_queue_call (call);rxrpc_get_call (call);write_unlock_bh (&call->state_lock);
@@ -390,7 +390,7 @@ out_release:_debug ("release %p" , call);if (!test_bit (RXRPC_CALL_RELEASED , &call->flags) && !test_and_set_bit (RXRPC_CALL_RELEASE , &call->events)) -schedule_work (&call->processor); +rxrpc_queue_call (call); out_discard:write_unlock_bh (&call->state_lock);_debug ("discard %p" , call);
@@ -429,7 +429,7 @@ int rxrpc_reject_call(struct rxrpc_sock *rx)case RXRPC_CALL_SERVER_ACCEPTING : call->state =RXRPC_CALL_SERVER_BUSY ;if (test_and_set_bit (RXRPC_CALL_REJECT_BUSY , &call->events)) -schedule_work (&call->processor); +rxrpc_queue_call (call); ret =0 ; goto out_release;case RXRPC_CALL_REMOTELY_ABORTED :
@@ -453,7 +453,7 @@ out_release:_debug ("release %p" , call);if (!test_bit (RXRPC_CALL_RELEASED , &call->flags) && !test_and_set_bit (RXRPC_CALL_RELEASE , &call->events)) -schedule_work (&call->processor); +rxrpc_queue_call (call); out_discard:write_unlock_bh (&call->state_lock);_debug ("discard %p" , call);
net/rxrpc/ar-ack.c +5 -5
@@ -113,7 +113,7 @@ cancel_timer:read_lock_bh (&call->state_lock);if (call->state <=RXRPC_CALL_COMPLETE && !test_and_set_bit (RXRPC_CALL_ACK , &call->events)) -schedule_work (&call->processor); +rxrpc_queue_call (call);read_unlock_bh (&call->state_lock); }
@@ -1166,7 +1166,7 @@ send_message_2:_debug ("sendmsg failed: %d" , ret);read_lock_bh (&call->state_lock);if (call->state <RXRPC_CALL_DEAD ) -schedule_work (&call->processor); +rxrpc_queue_call (call);read_unlock_bh (&call->state_lock); goto error; }
@@ -1210,7 +1210,7 @@ maybe_reschedule:if (call->events || !skb_queue_empty (&call->rx_queue)) {read_lock_bh (&call->state_lock);if (call->state <RXRPC_CALL_DEAD ) -schedule_work (&call->processor); +rxrpc_queue_call (call);read_unlock_bh (&call->state_lock); }
@@ -1224,7 +1224,7 @@ maybe_reschedule:read_lock_bh (&call->state_lock);if (!test_bit (RXRPC_CALL_RELEASED , &call->flags) && !test_and_set_bit (RXRPC_CALL_RELEASE , &call->events)) -schedule_work (&call->processor); +rxrpc_queue_call (call);read_unlock_bh (&call->state_lock); }
@@ -1238,7 +1238,7 @@ error:* work pending bit and the work item being processed again */ if (call->events && !work_pending (&call->processor)) {_debug ("jumpstart %x" ,ntohl (call->conn->cid)); -schedule_work (&call->processor); +rxrpc_queue_call (call); }_leave ("" );
net/rxrpc/ar-call.c +8 -8
@@ -264,7 +264,7 @@ struct rxrpc_call *rxrpc_incoming_call(struct rxrpc_sock *rx,switch (call->state) {case RXRPC_CALL_LOCALLY_ABORTED :if (!test_and_set_bit (RXRPC_CALL_ABORT , &call->events)) -schedule_work (&call->processor); +rxrpc_queue_call (call);case RXRPC_CALL_REMOTELY_ABORTED :read_unlock (&call->state_lock); goto aborted_call;
@@ -455,7 +455,7 @@ void rxrpc_release_call(struct rxrpc_call *call) call->state =RXRPC_CALL_LOCALLY_ABORTED ; call->abort_code =RX_CALL_DEAD ;set_bit (RXRPC_CALL_ABORT , &call->events); -schedule_work (&call->processor); +rxrpc_queue_call (call); }write_unlock (&call->state_lock);write_unlock_bh (&call->conn->lock);
@@ -538,7 +538,7 @@ static void rxrpc_mark_call_released(struct rxrpc_call *call)if (!test_and_set_bit (RXRPC_CALL_RELEASE , &call->events)) sched = true;if (sched) -schedule_work (&call->processor); +rxrpc_queue_call (call); }write_unlock (&call->state_lock); }
@@ -588,7 +588,7 @@ void __rxrpc_put_call(struct rxrpc_call *call)if (atomic_dec_and_test (&call->usage)) {_debug ("call %d dead" , call->debug_id); ASSERTCMP(call->state, ==, RXRPC_CALL_DEAD); -schedule_work (&call->destroyer); +rxrpc_queue_work (&call->destroyer); }_leave ("" ); }
@@ -613,7 +613,7 @@ static void rxrpc_cleanup_call(struct rxrpc_call *call) ASSERTCMP(call->events, ==, 0);if (work_pending (&call->processor)) {_debug ("defer destroy" ); -schedule_work (&call->destroyer); +rxrpc_queue_work (&call->destroyer);return ; }
@@ -742,7 +742,7 @@ static void rxrpc_call_life_expired(unsigned long _call)read_lock_bh (&call->state_lock);if (call->state <RXRPC_CALL_COMPLETE ) {set_bit (RXRPC_CALL_LIFE_TIMER , &call->events); -schedule_work (&call->processor); +rxrpc_queue_call (call); }read_unlock_bh (&call->state_lock); }
@@ -763,7 +763,7 @@ static void rxrpc_resend_time_expired(unsigned long _call)clear_bit (RXRPC_CALL_RUN_RTIMER , &call->flags);if (call->state <RXRPC_CALL_COMPLETE && !test_and_set_bit (RXRPC_CALL_RESEND_TIMER , &call->events)) -schedule_work (&call->processor); +rxrpc_queue_call (call);read_unlock_bh (&call->state_lock); }
@@ -782,6 +782,6 @@ static void rxrpc_ack_time_expired(unsigned long _call)read_lock_bh (&call->state_lock);if (call->state <RXRPC_CALL_COMPLETE && !test_and_set_bit (RXRPC_CALL_ACK , &call->events)) -schedule_work (&call->processor); +rxrpc_queue_call (call);read_unlock_bh (&call->state_lock); }
net/rxrpc/ar-connection.c +4 -4
@@ -778,7 +778,7 @@ void rxrpc_put_connection(struct rxrpc_connection *conn) conn->put_time = xtime.tv_sec;if (atomic_dec_and_test (&conn->usage)) {_debug ("zombie" ); -schedule_delayed_work (&rxrpc_connection_reap,0 ); +rxrpc_queue_delayed_work (&rxrpc_connection_reap,0 ); }_leave ("" );
@@ -862,8 +862,8 @@ void rxrpc_connection_reaper(struct work_struct *work)if (earliest !=ULONG_MAX ) {_debug ("reschedule reaper %ld" , (long ) earliest - now); ASSERTCMP(earliest, >, now); -schedule_delayed_work (&rxrpc_connection_reap, - (earliest - now) *HZ ); +rxrpc_queue_delayed_work (&rxrpc_connection_reap, + (earliest - now) *HZ ); }/* then destroy all those pulled out */
@@ -889,7 +889,7 @@ void __exit rxrpc_destroy_all_connections(void) rxrpc_connection_timeout =0 ;if (try_to_cancel_delayed_work (&rxrpc_connection_reap) >=0 ) -schedule_delayed_work (&rxrpc_connection_reap,0 ); +rxrpc_queue_delayed_work (&rxrpc_connection_reap,0 );_leave ("" ); }
net/rxrpc/ar-connevent.c +18 -2
@@ -45,7 +45,7 @@ static void rxrpc_abort_calls(struct rxrpc_connection *conn, int state,set_bit (RXRPC_CALL_CONN_ABORT , &call->events); else set_bit(RXRPC_CALL_RCVD_ABORT, &call->events); -schedule_work (&call->processor); +rxrpc_queue_call (call); }write_unlock (&call->state_lock); }
@@ -133,7 +133,7 @@ void rxrpc_call_is_secure(struct rxrpc_call *call)read_lock (&call->state_lock);if (call->state <RXRPC_CALL_COMPLETE && !test_and_set_bit (RXRPC_CALL_SECURED , &call->events)) -schedule_work (&call->processor); +rxrpc_queue_call (call);read_unlock (&call->state_lock); } }
@@ -308,6 +308,22 @@ protocol_error: }/* +* put a packet up for transport-level abort +*/ +void rxrpc_reject_packet (struct rxrpc_local *local,struct sk_buff *skb) +{ +CHECK_SLAB_OKAY (&local->usage); + +if (!atomic_inc_not_zero (&local->usage)) { +printk ("resurrected on reject\n" ); +BUG (); + } + +skb_queue_tail (&local->reject_queue, skb); +rxrpc_queue_work (&local->rejecter); +} + +/* * reject packets through the local endpoint */ void rxrpc_reject_packets (struct work_struct *work)
net/rxrpc/ar-error.c +3 -3
@@ -111,7 +111,7 @@ void rxrpc_UDP_error_report(struct sock *sk)/* pass the transport ref to error_handler to release */ skb_queue_tail (&trans->error_queue, skb); -schedule_work (&trans->error_handler); +rxrpc_queue_work (&trans->error_handler);/* reset and regenerate socket error */ spin_lock_bh (&sk->sk_error_queue.lock);
@@ -235,7 +235,7 @@ void rxrpc_UDP_error_handler(struct work_struct *work) call->state < RXRPC_CALL_NETWORK_ERROR) { call->state =RXRPC_CALL_NETWORK_ERROR ;set_bit (RXRPC_CALL_RCVD_ERROR , &call->events); -schedule_work (&call->processor); +rxrpc_queue_call (call); }write_unlock (&call->state_lock);list_del_init (&call->error_link);
@@ -245,7 +245,7 @@ void rxrpc_UDP_error_handler(struct work_struct *work) }if (!skb_queue_empty (&trans->error_queue)) -schedule_work (&trans->error_handler); +rxrpc_queue_work (&trans->error_handler);rxrpc_free_skb (skb);rxrpc_put_transport (trans);
net/rxrpc/ar-input.c +12 -12
@@ -238,7 +238,7 @@ static int rxrpc_fast_process_data(struct rxrpc_call *call,read_lock (&call->state_lock);if (call->state <RXRPC_CALL_COMPLETE && !test_and_set_bit (RXRPC_CALL_DRAIN_RX_OOS , &call->events)) -schedule_work (&call->processor); +rxrpc_queue_call (call);read_unlock (&call->state_lock); }
@@ -273,7 +273,7 @@ enqueue_packet:atomic_inc (&call->ackr_not_idle);read_lock (&call->state_lock);if (call->state <RXRPC_CALL_DEAD ) -schedule_work (&call->processor); +rxrpc_queue_call (call);read_unlock (&call->state_lock);_leave (" = 0 [queued]" );return 0 ;
@@ -366,7 +366,7 @@ void rxrpc_fast_process_packet(struct rxrpc_call *call, struct sk_buff *skb) call->state =RXRPC_CALL_REMOTELY_ABORTED ; call->abort_code = abort_code;set_bit (RXRPC_CALL_RCVD_ABORT , &call->events); -schedule_work (&call->processor); +rxrpc_queue_call (call); } goto free_packet_unlock;
@@ -381,7 +381,7 @@ void rxrpc_fast_process_packet(struct rxrpc_call *call, struct sk_buff *skb)case RXRPC_CALL_CLIENT_SEND_REQUEST : call->state =RXRPC_CALL_SERVER_BUSY ;set_bit (RXRPC_CALL_RCVD_BUSY , &call->events); -schedule_work (&call->processor); +rxrpc_queue_call (call);case RXRPC_CALL_SERVER_BUSY : goto free_packet_unlock;default :
@@ -425,7 +425,7 @@ void rxrpc_fast_process_packet(struct rxrpc_call *call, struct sk_buff *skb)read_lock_bh (&call->state_lock);if (call->state <RXRPC_CALL_DEAD ) {skb_queue_tail (&call->rx_queue, skb); -schedule_work (&call->processor); +rxrpc_queue_call (call); skb =NULL ; }read_unlock_bh (&call->state_lock);
@@ -440,7 +440,7 @@ protocol_error_locked: call->state =RXRPC_CALL_LOCALLY_ABORTED ; call->abort_code =RX_PROTOCOL_ERROR ;set_bit (RXRPC_CALL_ABORT , &call->events); -schedule_work (&call->processor); +rxrpc_queue_call (call); } free_packet_unlock:write_unlock_bh (&call->state_lock);
@@ -512,7 +512,7 @@ protocol_error: call->state =RXRPC_CALL_LOCALLY_ABORTED ; call->abort_code =RX_PROTOCOL_ERROR ;set_bit (RXRPC_CALL_ABORT , &call->events); -schedule_work (&call->processor); +rxrpc_queue_call (call); }write_unlock_bh (&call->state_lock);_leave ("" );
@@ -548,7 +548,7 @@ static void rxrpc_post_packet_to_call(struct rxrpc_connection *conn,switch (call->state) {case RXRPC_CALL_LOCALLY_ABORTED :if (!test_and_set_bit (RXRPC_CALL_ABORT , &call->events)) -schedule_work (&call->processor); +rxrpc_queue_call (call);case RXRPC_CALL_REMOTELY_ABORTED :case RXRPC_CALL_NETWORK_ERROR :case RXRPC_CALL_DEAD :
@@ -597,7 +597,7 @@ dead_call: sp->hdr.seq == __constant_cpu_to_be32(1)) {_debug ("incoming call" );skb_queue_tail (&conn->trans->local->accept_queue, skb); -schedule_work (&conn->trans->local->acceptor); +rxrpc_queue_work (&conn->trans->local->acceptor); goto done; }
@@ -636,7 +636,7 @@ found_completed_call:_debug ("final ack again" );rxrpc_get_call (call);set_bit (RXRPC_CALL_ACK_FINAL , &call->events); -schedule_work (&call->processor); +rxrpc_queue_call (call); free_unlock:read_unlock (&call->state_lock);
@@ -657,7 +657,7 @@ static void rxrpc_post_packet_to_conn(struct rxrpc_connection *conn,atomic_inc (&conn->usage);skb_queue_tail (&conn->rx_queue, skb); -schedule_work (&conn->processor); +rxrpc_queue_conn (conn); }/*
@@ -773,7 +773,7 @@ cant_route_call:if (sp->hdr.seq ==__constant_cpu_to_be32 (1 )) {_debug ("first packet" );skb_queue_tail (&local->accept_queue, skb); -schedule_work (&local->acceptor); +rxrpc_queue_work (&local->acceptor);rxrpc_put_local (local);_leave (" [incoming]" );return ;
net/rxrpc/ar-internal.h +12 -16
@@ -19,8 +19,6 @@#define CHECK_SLAB_OKAY (X ) do {} while(0)#endif -extern atomic_t rxrpc_n_skbs; -#define FCRYPT_BSIZE 8 struct rxrpc_crypt { union {
@@ -29,8 +27,12 @@ struct rxrpc_crypt { }; } __attribute__((aligned(8))); -extern __be32 rxrpc_epoch;/* local epoch for detecting local-end reset */ -extern atomic_t rxrpc_debug_id;/* current debugging ID */ +#define rxrpc_queue_work (WS ) queue_work(rxrpc_workqueue, (WS)) +#define rxrpc_queue_delayed_work (WS ,D ) \ + queue_delayed_work(rxrpc_workqueue, (WS), (D)) + +#define rxrpc_queue_call (CALL ) rxrpc_queue_work(&(CALL)->processor) +#define rxrpc_queue_conn (CONN ) rxrpc_queue_work(&(CONN)->processor)/* * sk_state for RxRPC sockets
@@ -430,19 +432,12 @@ static inline void rxrpc_abort_call(struct rxrpc_call *call, u32 abort_code) }/* -* put a packet up for transport-level abort +* af_rxrpc.c */ -static inline -void rxrpc_reject_packet (struct rxrpc_local *local,struct sk_buff *skb) -{ -CHECK_SLAB_OKAY (&local->usage); -if (!atomic_inc_not_zero (&local->usage)) { -printk ("resurrected on reject\n" ); -BUG (); - } -skb_queue_tail (&local->reject_queue, skb); -schedule_work (&local->rejecter); -} +extern atomic_t rxrpc_n_skbs; +extern __be32 rxrpc_epoch; +extern atomic_t rxrpc_debug_id; +extern struct workqueue_struct *rxrpc_workqueue;/* * ar-accept.c
@@ -507,6 +502,7 @@ rxrpc_incoming_connection(struct rxrpc_transport *, struct rxrpc_header *,* ar-connevent.c */ extern void rxrpc_process_connection (struct work_struct *); +extern void rxrpc_reject_packet (struct rxrpc_local *,struct sk_buff *);extern void rxrpc_reject_packets (struct work_struct *);/*
net/rxrpc/ar-local.c +1 -1
@@ -228,7 +228,7 @@ void rxrpc_put_local(struct rxrpc_local *local)write_lock_bh (&rxrpc_local_lock);if (unlikely (atomic_dec_and_test (&local->usage))) {_debug ("destroy local" ); -schedule_work (&local->destroyer); +rxrpc_queue_work (&local->destroyer); }write_unlock_bh (&rxrpc_local_lock);_leave ("" );
net/rxrpc/ar-output.c +2 -2
@@ -113,7 +113,7 @@ static void rxrpc_send_abort(struct rxrpc_call *call, u32 abort_code)clear_bit (RXRPC_CALL_RESEND_TIMER , &call->events);clear_bit (RXRPC_CALL_ACK , &call->events);clear_bit (RXRPC_CALL_RUN_RTIMER , &call->flags); -schedule_work (&call->processor); +rxrpc_queue_call (call); }write_unlock_bh (&call->state_lock);
@@ -435,7 +435,7 @@ static inline void rxrpc_instant_resend(struct rxrpc_call *call)clear_bit (RXRPC_CALL_RUN_RTIMER , &call->flags);if (call->state <RXRPC_CALL_COMPLETE && !test_and_set_bit (RXRPC_CALL_RESEND_TIMER , &call->events)) -schedule_work (&call->processor); +rxrpc_queue_call (call); }read_unlock_bh (&call->state_lock); }
net/rxrpc/ar-peer.c +1 -1
@@ -219,7 +219,7 @@ void rxrpc_put_peer(struct rxrpc_peer *peer)return ; } -schedule_work (&peer->destroyer); +rxrpc_queue_work (&peer->destroyer);_leave ("" ); }
net/rxrpc/ar-recvmsg.c +1 -1
@@ -33,7 +33,7 @@ void rxrpc_remove_user_ID(struct rxrpc_sock *rx, struct rxrpc_call *call)read_lock_bh (&call->state_lock);if (!test_bit (RXRPC_CALL_RELEASED , &call->flags) && !test_and_set_bit (RXRPC_CALL_RELEASE , &call->events)) -schedule_work (&call->processor); +rxrpc_queue_call (call);read_unlock_bh (&call->state_lock); }
net/rxrpc/ar-skbuff.c +1 -1
@@ -36,7 +36,7 @@ static void rxrpc_request_final_ACK(struct rxrpc_call *call)rxrpc_get_call (call);set_bit (RXRPC_CALL_ACK_FINAL , &call->events);if (try_to_del_timer_sync (&call->ack_timer) >=0 ) -schedule_work (&call->processor); +rxrpc_queue_call (call);break ;case RXRPC_CALL_SERVER_RECV_REQUEST :
net/rxrpc/ar-transport.c +4 -4
@@ -189,7 +189,7 @@ void rxrpc_put_transport(struct rxrpc_transport *trans)/* let the reaper determine the timeout to avoid a race with * overextending the timeout if the reaper is running at the * same time */ -schedule_delayed_work (&rxrpc_transport_reap,0 ); +rxrpc_queue_delayed_work (&rxrpc_transport_reap,0 );_leave ("" ); }
@@ -243,8 +243,8 @@ static void rxrpc_transport_reaper(struct work_struct *work)if (earliest !=ULONG_MAX ) {_debug ("reschedule reaper %ld" , (long ) earliest - now); ASSERTCMP(earliest, >, now); -schedule_delayed_work (&rxrpc_transport_reap, - (earliest - now) *HZ ); +rxrpc_queue_delayed_work (&rxrpc_transport_reap, + (earliest - now) *HZ ); }/* then destroy all those pulled out */
@@ -270,7 +270,7 @@ void __exit rxrpc_destroy_all_transports(void) rxrpc_transport_timeout =0 ;if (try_to_cancel_delayed_work (&rxrpc_transport_reap) >=0 ) -schedule_delayed_work (&rxrpc_transport_reap,0 ); +rxrpc_queue_delayed_work (&rxrpc_transport_reap,0 );_leave ("" ); }
David Howells
maintainerPATCH 2/8 AF_RXRPC: Lower dead call timeout and fix available call counting on connections
In reply to David HowellsMake a couple of fixes to AF_RXRPC:
(1) The dead call timeout is shortened to 2 seconds. Without this, each completed call sits around eating up resources for 10 seconds. The calls need to hang around for a little while in case duplicate packets appear, but 10 seconds is excessive.
(2) The number of available calls on a connection (conn->avail_calls) wasn't being decremented when a new call was allocated for a connection that didn't have any calls in progress. This an occasional BUG occurring when we tried to find an empty channel slot on a connection that was supposed to have one available and didn't.
In association with this, more assertions have been added to check this.
---
net/rxrpc/ar-call.c | 59 +++++++++++++++++++++++++++++---------------- net/rxrpc/ar-connection.c | 20 ++++++++++++++- 2 files changed, 56 insertions(+), 23 deletions(-)
net/rxrpc/ar-call.c +38 -21
@@ -19,7 +19,7 @@ struct kmem_cache *rxrpc_call_jar;LIST_HEAD (rxrpc_calls);DEFINE_RWLOCK (rxrpc_call_lock);static unsigned rxrpc_call_max_lifetime =60 ; -static unsigned rxrpc_dead_call_timeout =10 ; +static unsigned rxrpc_dead_call_timeout =2 ;static void rxrpc_destroy_call (struct work_struct *work);static void rxrpc_call_life_expired (unsigned long _call);
@@ -398,6 +398,7 @@ found_extant_call:*/ void rxrpc_release_call (struct rxrpc_call *call) { +struct rxrpc_connection *conn = call->conn;struct rxrpc_sock *rx = call->socket; _enter("{%d,%d,%d,%d}",
@@ -413,8 +414,7 @@ void rxrpc_release_call(struct rxrpc_call *call)/* dissociate from the socket * - the socket's ref on the call is passed to the death timer */ -_debug ("RELEASE CALL %p (%d CONN %p)" , - call, call->debug_id, call->conn); +_debug ("RELEASE CALL %p (%d CONN %p)" , call, call->debug_id, conn);write_lock_bh (&rx->call_lock);if (!list_empty (&call->accept_link)) {
@@ -430,24 +430,42 @@ void rxrpc_release_call(struct rxrpc_call *call) }write_unlock_bh (&rx->call_lock); -if (call->conn->out_clientflag) -spin_lock (&call->conn->trans->client_lock); -write_lock_bh (&call->conn->lock); -/* free up the channel for reuse */ -if (call->conn->out_clientflag) { - call->conn->avail_calls++; -if (call->conn->avail_calls ==RXRPC_MAXCALLS ) -list_move_tail (&call->conn->bundle_link, - &call->conn->bundle->unused_conns); -else if (call->conn->avail_calls ==1 ) -list_move_tail (&call->conn->bundle_link, - &call->conn->bundle->avail_conns); +spin_lock (&conn->trans->client_lock); +write_lock_bh (&conn->lock); +write_lock (&call->state_lock); + +if (conn->channels[call->channel] == call) + conn->channels[call->channel] =NULL ; + +if (conn->out_clientflag && conn->bundle) { + conn->avail_calls++; +switch (conn->avail_calls) { +case 1 : +list_move_tail (&conn->bundle_link, + &conn->bundle->avail_conns); + case 2 ... RXRPC_MAXCALLS - 1: +ASSERT (conn->channels[0 ] ==NULL || + conn->channels[1 ] ==NULL || + conn->channels[2 ] ==NULL || + conn->channels[3 ] ==NULL ); +break ; +case RXRPC_MAXCALLS : +list_move_tail (&conn->bundle_link, + &conn->bundle->unused_conns); +ASSERT (conn->channels[0 ] ==NULL && + conn->channels[1 ] ==NULL && + conn->channels[2 ] ==NULL && + conn->channels[3 ] ==NULL ); +break ; +default : +printk (KERN_ERR "RxRPC: conn->avail_calls=%d\n" , + conn->avail_calls); +BUG (); + } } -write_lock (&call->state_lock); -if (call->conn->channels[call->channel] == call) - call->conn->channels[call->channel] =NULL ; +spin_unlock (&conn->trans->client_lock);if (call->state <RXRPC_CALL_COMPLETE && call->state !=RXRPC_CALL_CLIENT_FINAL_ACK ) {
@@ -458,10 +476,9 @@ void rxrpc_release_call(struct rxrpc_call *call)rxrpc_queue_call (call); }write_unlock (&call->state_lock); -write_unlock_bh (&call->conn->lock); -if (call->conn->out_clientflag) -spin_unlock (&call->conn->trans->client_lock); +write_unlock_bh (&conn->lock); +/* clean up the Rx queue */ if (!skb_queue_empty (&call->rx_queue) || !skb_queue_empty (&call->rx_oos_queue)) {struct rxrpc_skb_priv *sp;
net/rxrpc/ar-connection.c +18 -2
@@ -356,7 +356,7 @@ static int rxrpc_connect_exclusive(struct rxrpc_sock *rx, conn->out_clientflag =RXRPC_CLIENT_INITIATED ; conn->cid =0 ; conn->state =RXRPC_CONN_CLIENT ; - conn->avail_calls =RXRPC_MAXCALLS ; + conn->avail_calls =RXRPC_MAXCALLS -1 ; conn->security_level = rx->min_sec_level; conn->key =key_get (rx->key);
@@ -447,6 +447,11 @@ int rxrpc_connect_call(struct rxrpc_sock *rx,if (--conn->avail_calls ==0 )list_move (&conn->bundle_link, &bundle->busy_conns); + ASSERTCMP(conn->avail_calls, <, RXRPC_MAXCALLS); +ASSERT (conn->channels[0 ] ==NULL || + conn->channels[1 ] ==NULL || + conn->channels[2 ] ==NULL || + conn->channels[3 ] ==NULL );atomic_inc (&conn->usage);break ; }
@@ -456,6 +461,12 @@ int rxrpc_connect_call(struct rxrpc_sock *rx, conn =list_entry (bundle->unused_conns.next, struct rxrpc_connection, bundle_link); + ASSERTCMP(conn->avail_calls, ==, RXRPC_MAXCALLS); + conn->avail_calls =RXRPC_MAXCALLS -1 ; +ASSERT (conn->channels[0 ] ==NULL && + conn->channels[1 ] ==NULL && + conn->channels[2 ] ==NULL && + conn->channels[3 ] ==NULL );atomic_inc (&conn->usage);list_move (&conn->bundle_link, &bundle->avail_conns);break ;
@@ -512,7 +523,7 @@ int rxrpc_connect_call(struct rxrpc_sock *rx, candidate->state =RXRPC_CONN_CLIENT ; candidate->avail_calls =RXRPC_MAXCALLS ; candidate->security_level = rx->min_sec_level; - candidate->key =key_get (rx->key); + candidate->key =key_get (bundle->key); ret =rxrpc_init_client_conn_security (candidate);if (ret <0 ) {
@@ -555,6 +566,10 @@ int rxrpc_connect_call(struct rxrpc_sock *rx,for (chan =0 ; chan <RXRPC_MAXCALLS ; chan++)if (!conn->channels[chan]) goto found_channel; +ASSERT (conn->channels[0 ] ==NULL || + conn->channels[1 ] ==NULL || + conn->channels[2 ] ==NULL || + conn->channels[3 ] ==NULL );BUG (); found_channel:
@@ -567,6 +582,7 @@ found_channel:_net ("CONNECT client on conn %d chan %d as call %x" , conn->debug_id, chan,ntohl (call->call_id)); + ASSERTCMP(conn->avail_calls, <, RXRPC_MAXCALLS);spin_unlock (&trans->client_lock);rxrpc_add_call_ID_to_conn (conn, call);
David Howells
maintainerPATCH 3/8 AFS: Fix callback aggregator work item deadlock
In reply to David HowellsFix a deadlock in the give-up-callback aggregator dispatcher work item whereby the aggregator runs on keventd as does timed autounmount, thus leading to the unmount blocking keventd whilst waiting for keventd to run the aggregator when the give-up-callback buffer is full.
---
fs/afs/callback.c | 14 +++++++++----- fs/afs/fsclient.c | 6 ++++-- 2 files changed, 13 insertions(+), 7 deletions(-)
fs/afs/callback.c +9 -5
@@ -232,7 +232,8 @@ static void afs_do_give_up_callback(struct afs_server *server,* possible to ship in one operation */ switch (atomic_inc_return (&server->cb_break_n)) { case 1 ... AFSCBMAX - 1: -schedule_delayed_work (&server->cb_break_work,HZ *2 ); +queue_delayed_work (afs_callback_update_worker, + &server->cb_break_work,HZ *2 );break ;case AFSCBMAX :afs_flush_callback_breaks (server);
@@ -271,9 +272,11 @@ void afs_give_up_callback(struct afs_vnode *vnode)spin_lock (&server->cb_lock);if (vnode->cb_promised &&afs_breakring_space (server) ==0 ) {add_wait_queue (&server->cb_break_waitq, &myself); -while (vnode->cb_promised && -afs_breakring_space (server) ==0 ) { +for (;;) {set_current_state (TASK_UNINTERRUPTIBLE ); +if (!vnode->cb_promised || +afs_breakring_space (server) !=0 ) +break ;spin_unlock (&server->cb_lock);schedule ();spin_lock (&server->cb_lock);
@@ -315,7 +318,8 @@ void afs_dispatch_give_up_callbacks(struct work_struct *work)void afs_flush_callback_breaks (struct afs_server *server) {if (try_to_cancel_delayed_work (&server->cb_break_work) >=0 ) -schedule_delayed_work (&server->cb_break_work,0 ); +queue_delayed_work (afs_callback_update_worker, + &server->cb_break_work,0 ); }#if 0
@@ -426,7 +430,7 @@ static void afs_callback_updater(struct work_struct *work)int __init afs_callback_update_init (void ) { afs_callback_update_worker = -create_singlethread_workqueue ("kafs_cbupdated" ); +create_singlethread_workqueue ("kafs_callbackd" );return afs_callback_update_worker ?0 : -ENOMEM ; }
fs/afs/fsclient.c +4 -2
@@ -355,10 +355,11 @@ int afs_fs_give_up_callbacks(struct afs_server *server,__be32 *bp, *tp;int loop; -_enter ("" ); - ncallbacks =CIRC_CNT (server->cb_break_head, server->cb_break_tail,ARRAY_SIZE (server->cb_break)); + +_enter ("{%zu}," , ncallbacks); +if (ncallbacks ==0 )return 0 ;if (ncallbacks >AFSCBMAX )
@@ -398,6 +399,7 @@ int afs_fs_give_up_callbacks(struct afs_server *server, (ARRAY_SIZE (server->cb_break) -1 ); } +ASSERT (ncallbacks >0 );wake_up_nr (&server->cb_break_waitq, ncallbacks);return afs_make_call (&server->addr, call,GFP_NOFS , wait_mode);
David Howells
maintainerPATCH 4/8 AFS: Correctly alter relocation state after update and show state in /proc
In reply to David HowellsCorrectly alter the relocation state after update is complete by switching it from "Updating" to "Valid".
Also display the record state in the vlocation database proc file.
---
fs/afs/proc.c | 15 +++++++++++++-- fs/afs/vlocation.c | 4 +++- 2 files changed, 16 insertions(+), 3 deletions(-)
fs/afs/proc.c +13 -2
@@ -553,6 +553,16 @@ static void afs_proc_cell_volumes_stop(struct seq_file *p, void *v)up_read (&cell->vl_sem); } +const char afs_vlocation_states[][4 ] = { + [AFS_VL_NEW ] ="New" , + [AFS_VL_CREATING ] ="Crt" , + [AFS_VL_VALID ] ="Val" , + [AFS_VL_NO_VOLUME ] ="NoV" , + [AFS_VL_UPDATING ] ="Upd" , + [AFS_VL_VOLUME_DELETED ] ="Del" , + [AFS_VL_UNCERTAIN ] ="Unc" , +}; +/* * display a header line followed by a load of volume lines */
@@ -563,13 +573,14 @@ static int afs_proc_cell_volumes_show(struct seq_file *m, void *v)/* display header on line 1 */ if (v == (void *)1 ) { -seq_puts (m,"USE VLID[0] VLID[1] VLID[2] NAME\n" ); +seq_puts (m,"USE STT VLID[0] VLID[1] VLID[2] NAME\n" );return 0 ; }/* display one cell per line on subsequent lines */ - seq_printf(m, "%3d %08x %08x %08x %s\n", + seq_printf(m, "%3d %s %08x %08x %08x %s\n", atomic_read(&vlocation->usage), + afs_vlocation_states[vlocation->state], vlocation->vldb.vid[0], vlocation->vldb.vid[1], vlocation->vldb.vid[2],
fs/afs/vlocation.c +3 -1
@@ -657,7 +657,7 @@ static void afs_vlocation_updater(struct work_struct *work)switch (ret) {case 0 :afs_vlocation_apply_update (vl, &vldb); - vl->state =AFS_VL_UPDATING ; + vl->state =AFS_VL_VALID ;break ;case -ENOMEDIUM : vl->state =AFS_VL_VOLUME_DELETED ;
@@ -691,6 +691,8 @@ static void afs_vlocation_updater(struct work_struct *work) timeout = afs_vlocation_update_timeout; } +ASSERT (list_empty (&vl->update)); +list_add_tail (&vl->update, &afs_vlocation_updates);_debug ("timeout %ld" , timeout);
David Howells
maintainerPATCH 5/8 AFS: Handle multiple mounts of an AFS superblock correctly
In reply to David HowellsHandle multiple mounts of an AFS superblock correctly, checking to see whether the superblock is already initialised after calling sget() rather than just unconditionally stamping all over it.
Also delete the "silent" parameter to afs_fill_super() as it's not used and can, in any case, be obtained from sb->s_flags.
---
fs/afs/super.c | 26 ++++++++++++++++---------- 1 files changed, 16 insertions(+), 10 deletions(-)
fs/afs/super.c +16 -10
@@ -212,7 +212,7 @@ static int afs_test_super(struct super_block *sb, void *data)/* * fill in the superblock */ -static int afs_fill_super (struct super_block *sb,void *data,int silent) +static int afs_fill_super (struct super_block *sb,void *data) {struct afs_mount_params *params = data;struct afs_super_info *as =NULL ;
@@ -319,17 +319,23 @@ static int afs_get_sb(struct file_system_type *fs_type, goto error; } - sb->s_flags = flags; - - ret =afs_fill_super (sb, ¶ms, flags &MS_SILENT ?1 :0 ); -if (ret <0 ) { -up_write (&sb->s_umount); -deactivate_super (sb); - goto error; +if (!sb->s_root) { +/* initial superblock/root creation */ +_debug ("create" ); + sb->s_flags = flags; + ret =afs_fill_super (sb, ¶ms); +if (ret <0 ) { +up_write (&sb->s_umount); +deactivate_super (sb); + goto error; + } + sb->s_flags |=MS_ACTIVE ; + }else { +_debug ("reuse" ); + ASSERTCMP(sb->s_flags, &, MS_ACTIVE); } - sb->s_flags |=MS_ACTIVE ; -simple_set_mnt (mnt, sb); +simple_set_mnt (mnt, sb);afs_put_volume (params.volume);afs_put_cell (params.default_cell);_leave (" = 0 [%p]" , sb);
David Howells
maintainerPATCH 6/8 AFS: AF_RXRPC key changes
In reply to David HowellsMake two changes to the AF_RXRPC key handling to make it easier for AFS to use:
(1) Export key_type_rxrpc so that AFS can request keys of this type.
(2) Make it possible to have keys that represent "no security". These are created by instantiating the keys with no data.
---
include/keys/rxrpc-type.h | 22 ++++++++++++++++++++++ net/rxrpc/af_rxrpc.c | 2 ++ net/rxrpc/ar-key.c | 10 +++++++++- net/rxrpc/ar-output.c | 6 +++++- 4 files changed, 38 insertions(+), 2 deletions(-)
include/keys/rxrpc-type.h new file +22 -0
@@ -0,0 +1,22 @@ +/* RxRPC key type +* +* Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. +* Written by David Howells ([email protected]) +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version +* 2 of the License, or (at your option) any later version. +*/ + +#ifndef _KEYS_RXRPC_TYPE_H +#define _KEYS_RXRPC_TYPE_H + +#include <linux/key.h> + +/* +* key type for AF_RXRPC keys +*/ +extern struct key_type key_type_rxrpc; + +#endif /* _KEYS_USER_TYPE_H */
net/rxrpc/af_rxrpc.c +2 -0
@@ -299,6 +299,8 @@ struct rxrpc_call *rxrpc_kernel_begin_call(struct socket *sock,if (!key) key = rx->key; +if (key && !key->payload.data) + key =NULL ;/* a no-security key */ bundle =rxrpc_get_bundle (rx, trans, key, service_id, gfp);if (IS_ERR (bundle)) {
net/rxrpc/ar-key.c +9 -1
@@ -19,6 +19,7 @@#include <linux/crypto.h> #include <net/sock.h> #include <net/af_rxrpc.h> +#include <keys/rxrpc-type.h> #include <keys/user-type.h> #include "ar-internal.h"
@@ -40,6 +41,8 @@ struct key_type key_type_rxrpc = { .describe = rxrpc_describe, }; +EXPORT_SYMBOL (key_type_rxrpc); +/* * rxrpc server defined keys take "<serviceId>:<securityIndex>" as the * description and an 8-byte decryption key as the payload
@@ -63,6 +66,8 @@ struct key_type key_type_rxrpc_s = {* 12 4 kvno * 16 8 session key * 24 [len] ticket +* +* if no data is provided, then a no-security key is made */ static int rxrpc_instantiate (struct key *key,const void *data,size_t datalen) {
@@ -74,6 +79,10 @@ static int rxrpc_instantiate(struct key *key, const void *data, size_t datalen)_enter ("{%x},,%zu" ,key_serial (key), datalen); +/* handle a no-security key */ +if (!data && datalen ==0 ) +return 0 ; +/* get the key interface version number */ ret = -EINVAL ;if (datalen <=4 || !data)
@@ -287,7 +296,6 @@ int rxrpc_get_server_data_key(struct rxrpc_connection *conn,struct rxkad_key tsec; } data; -_enter ("" ); key = key_alloc(&key_type_rxrpc, "x", 0, 0, current, 0,
net/rxrpc/ar-output.c +5 -1
@@ -132,6 +132,7 @@ int rxrpc_client_sendmsg(struct kiocb *iocb, struct rxrpc_sock *rx,enum rxrpc_command cmd;struct rxrpc_call *call;unsigned long user_call_ID =0 ; +struct key *key;__be16 service_id;u32 abort_code =0 ;int ret;
@@ -153,7 +154,10 @@ int rxrpc_client_sendmsg(struct kiocb *iocb, struct rxrpc_sock *rx, (struct sockaddr_rxrpc *) msg->msg_name; service_id =htons (srx->srx_service); } - bundle =rxrpc_get_bundle (rx, trans, rx->key, service_id, + key = rx->key; +if (key && !rx->key->payload.data) + key =NULL ; + bundle =rxrpc_get_bundle (rx, trans, key, service_id,GFP_KERNEL );if (IS_ERR (bundle))return PTR_ERR (bundle);
David Howells
maintainerPATCH 7/8 AFS: Permit key to be cached in nameidata
In reply to David HowellsPermit a key to be cached in the nameidata struct so that it only needs to be looked up once when doing the sequence of d_revalidate(), permission(), follow_link() and lookup() calls involved in a pathwalk.
This is used by the AFS filesystem to avoid repeatedly having to call request_key(). Once looked up, the key is then available as the kernel walks to the tree until such a time as the kernel crosses to a non-AFS mountpoint or an AFS mountpoint in a different cell.
The cache works like this:
(1) The nameidata::key pointer is initialised to NULL at the start of the pathwalk (do_path_lookup()). path_release() and co. release the key it points to.
(2) Any filesystem operation performed during the pathwalk that has access to the nameidata (lookup, permission, follow_link, d_revalidate) can look at the key - if non-NULL - and if it's what they're looking for they can use it.
If there's a key there of potential interest, the key's type and description should be checked to make sure the key is permissible.
If of interest, key_validate() should be called to make sure the key is still usable. If it isn't, the error should be passed back rather than the key lookup being redone on the basis that some earlier step is now no longer valid.
(3) Any operation that is not interested in the key can either ignore it or release it and clear the pointer.
(4) If an operation wants to put its own key there, it should release the old
key and set the pointer to point to its own key with the key's usage count
incremented. This could be encapsulated in a function something like
this:
void set_nd_key(struct nameidata *nd, struct key *key)
{
key_put(nd->key);
nd->key = key_get(key);
}Unfortunately there isn't currently a way to pass the key onto the inode operations for create(), link(), unlink(), and suchlike, nor is there a way to pass it to the open() file op without adding a struct key pointer argument to each of these.
This might also be useful for NFS and CIFS.
---
fs/namei.c | 5 +++++ fs/open.c | 7 +++++-- include/linux/namei.h | 1 + 3 files changed, 11 insertions(+), 2 deletions(-)
fs/namei.c +5 -0
@@ -350,6 +350,8 @@ void path_release(struct nameidata *nd) {dput (nd->dentry);mntput (nd->mnt); +key_put (nd->key); + nd->key =NULL ; }/*
@@ -360,6 +362,8 @@ void path_release_on_umount(struct nameidata *nd) {dput (nd->dentry);mntput_no_expire (nd->mnt); +key_put (nd->key); + nd->key =NULL ; }/**
@@ -1108,6 +1112,7 @@ static int fastcall do_path_lookup(int dfd, const char *name,struct file *file;struct fs_struct *fs = current->fs; + nd->key =NULL ; nd->last_type =LAST_ROOT ;/* if there are only slashes... */ nd->flags = flags; nd->depth =0 ;
fs/open.c +5 -2
@@ -822,10 +822,13 @@ struct file *nameidata_to_filp(struct nameidata *nd, int flags)/* Pick up the filp from the open intent */ filp = nd->intent.open.file;/* Has the filesystem initialised the file for us? */ -if (filp->f_path.dentry ==NULL ) +if (filp->f_path.dentry ==NULL ) { filp =__dentry_open (nd->dentry, nd->mnt, flags, filp,NULL ); -else +key_put (nd->key); + nd->key =NULL ; + }else {path_release (nd); + }return filp; }
include/linux/namei.h +1 -0
@@ -17,6 +17,7 @@ enum { MAX_NESTED_LINKS = 8 };struct nameidata {struct dentry *dentry;struct vfsmount *mnt; +struct key *key;struct qstr last;unsigned int flags;int last_type;
David Howells
maintainerPATCH 8/8 AFS: Add security support
In reply to David HowellsAdd security support to the AFS filesystem. Kerberos IV tickets are added as RxRPC keys are added to the session keyring with the klog program. open() and other VFS operations then find this ticket with request_key() and either use it immediately (eg: mkdir, unlink) or attach it to a file descriptor (open).
---
fs/afs/AFS.h | 27 +++- fs/afs/Makefile | 1 fs/afs/callback.c | 5 + fs/afs/cell.c | 98 ++++++++++--- fs/afs/cmservice.c | 3 fs/afs/dir.c | 51 +++++-- fs/afs/file.c | 60 +++++++- fs/afs/fsclient.c | 9 + fs/afs/inode.c | 21 ++- fs/afs/internal.h | 107 +++++++++++--- fs/afs/mntpt.c | 12 +- fs/afs/rxrpc.c | 137 ++++++++++++++---- fs/afs/security.c | 400 ++++++++++++++++++++++++++++++++++++++++++++++++++++ fs/afs/super.c | 142 ++++++++++++++++-- fs/afs/vlclient.c | 6 + fs/afs/vlocation.c | 26 ++- fs/afs/vnode.c | 25 ++- fs/afs/volume.c | 109 +++----------- 18 files changed, 1001 insertions(+), 238 deletions(-)
fs/afs/AFS.h +25 -2
@@ -14,6 +14,9 @@#include <linux/in.h> +#define AFS_MAXCELLNAME 64/* maximum length of a cell name */ +#define AFS_MAXVOLNAME 64/* maximum length of a volume name */ +typedef unsigned afs_volid_t ;typedef unsigned afs_vnodeid_t ;typedef unsigned long long afs_dataversion_t ;
@@ -75,6 +78,26 @@ struct afs_volume_info { };/* +* AFS security ACE access mask +*/ +typedef u32 afs_access_t ; +#define AFS_ACE_READ 0x00000001U/* - permission to read a file/dir */ +#define AFS_ACE_WRITE 0x00000002U/* - permission to write/chmod a file */ +#define AFS_ACE_INSERT 0x00000004U/* - permission to create dirent in a dir */ +#define AFS_ACE_LOOKUP 0x00000008U/* - permission to lookup a file/dir in a dir */ +#define AFS_ACE_DELETE 0x00000010U/* - permission to delete a dirent from a dir */ +#define AFS_ACE_LOCK 0x00000020U/* - permission to lock a file */ +#define AFS_ACE_ADMINISTER 0x00000040U/* - permission to change ACL */ +#define AFS_ACE_USER_A 0x01000000U/* - 'A' user-defined permission */ +#define AFS_ACE_USER_B 0x02000000U/* - 'B' user-defined permission */ +#define AFS_ACE_USER_C 0x04000000U/* - 'C' user-defined permission */ +#define AFS_ACE_USER_D 0x08000000U/* - 'D' user-defined permission */ +#define AFS_ACE_USER_E 0x10000000U/* - 'E' user-defined permission */ +#define AFS_ACE_USER_F 0x20000000U/* - 'F' user-defined permission */ +#define AFS_ACE_USER_G 0x40000000U/* - 'G' user-defined permission */ +#define AFS_ACE_USER_H 0x80000000U/* - 'H' user-defined permission */ + +/* * AFS file status information */ struct afs_file_status {
@@ -87,8 +110,8 @@ struct afs_file_status {afs_dataversion_t data_version;/* current data version */ unsigned author;/* author ID */ unsigned owner;/* owner ID */ -unsigned caller_access;/* access rights for authenticated caller */ -unsigned anon_access;/* access rights for unauthenticated caller */ +afs_access_t caller_access;/* access rights for authenticated caller */ +afs_access_t anon_access;/* access rights for unauthenticated caller */ umode_t mode;/* UNIX mode */ struct afs_fid parent;/* parent file ID */ time_t mtime_client;/* last time client changed data */
fs/afs/Makefile +1 -0
@@ -15,6 +15,7 @@ kafs-objs := \ mntpt.o \ proc.o \ rxrpc.o \ + security.o \ server.o \ super.o \ vlclient.o \
fs/afs/callback.c +4 -1
@@ -72,7 +72,10 @@ void afs_broken_callback_work(struct work_struct *work)return ;/* someone else is dealing with it */ if (test_bit (AFS_VNODE_CB_BROKEN , &vnode->flags)) { -if (afs_vnode_fetch_status (vnode) <0 ) +if (S_ISDIR (vnode->vfs_inode.i_mode)) +afs_clear_permits (vnode); + +if (afs_vnode_fetch_status (vnode,NULL ,NULL ) <0 ) goto out;if (test_bit (AFS_VNODE_DELETED , &vnode->flags))
fs/afs/cell.c +77 -21
162 lines not on this page · raw message
fs/afs/cmservice.c +3 -0
@@ -28,6 +28,7 @@ static void afs_cm_destructor(struct afs_call *);* CB.CallBack operation type */ static const struct afs_call_type afs_SRXCBCallBack = { + .name ="CB.CallBack" , .deliver = afs_deliver_cb_callback, .abort_to_error = afs_abort_to_error, .destructor = afs_cm_destructor,
@@ -37,6 +38,7 @@ static const struct afs_call_type afs_SRXCBCallBack = {* CB.InitCallBackState operation type */ static const struct afs_call_type afs_SRXCBInitCallBackState = { + .name ="CB.InitCallBackState" , .deliver = afs_deliver_cb_init_call_back_state, .abort_to_error = afs_abort_to_error, .destructor = afs_cm_destructor,
@@ -46,6 +48,7 @@ static const struct afs_call_type afs_SRXCBInitCallBackState = {* CB.Probe operation type */ static const struct afs_call_type afs_SRXCBProbe = { + .name ="CB.Probe" , .deliver = afs_deliver_cb_probe, .abort_to_error = afs_abort_to_error, .destructor = afs_cm_destructor,
fs/afs/dir.c +38 -13
171 lines not on this page · raw message
fs/afs/file.c +53 -7
96 lines not on this page · raw message
fs/afs/fsclient.c +8 -1
@@ -148,6 +148,7 @@ static int afs_deliver_fs_fetch_status(struct afs_call *call,* FS.FetchStatus operation type */ static const struct afs_call_type afs_RXFSFetchStatus = { + .name ="FS.FetchStatus" , .deliver = afs_deliver_fs_fetch_status, .abort_to_error = afs_abort_to_error, .destructor = afs_flat_call_destructor,
@@ -157,6 +158,7 @@ static const struct afs_call_type afs_RXFSFetchStatus = {* fetch the status information for a file */ int afs_fs_fetch_file_status (struct afs_server *server, +struct key *key,struct afs_vnode *vnode,struct afs_volsync *volsync,const struct afs_wait_mode *wait_mode)
@@ -164,12 +166,13 @@ int afs_fs_fetch_file_status(struct afs_server *server,struct afs_call *call;__be32 *bp; -_enter ("" ); +_enter (",%x,,," ,key_serial (key)); call =afs_alloc_flat_call (&afs_RXFSFetchStatus,16 ,120 );if (!call)return -ENOMEM ; + call->key = key; call->reply = vnode; call->reply2 = volsync; call->service_id =FS_SERVICE ;
@@ -279,6 +282,7 @@ static int afs_deliver_fs_fetch_data(struct afs_call *call,* FS.FetchData operation type */ static const struct afs_call_type afs_RXFSFetchData = { + .name ="FS.FetchData" , .deliver = afs_deliver_fs_fetch_data, .abort_to_error = afs_abort_to_error, .destructor = afs_flat_call_destructor,
@@ -288,6 +292,7 @@ static const struct afs_call_type afs_RXFSFetchData = {* fetch data from a file */ int afs_fs_fetch_data(struct afs_server *server, + struct key *key, struct afs_vnode *vnode, off_t offset, size_t length, struct page *buffer,
@@ -303,6 +308,7 @@ int afs_fs_fetch_data(struct afs_server *server,if (!call)return -ENOMEM ; + call->key = key; call->reply = vnode; call->reply2 = volsync; call->reply3 = buffer;
@@ -338,6 +344,7 @@ static int afs_deliver_fs_give_up_callbacks(struct afs_call *call,* FS.GiveUpCallBacks operation type */ static const struct afs_call_type afs_RXFSGiveUpCallBacks = { + .name ="FS.GiveUpCallBacks" , .deliver = afs_deliver_fs_give_up_callbacks, .abort_to_error = afs_abort_to_error, .destructor = afs_flat_call_destructor,
fs/afs/inode.c +15 -6
@@ -29,7 +29,7 @@ struct afs_iget_data {/* * map the AFS file status to the inode member variables */ -static int afs_inode_map_status (struct afs_vnode *vnode) +static int afs_inode_map_status (struct afs_vnode *vnode,struct key *key) {struct inode *inode =AFS_VNODE_TO_I (vnode);
@@ -44,7 +44,7 @@ static int afs_inode_map_status(struct afs_vnode *vnode)case AFS_FTYPE_FILE : inode->i_mode =S_IFREG | vnode->status.mode; inode->i_op = &afs_file_inode_operations; - inode->i_fop = &generic_ro_fops; + inode->i_fop = &afs_file_operations;break ;case AFS_FTYPE_DIR : inode->i_mode =S_IFDIR | vnode->status.mode;
@@ -73,7 +73,7 @@ static int afs_inode_map_status(struct afs_vnode *vnode)/* check to see whether a symbolic link is really a mountpoint */ if (vnode->status.type ==AFS_FTYPE_SYMLINK ) { -afs_mntpt_check_symlink (vnode); +afs_mntpt_check_symlink (vnode, key);if (test_bit (AFS_VNODE_MOUNTPOINT , &vnode->flags)) { inode->i_mode =S_IFDIR | vnode->status.mode;
@@ -115,7 +115,8 @@ static int afs_iget5_set(struct inode *inode, void *opaque)/* * inode retrieval */ -inline struct inode *afs_iget (struct super_block *sb,struct afs_fid *fid) +inline struct inode *afs_iget (struct super_block *sb,struct key *key, +struct afs_fid *fid) {struct afs_iget_data data = { .fid = *fid };struct afs_super_info *as;
@@ -157,10 +158,10 @@ inline struct inode *afs_iget(struct super_block *sb, struct afs_fid *fid)/* okay... it's a new inode */ set_bit (AFS_VNODE_CB_BROKEN , &vnode->flags); - ret =afs_vnode_fetch_status (vnode); + ret =afs_vnode_fetch_status (vnode,NULL , key);if (ret <0 ) goto bad_inode; - ret =afs_inode_map_status (vnode); + ret =afs_inode_map_status (vnode, key);if (ret <0 ) goto bad_inode;
@@ -201,6 +202,7 @@ int afs_inode_getattr(struct vfsmount *mnt, struct dentry *dentry,*/ void afs_clear_inode (struct inode *inode) { +struct afs_permits *permits;struct afs_vnode *vnode; vnode =AFS_FS_I (inode);
@@ -233,5 +235,12 @@ void afs_clear_inode(struct inode *inode) vnode->cache =NULL ;#endif +mutex_lock (&vnode->permits_lock); + permits = vnode->permits; +rcu_assign_pointer (vnode->permits,NULL ); +mutex_unlock (&vnode->permits_lock); +if (permits) +call_rcu (&permits->rcu, afs_zap_permits); +_leave ("" ); }
fs/afs/internal.h +81 -26
240 lines not on this page · raw message
fs/afs/mntpt.c +8 -4
@@ -48,8 +48,11 @@ unsigned long afs_mntpt_expiry_timeout = 10 * 60;* check a symbolic link to see whether it actually encodes a mountpoint * - sets the AFS_VNODE_MOUNTPOINT flag on the vnode appropriately */ -int afs_mntpt_check_symlink (struct afs_vnode *vnode) +int afs_mntpt_check_symlink (struct afs_vnode *vnode,struct key *key) { +struct file file = { + .private_data = key, + };struct page *page;size_t size;char *buf;
@@ -58,7 +61,7 @@ int afs_mntpt_check_symlink(struct afs_vnode *vnode)_enter ("{%u,%u}" , vnode->fid.vnode, vnode->fid.unique);/* read the contents of the symlink into the pagecache */ - page =read_mapping_page (AFS_VNODE_TO_I (vnode)->i_mapping,0 ,NULL ); + page =read_mapping_page (AFS_VNODE_TO_I (vnode)->i_mapping,0 , &file);if (IS_ERR (page)) { ret =PTR_ERR (page); goto out;
@@ -214,7 +217,7 @@ static void *afs_mntpt_follow_link(struct dentry *dentry, struct nameidata *nd)struct vfsmount *newmnt;int err; - _enter("%p{%s},{%s:%p{%s}}", + _enter("%p{%s},{%s:%p{%s},}", dentry, dentry->d_name.name, nd->mnt->mnt_devname,
@@ -234,7 +237,8 @@ static void *afs_mntpt_follow_link(struct dentry *dentry, struct nameidata *nd) err =do_add_mount (newmnt, nd,MNT_SHRINKABLE , &afs_vfsmounts);switch (err) {case 0 : -path_release (nd); +mntput (nd->mnt); +dput (nd->dentry); nd->mnt = newmnt; nd->dentry =dget (newmnt->mnt_root); schedule_delayed_work(&afs_mntpt_expiry_timer,
fs/afs/rxrpc.c +107 -30
281 lines not on this page · raw message
fs/afs/security.c new file +400 -0
400 lines not on this page · raw message
fs/afs/super.c +120 -22
211 lines not on this page · raw message
fs/afs/vlclient.c +6 -0
@@ -127,6 +127,7 @@ static int afs_deliver_vl_get_entry_by_xxx(struct afs_call *call,* VL.GetEntryByName operation type */ static const struct afs_call_type afs_RXVLGetEntryByName = { + .name ="VL.GetEntryByName" , .deliver = afs_deliver_vl_get_entry_by_xxx, .abort_to_error = afs_vl_abort_to_error, .destructor = afs_flat_call_destructor,
@@ -136,6 +137,7 @@ static const struct afs_call_type afs_RXVLGetEntryByName = {* VL.GetEntryById operation type */ static const struct afs_call_type afs_RXVLGetEntryById = { + .name ="VL.GetEntryById" , .deliver = afs_deliver_vl_get_entry_by_xxx, .abort_to_error = afs_vl_abort_to_error, .destructor = afs_flat_call_destructor,
@@ -145,6 +147,7 @@ static const struct afs_call_type afs_RXVLGetEntryById = {* dispatch a get volume entry by name operation */ int afs_vl_get_entry_by_name (struct in_addr *addr, +struct key *key,const char *volname,struct afs_cache_vlocation *entry,const struct afs_wait_mode *wait_mode)
@@ -163,6 +166,7 @@ int afs_vl_get_entry_by_name(struct in_addr *addr,if (!call)return -ENOMEM ; + call->key = key; call->reply = entry; call->service_id =VL_SERVICE ; call->port =htons (AFS_VL_PORT );
@@ -183,6 +187,7 @@ int afs_vl_get_entry_by_name(struct in_addr *addr,* dispatch a get volume entry by ID operation */ int afs_vl_get_entry_by_id(struct in_addr *addr, + struct key *key, afs_volid_t volid, afs_voltype_t voltype, struct afs_cache_vlocation *entry,
@@ -197,6 +202,7 @@ int afs_vl_get_entry_by_id(struct in_addr *addr,if (!call)return -ENOMEM ; + call->key = key; call->reply = entry; call->service_id =VL_SERVICE ; call->port =htons (AFS_VL_PORT );
fs/afs/vlocation.c +16 -10
@@ -33,6 +33,7 @@ static struct workqueue_struct *afs_vlocation_update_worker;* about the volume in question */ static int afs_vlocation_access_vl_by_name (struct afs_vlocation *vl, +struct key *key,struct afs_cache_vlocation *vldb) {struct afs_cell *cell = vl->cell;
@@ -49,7 +50,7 @@ static int afs_vlocation_access_vl_by_name(struct afs_vlocation *vl,_debug ("CellServ[%hu]: %08x" , cell->vl_curr_svix, addr.s_addr);/* attempt to access the VL server */ - ret =afs_vl_get_entry_by_name (&addr, vl->vldb.name, vldb, + ret =afs_vl_get_entry_by_name (&addr, key, vl->vldb.name, vldb, &afs_sync_call);switch (ret) {case 0 :
@@ -86,6 +87,7 @@ out:* about the volume in question */ static int afs_vlocation_access_vl_by_id (struct afs_vlocation *vl, +struct key *key,afs_volid_t volid,afs_voltype_t voltype,struct afs_cache_vlocation *vldb)
@@ -104,7 +106,7 @@ static int afs_vlocation_access_vl_by_id(struct afs_vlocation *vl,_debug ("CellServ[%hu]: %08x" , cell->vl_curr_svix, addr.s_addr);/* attempt to access the VL server */ - ret =afs_vl_get_entry_by_id (&addr, volid, voltype, vldb, + ret =afs_vl_get_entry_by_id (&addr, key, volid, voltype, vldb, &afs_sync_call);switch (ret) {case 0 :
@@ -188,6 +190,7 @@ static struct afs_vlocation *afs_vlocation_alloc(struct afs_cell *cell,* update record if we found it in the cache */ static int afs_vlocation_update_record (struct afs_vlocation *vl, +struct key *key,struct afs_cache_vlocation *vldb) {afs_voltype_t voltype;
@@ -228,7 +231,7 @@ static int afs_vlocation_update_record(struct afs_vlocation *vl,/* contact the server to make sure the volume is still available * - TODO: need to handle disconnected operation here */ - ret =afs_vlocation_access_vl_by_id (vl, vid, voltype, vldb); + ret =afs_vlocation_access_vl_by_id (vl, key, vid, voltype, vldb);switch (ret) {/* net error */ default :
@@ -287,7 +290,8 @@ static void afs_vlocation_apply_update(struct afs_vlocation *vl,* fill in a volume location record, consulting the cache and the VL server * both */ -static int afs_vlocation_fill_in_record (struct afs_vlocation *vl) +static int afs_vlocation_fill_in_record (struct afs_vlocation *vl, +struct key *key) {struct afs_cache_vlocation vldb;int ret;
@@ -310,11 +314,11 @@ static int afs_vlocation_fill_in_record(struct afs_vlocation *vl)/* try to update a known volume in the cell VL databases by * ID as the name may have changed */ _debug ("found in cache" ); - ret =afs_vlocation_update_record (vl, &vldb); + ret =afs_vlocation_update_record (vl, key, &vldb); }else {/* try to look up an unknown volume in the cell VL databases by * name */ - ret =afs_vlocation_access_vl_by_name (vl, &vldb); + ret =afs_vlocation_access_vl_by_name (vl, key, &vldb);if (ret <0 ) {printk ("kAFS: failed to locate '%s' in cell '%s'\n" , vl->vldb.name, vl->cell->name);
@@ -366,14 +370,16 @@ void afs_vlocation_queue_for_updates(struct afs_vlocation *vl)* - insert/update in the local cache if did get a VL response */ struct afs_vlocation *afs_vlocation_lookup (struct afs_cell *cell, +struct key *key,const char *name,size_t namesz) {struct afs_vlocation *vl;int ret; -_enter ("{%s},%*.*s,%zu" , - cell->name, (int ) namesz, (int ) namesz, name, namesz); +_enter ("{%s},{%x},%*.*s,%zu" , + cell->name,key_serial (key), + (int ) namesz, (int ) namesz, name, namesz);if (namesz >sizeof (vl->vldb.name)) {_leave (" = -ENAMETOOLONG" );
@@ -405,7 +411,7 @@ struct afs_vlocation *afs_vlocation_lookup(struct afs_cell *cell,up_write (&cell->vl_sem); fill_in_record: - ret =afs_vlocation_fill_in_record (vl); + ret =afs_vlocation_fill_in_record (vl, key);if (ret <0 ) goto error_abandon; vl->state =AFS_VL_VALID ;
@@ -653,7 +659,7 @@ static void afs_vlocation_updater(struct work_struct *work) vl->upd_rej_cnt =0 ; vl->upd_busy_cnt =0 ; - ret =afs_vlocation_update_record (vl, &vldb); + ret =afs_vlocation_update_record (vl,NULL , &vldb);switch (ret) {case 0 :afs_vlocation_apply_update (vl, &vldb);
fs/afs/vnode.c +17 -8
@@ -238,9 +238,11 @@ static void afs_vnode_finalise_status_update(struct afs_vnode *vnode,* - there are any outstanding ops that will fetch the status * - TODO implement local caching */ -int afs_vnode_fetch_status (struct afs_vnode *vnode) +int afs_vnode_fetch_status (struct afs_vnode *vnode, +struct afs_vnode *auth_vnode,struct key *key) {struct afs_server *server; +unsigned long acl_order;int ret;DECLARE_WAITQUEUE (myself, current);
@@ -260,6 +262,10 @@ int afs_vnode_fetch_status(struct afs_vnode *vnode)return -ENOENT ; } + acl_order =0 ; +if (auth_vnode) + acl_order = auth_vnode->acl_order; +spin_lock (&vnode->lock); if (!test_bit(AFS_VNODE_CB_BROKEN, &vnode->flags) &&
@@ -324,12 +330,14 @@ get_anyway:_debug ("USING SERVER: %p{%08x}" , server,ntohl (server->addr.s_addr)); - ret =afs_fs_fetch_file_status (server, vnode,NULL , + ret =afs_fs_fetch_file_status (server, key, vnode,NULL , &afs_sync_call); }while (!afs_volume_release_fileserver (vnode, server, ret));/* adjust the flags */ +if (ret ==0 && auth_vnode) +afs_cache_permit (vnode, key, acl_order);afs_vnode_finalise_status_update (vnode, server, ret);_leave (" = %d" , ret);
@@ -340,17 +348,18 @@ get_anyway:* fetch file data from the volume * - TODO implement caching and server failover */ -int afs_vnode_fetch_data (struct afs_vnode *vnode,off_t offset,size_t length, -struct page *page) +int afs_vnode_fetch_data (struct afs_vnode *vnode,struct key *key, +off_t offset,size_t length,struct page *page) {struct afs_server *server;int ret; -_enter ("%s,{%u,%u,%u}" , +_enter ("%s{%u,%u,%u},%x,,," , vnode->volume->vlocation->vldb.name, vnode->fid.vid, vnode->fid.vnode, - vnode->fid.unique); + vnode->fid.unique, +key_serial (key));/* this op will fetch the status */ spin_lock (&vnode->lock);
@@ -367,8 +376,8 @@ int afs_vnode_fetch_data(struct afs_vnode *vnode, off_t offset, size_t length,_debug ("USING SERVER: %08x\n" ,ntohl (server->addr.s_addr)); - ret =afs_fs_fetch_data (server, vnode, offset, length, page, -NULL , &afs_sync_call); + ret =afs_fs_fetch_data (server, key, vnode, offset, length, + page,NULL , &afs_sync_call); }while (!afs_volume_release_fileserver (vnode, server, ret));
fs/afs/volume.c +22 -87
173 lines not on this page · raw message
Re: [PATCH 8/8] AFS: Add security support
Quoted 5 lines · David Howells
Add security support to the AFS filesystem. Kerberos IV tickets are added as RxRPC keys are added to the session keyring with the klog program.
open()and other VFS operations then find this ticket withrequest_key()and either use it immediately (eg: mkdir, unlink) or attach it to a file descriptor (open).
Just curious--when is the actual crypto done? There doesn't seem to be any in this patch.
--b.
David Howells
maintainerRe: [PATCH 8/8] AFS: Add security support
Quoted 2 lines · J. Bruce Fields
Just curious--when is the actual crypto done? There doesn't seem to be any in this patch.
See AF_RXRPC patch:
http://people.redhat.com/~dhowells/rxrpc/04-af_rxrpc.diff
You turn on CONFIG_RXKAD and load the rxkad module thus built (assuming you haven't built it in) after loading the af_rxrpc module. I probably should've mentioned that in the cover.
So anyone using sockets of family AF_RXRPC can use it. See these test programs:
(1) The klog test program fetches a ticket from the kaserver and adds it as a key of type rxrpc:
http://people.redhat.com/~dhowells/rxrpc/klog.c
(2) The listen test program which listens for potentially secured incoming calls:
http://people.redhat.com/~dhowells/rxrpc/listen.c
(3) The rxrpc test program which can make secure calls:
http://people.redhat.com/~dhowells/rxrpc/rxrpc.c
David
Re: [PATCH 8/8] AFS: Add security support
Quoted 5 lines · David Howells
Quoted 2 lines · J. Bruce Fields
Just curious--when is the actual crypto done? There doesn't seem to be any in this patch.
Quoted 7 lines
See
AF_RXRPCpatch:http://people.redhat.com/~dhowells/rxrpc/04-af_rxrpc.diff
You turn on
CONFIG_RXKADand load the rxkad module thus built (assuming you haven't built it in) after loading theaf_rxrpcmodule. I probably should've mentioned that in the cover.
Oh, I see--didn't think to check net/rxrpc. Thanks!
--b.