Pawn structure in king's indian or grünfeld I'm trying out kings indian against d4 openings but there is one problem... I get mated.

I can't defend after castling under the h7 g6 f7 pawn structure. Somehow it works as an opening with an opening for infiltrating enemy attackers. I.e. the a1-h8 diagonal seems like it is built by traitors on my team. 

Now my question to you is, what am I overlooking? How do I defend the g7 square? How do I stop enemies from getting too close to this strange triangle of mine (f6 and h6)? 

To be precise: it is this pawn triangle that I can not defend when I have castled under it. Does not matter if it is with white or black pieces, queen side or king side.

EDIT: since I know now what it is called, I am talking about the "house". I am not talking about some specific game or in the opening. It is later in the game, the bishop has probably been sent off for patting nearby pawns. The king is left in the house-of-holes.
Attacking/Defending the empty house

This is going to be a long answer that will require several edits to complete, but I wanted there to be an answer started.

Not moving a pawn in front of the king leads it to be vulnerable to back rank mates. Moving a pawn in front of the king (making luft) creates holes that can be exploited (particularly by knights). Each disturbance has its own peculiarities. CJS Purdy wrote an article that started to outline the weaknesses of the various pawn structures, but he barely scratched the surface of the problem.

In this first example Judit Polgar defends a piece with tactics. Her opponent takes the piece, giving up her fianchettoed bishop, and is promptly punished for the crass materialism. It is important when winning material with the use of the bishop, to check that you are not leaving yourself open. Particularly if your opponent retains his corresponding bishop.  I wrote a blog post that expands on this example here



[Event "Thessaloniki"]
[Site "Thessaloniki"]
[Date "1988.??.??"]
[EventDate "?"]
[Round "?"]
[Result "1-0"]
[White "Judit Polgar"]
[Black "Pavlina Angelova"]
[ECO "B31"]
[WhiteElo "?"]
[BlackElo "?"]
[PlyCount "33"]

[FEN ""]
1.e4 c5 2.Nf3 Nc6 3.Bb5 g6 4.O-O Bg7 5.c3 e5 6.d4 exd4 7.cxd4
Nxd4 8.Nxd4 cxd4 9.e5 Ne7 10.Bg5 O-O 11.Qxd4 Nc6 12.Qh4 Qb6
13.Nc3 Bxe5 14.Rae1 Bxc3 15.bxc3 Qxb5 16.Qh6 Qf5 17.Qxf8+ 1-0



White will mate with Bh6+ and Re8#. This is a variety of back rank mate. 

In this second example, a current line from the Catalan Opening, White gives up his fianchettoed bishop for a pawn, but leaving black with the corresponding bishop and better development. All white has is the pawn, but this position is considered a slight edge for white.



[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "Open Catalan"]
[Black "Theory Line"]
[Result "*"]
[PlyCount "27"]

[FEN ""]

1. d4 d5 2. c4 e6 3. Nf3 Nf6 4. g3 Be7 5. Bg2 O-O 6. O-O dxc4 7. Ne5 Nc6 8.
Bxc6 bxc6 9. Nxc6 Qe8 10. Nxe7+ Qxe7 11. Qa4 e5 12. dxe5 Qxe5 13. Qxc4 Be6 14.
Qd3 *



White will block the long diagonal with f2-f3 and e2-e4 as needed. He will defend the g2 square with heavy pieces, and eventually gain pressure on blacks c7-pawn. White may need to return the b2-pawn.



h-file attack

This is the way many approach prying open the fianchettoed king. The variation against the Pirc defense is named the 150-attack after the British rating system for about 1700 ELO. It fails miserably against the Gruenfeld, because the center is too open for a wing attack, and has trouble against the KID, because white's c2-c4 move is mostly wasted, and makes the white king less safe on the queenside, but if black plays passively, it can work. This plan is most famous in the Yugoslav dragon, but black has found many resources that have caused white to shift to more flexible plans in the Yugoslav.

The key elements are:


a bishop and queen battery on e3 and d2 respectfully, The bishop will go to h6 and trade off the bishop on g7
pawns on e4 and f3, that protect the battery and support g2-g4
queenside castling to allow both rooks to come to the h-file
the advance of the h-pawn to trade on g6 and open the h-file
one or more rook sacrifices on the h-file to open things up.


Here is a manufactured game that shows the basic plan. Black plays many time wasting moves that modern players of the Dragon would not play.



[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "Sicilian Dragon,Yugoslav Attack"]
[Black "Too slow, too late"]
[Result "1-0"]
[PlyCount "47"]

[FEN ""]
1. e4 c5 2. Nf3 d6 3. d4 cxd4 4. Nxd4 Nf6 5. Nc3 g6 6. Be3 Nc6 7. f3 Bg7 8. Qd2
O-O 9. O-O-O Bd7 10. h4 Qa5 11. g4 Rfc8 12. Nb3 Qc7 13. h5 Ne5 14. Be2 b5 15.
hxg6 fxg6 16. Bh6 b4 17. Nd5 Nxd5 18. Bxg7 Kxg7?? 19. Qh6+ Kf6 20. g5+ Kf7 21.
Qxh7+ Kf8 22. Qh8+ Kf7 23. Rh7+ Ke6 24. Nd4# 1-0




To handle this attack, it is of critical importance for black to get an attack rolling quickly on the queenside or the center, and not to panic. 18...Kxg7?? is a huge blunder, while 18...Ne3 saves, as 19.Qxe3?? Qxc2#

Other ideas to keep in mind:


open up the center. This is one way that KID players try to disrupt the Saemisch
sometimes h7-h5 can be played to block the opening of the h-file. This is risky if white has a bishop on the a2-g8 diagonal
trade or divert white's bishop from the c1-h6 diagonal.




Next edit will talk about the f-file attack.